% Computer Modern Roman upper case:
% These letters were originally coded by D. E. Knuth in November, 1979,
% inspired by the Monotype faces used in {\sl The Art of Computer Programming}.
% Sans serif designs by Richard Southall were added in April, 1982.
% The programs were revised for the new \MF\ conventions in 1985.

% Character codes \0101 through \0132 are generated.

cmchar "The letter A";
beginchar("A",13u#,cap←height#,0);
adjust←fit(cap←serif←fit#,cap←serif←fit#);
numeric left←stem,right←stem,outer←jut,alpha;
right←stem=cap←stem-stem←corr;
left←stem=min(cap←hair if hefty: -3stem←corr fi,right←stem);
outer←jut=.8cap←jut; x1l=w-x4r=l+letter←fit+outer←jut+.5u; y1=y4=0;
x2-x1=x4-x3; x3r=x2r+apex←corr; y2=y3=h+apex←o+apex←oo;
alpha=diag←ratio(2,left←stem,y2-y1,x4r-x1l-apex←corr);
penpos1(alpha*left←stem,0); penpos2(alpha*left←stem,0);
penpos3(alpha*right←stem,0); penpos4(alpha*right←stem,0);
z0=whatever[z1r,z2r]=whatever[z3l,z4l];
if y0<h-cap←notch←cut: y0:=h-cap←notch←cut;
 fill z0+.5right{down}...{z4-z3}diag←end(3l,4l,1,1,4r,3r)
  --diag←end(4r,3r,1,1,2l,1l)--diag←end(2l,1l,1,1,1r,2r){z2-z1}
  ...{up}z0+.5left--cycle; % left and right diagonals
else: fill z0--diag←end(0,4l,1,1,4r,3r)--diag←end(4r,3r,1,1,2l,1l)
  --diag←end(2l,1l,1,1,1r,0)--cycle; fi % left and right diagonals
penpos5(whatever,angle(z2-z1)); z5=whatever[z1,z2];
penpos6(whatever,angle(z3-z4)); z6=whatever[z3,z4]; y6=y5;
if hefty: y5r else: y5 fi =5/12y0;
y5r-y5l=y6r-y6l=cap←band; penstroke z5e--z6e; % bar line
if serifs: numeric inner←jut; pickup tiny.nib;
 prime←points←inside(1,2); prime←points←inside(4,3);
 if rt x1'r+cap←jut+.5u+1<=lft x4'l-cap←jut: inner←jut=cap←jut;
 else: rt x1'r+inner←jut+.5u+1=lft x4'l-inner←jut; fi
 dish←serif(1',2,a,1/2,outer←jut,b,.6,inner←jut)(dark);  % left serif
 dish←serif(4',3,c,1/2,inner←jut,d,1/3,outer←jut); fi  % right serif
penlabels(0,1,2,3,4,5,6); endchar;

cmchar "The letter B";
beginchar("B",12.5u#,cap←height#,0);
italcorr .75cap←height#*slant-.5u#;
adjust←fit(cap←serif←fit#,0);
numeric left←stem,right←curve,middle←weight;
left←stem=cap←stem-hround 2stem←corr; middle←weight=.6vair+.5;
pickup tiny.nib; pos1(left←stem,0); pos2(left←stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5left←stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
penpos3(cap←band,90); penpos4(cap←band,90);
penpos6(middle←weight,-90); penpos7(middle←weight,-90);
penpos8(middle←weight,90); penpos9(middle←weight,90);
penpos5(right←curve-stem←corr,0); penpos10(right←curve,0);
penpos11(cap←band,-90); penpos12(cap←band,-90);
z3r=top z1; y4=y3; y5=.5[y4,y6]; y6=y7; y7l-y8l=vair;
z12r=bot z2; y11=y12; y10=.5[y11,y9]; y8=y9; .5[y7l,y8l]=.52h;
x4=x6; x9=x11=x4+.5u; x7=x8=x1; x9l:=x4+.25u;
x5r=hround(w-1.5u); x10r=hround(w-u);
if serifs: right←curve=cap←curve-stem←corr; x4=.5[x1,w-1.5u];
else: right←curve=cap←curve-3stem←corr; x4=.5[x1,w-2.5u];
 x4l:=x4l-.5u; x9l:=x9l-.5u; fi
x6l:=x6l-.5u; x11l:=x11l-.5u;
fill stroke z3e..super←arc.e(4,5) & super←arc.e(5,6)..z7e;  % upper lobe
fill stroke z8e..super←arc.e(9,10) & super←arc.e(10,11)..z12e;  % lower lobe
if serifs: dish←serif(1,2,a,1/3,cap←jut,b,1/3,.5cap←jut);  % upper serif
 dish←serif(2,1,c,1/3,cap←jut,d,1/3,.5cap←jut); fi  % lower serif
math←fit(0,.5ic#); penlabels(1,2,3,4,5,6,7,8,9,10,11,12); endchar;

cmchar "The letter C";
if serifs: beginchar("C",13u#,cap←height#,0);
 italcorr cap←height#*slant-.5u#;
 adjust←fit(0,0);
 pickup fine.nib; pos1(cap←hair,0); pos2(cap←band,90);
 pos3(cap←curve,180); pos4(cap←band,270); pos5(hair,360);
 rt x1r=rt x5r=hround(w-u); lft x3r=hround u; x2=x4=.55[x3,x1];
 top y2r=h+o; bot y4r=-o; y3=.5[y2,y4];
 bot y1=vround max(.6h,x←height-.5vair); y5=good.y .95(h-y1);
 (x2l',y2l)=whatever[z2r,z1l]; x2l:=x2l';
 (x4l',y4l)=whatever[z4r,z5l]; x4l:=x4l';
 filldraw stroke z1e{x2-x1,10(y2-y1)}
  ...pulled←arc.e(2,3) & pulled←arc.e(3,4)...{up}z5e; % arc
 x6=x1r; top y6=h+o; x1r-x1'=2cap←curve-fine; y1'=y1;
 path upper←arc; upper←arc=z1{x2-x1,10(y2-y1)}..z2{left};
 numeric t; t=xpart(upper←arc intersectiontimes (z6--z1'));
 filldraw z1r--z6--subpath(t,0) of upper←arc--cycle; % barb
else: beginchar("C",11.5u#,cap←height#,0);
 italcorr cap←height#*slant-.5u#;
 adjust←fit(0,0);
 pickup fine.nib; pos1(1.2flare,80); pos2(slab,90);
 pos3(cap←curve,180); pos4(slab,270); pos5(flare,275);
 rt x1r=hround(w-1.1u); x2=x4=.5w+1.25u;
 lft x3r=hround max(u,2u-.5cap←curve); rt x5r=hround(w-.9u);
 top y1r=vround .95h+o; top y2r=h+o; y3=.5h;
 bot y4r=-o; bot y5r=vround .08h-o; y5l:=good.y y5l; x5l:=good.x x5l;
 filldraw stroke rterm.e(2,1,right,.9,4) & super←arc.e(2,3)
  & super←arc.e(3,4) & term.e(4,5,right,.8,4); fi % arc and terminals
math←fit(-.3cap←height#*slant-.5u#,.5ic#);
penlabels(1,1',2,3,4,5,6); endchar;

cmchar "The letter D";
beginchar("D",13.5u#,cap←height#,0);
italcorr .7cap←height#*slant-.5u#;
adjust←fit(cap←serif←fit#,0);
pickup tiny.nib; pos1(cap←stem',0); pos2(cap←stem',0);
lft x1l=lft x2l=hround max(2u,3u-.5cap←stem'); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
penpos3(cap←band,90); penpos4(cap←band,90);
penpos5(cap←curve-stem←corr,0);
penpos6(cap←band,-90); penpos7(cap←band,-90);
z3r=top z1; y4=y3; y5=.51[y4,y6]; y6=y7;
z7r=bot z2; x4=x6=.5w+.25u; x5r=hround(w-u);
x4l:=x6l:=x4-.25cap←curve;
fill stroke z3e..pulled←arc.e(4,5) & pulled←arc.e(5,6)..z7e;  % lobe
if serifs: dish←serif(1,2,a,1/3,cap←jut,b,1/3,.5cap←jut);  % upper serif
 dish←serif(2,1,c,1/3,cap←jut,d,1/3,.5cap←jut); fi  % lower serif
math←fit(0,ic#-.5u#); penlabels(1,2,3,4,5,6,7); endchar;

cmchar "The letter E";
beginchar("E",12u#-width←adj#,cap←height#,0);
italcorr cap←height#*slant-beak←jut#-.5u#;
adjust←fit(cap←serif←fit#,0);
h:=vround(h-stem←corr);
pickup tiny.nib; pos1(cap←stem,0); pos2(cap←stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5cap←stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
pickup crisp.nib; pos3(slab,90); pos4(hair,0);
top y3r=h; x3=x1; rt x4r=hround(w-u); y4=good.y(y3l-beak)-eps;
arm(3,4,e,beak←darkness,beak←jut);  % upper arm and beak
pos5(cap←bar,-90); pos6(hair,0);
top y5l=vround(.52[y2,y1]+.5cap←bar); x5=x1;
pos0(cap←bar,90); pos7(hair,0);
z0=z5; x6=x7; y6-y5l=y0l-y7;
if serifs: rt x6r=hround(w-4.4u+.5hair); y6=good.y(y5l+.6beak)+eps;
 rt x9r=hround(w-.5u);
else: rt x6r=hround(w-1.5u); y6=y5l+eps; rt x9r=hround(w-.75u); fi
arm(5,6,f,beak←darkness,0); arm(0,7,g,beak←darkness,0);  % middle arm and serif
pos8(slab if not serifs:+2stem←corr fi,-90); pos9(hair,0);
bot y8r=0; x8=x2; y9=good.y(y8l+7/6beak)+eps;
arm(8,9,h,beak←darkness,1.5beak←jut);  % lower arm and beak
if serifs: dish←serif(1,2,a,1/3,cap←jut,b,1/3,.5cap←jut);  % upper serif
 dish←serif(2,1,c,1/3,cap←jut,d,1/3,.5cap←jut); fi  % lower serif
math←fit(0,.5ic#); penlabels(0,1,2,3,4,5,6,7,8,9); endchar;

cmchar "The letter F";
beginchar("F",11.5u#-width←adj#,cap←height#,0);
italcorr cap←height#*slant-beak←jut#-.25u#;
adjust←fit(cap←serif←fit#,0);
h:=vround(h-stem←corr);
pickup tiny.nib; pos1(cap←stem,0); pos2(cap←stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5cap←stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
pickup crisp.nib; pos3(slab,90); pos4(hair,0);
top y3r=h; x3=x1; rt x4r=hround(w-.75u); y4=good.y(y3l-beak)-eps;
arm(3,4,e,beak←darkness,beak←jut);  % upper arm and beak
pos5(cap←bar,-90); pos6(hair,0);
top y5l=vround(.5[y2,y1]+.5cap←bar); x5=x1;
pos0(cap←bar,90); pos7(hair,0);
z0=z5; x6=x7; y6-y5l=y0l-y7;
if serifs: rt x6r=hround(w-4u+.5hair); y6=good.y(y5l+.6beak)+eps;
 rt x9r=hround(w-.5u);
else: rt x6r=hround(w-1.5u); y6=y5l+eps; rt x9r=hround(w-.75u); fi
arm(5,6,f,beak←darkness,0); arm(0,7,g,beak←darkness,0);  % middle arm and serif
if serifs: dish←serif(1,2,a,1/3,cap←jut,b,1/3,.5cap←jut);  % upper serif
 dish←serif(2,1,c,1/3,cap←jut,d,1/3,1.25cap←jut); fi  % lower serif
math←fit(0,ic#-2.5u#); penlabels(0,1,2,3,4,5,6,7,8,9); endchar;

cmchar "The letter G";
if serifs: beginchar("G",14u#,cap←height#,0);
 italcorr cap←height#*slant-1.5u#-.5cap←serif←fit#;
 adjust←fit(0,.5cap←serif←fit#);
 pickup tiny.nib; pos0(cap←stem,0); pos7(cap←stem,0);
 rt x0r=hround(w-2u); y0=good.y(.1[bar←height,x←height]+1); x7=x0;
 pickup fine.nib;
 if hefty: bot y7=0; pos5(cap←stem,0); x5=x0; top y5=tiny.top y0;
 else: pos5(cap←hair,0); pos8(cap←stem,0);
  y7=.5bar←height; z5l=z8l; z8=z7; x9=x8r; bot y9=0;
  filldraw z8l{down}..{4(x9-x8),y9-y8}z9--z8r--cycle; fi % spur
 pos1(cap←hair,0); pos2(cap←band,90);
 pos3(cap←curve,180); pos4(cap←band,270);
 rt x1r=hround(w-2u); lft x3r=hround u; x2=x4=.55[x3,x1];
 top y2r=h+o; bot y4r=-o; y3=.5[y2,y4];
 bot y1=vround max(.6h,x←height-.5vair);
 (x2l',y2l)=whatever[z2r,z1l]; x2l:=x2l';
 (x4l',y4l)=whatever[z4r,z5l]; x4l:=x4l';
 filldraw stroke z1e{x2-x1,10(y2-y1)}
  ...pulled←arc.e(2,3) & pulled←arc.e(3,4)...z5e{up}; % arc
 x6=x1r; top y6=h+o; x1r-x1'=2cap←curve-fine; y1'=y1;
 path upper←arc; upper←arc=z1{x2-x1,10(y2-y1)}..{left}z2;
 numeric t; t=xpart(upper←arc intersectiontimes (z6--z1'));
 filldraw subpath(0,t) of upper←arc--z6--z1r--z1--cycle; % barb
 pickup tiny.nib; filldraw stroke z0e--z7e;  % stem
 dish←serif(0,7,a,1/3,max(cap←jut,2.25u),b,1/3,1.25u);  % serif
 math←fit(-.3cap←height#*slant-.5u#,ic#);
else: beginchar("G",12u#,cap←height#,0);
 italcorr cap←height#*slant-.5u#;
 adjust←fit(0,0);
 pickup fine.nib; pos1(1.2flare,80); pos2(slab,90);
 pos3(cap←curve,180); pos4(slab,270); pos5(flare,270);
 rt x1r=hround(w-1.35u); x2=x4=.5w+u;
 lft x3r=hround max(u,2u-.5cap←curve); rt x5l=hround(w-1.2u);
 top y1r=vround .93h+o; top y2r=h+o; y3=.5h;
 bot y4r=-o; bot y5r=vround .07h-o;
 filldraw stroke rterm.e(2,1,right,.9,4)&super←arc.e(2,3)
  & super←arc.e(3,4) & term.e(4,5,right,1,4); % arc and terminals
 pos0(stem,0); pos7(stem,0);
 z7r=z5r; x0=x7; top y0=1+vround .35[bar←height,x←height];
 filldraw stroke z0e--z7e;  % stem
 pos8(cap←bar,90); pos9(cap←bar,90);
 z0r=z9r; y8=y9; lft x8=hround x4;
 filldraw stroke z8e--z9e;  % bar
 math←fit(-.3cap←height#*slant-.5u#,.5ic#); fi
penlabels(0,1,1',2,3,4,5,6,7,8,9); endchar;

cmchar "The letter H";
beginchar("H",13u#+width←adj#,cap←height#,0);
italcorr cap←height#*slant-cap←serif←fit#+cap←jut#-2.5u#+min(.5cap←stem#,u#);
adjust←fit(cap←serif←fit#,cap←serif←fit#);
pickup tiny.nib; pos1(cap←stem,0); pos2(cap←stem,0);
pos3(cap←stem,0); pos4(cap←stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5cap←stem); x3=x4=w-x1;
top y1=top y3=h; bot y2=bot y4=0;
filldraw stroke z1e--z2e; % left stem
filldraw stroke z3e--z4e; % right stem
penpos5(cap←bar,90); penpos6(cap←bar,90);
x5=x1; x6=x3; y5=y6=.52h;
fill stroke z5e--z6e;  % bar
if serifs: numeric inner←jut;
 if rt x1r+cap←jut+.5u+1<=lft x3l-cap←jut: inner←jut=cap←jut;
 else: rt x1r+inner←jut+.5u+1=lft x3l-inner←jut; fi
 dish←serif(1,2,a,1/3,cap←jut,b,1/3,inner←jut);  % upper left serif
 dish←serif(2,1,c,1/3,cap←jut,d,1/3,inner←jut); % lower left serif
 dish←serif(3,4,e,1/3,inner←jut,f,1/3,cap←jut);  % upper left serif
 dish←serif(4,3,g,1/3,inner←jut,h,1/3,cap←jut); fi  % lower left serif
math←fit(0,.5ic#); penlabels(1,2,3,4,5,6); endchar;

cmchar "The letter I";
beginchar("I",max(6u#,4u#+cap←stem#),cap←height#,0);
italcorr cap←height#*slant-.25u#;
adjust←fit(cap←serif←fit#,cap←serif←fit#);
pickup tiny.nib; pos1(cap←stem,0); pos2(cap←stem,0);
lft x1l=lft x2l=hround(.5w-.5cap←stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
if serifs: dish←serif(1,2,a,1/3,1.05cap←jut,b,1/3,1.05cap←jut);  % upper serif
 dish←serif(2,1,c,1/3,1.05cap←jut,d,1/3,1.05cap←jut);  fi % lower serif
math←fit(0,.5ic#); penlabels(1,2); endchar;

cmchar "The letter J";
beginchar("J",9u#,cap←height#,0);
italcorr cap←height#*slant-cap←serif←fit#
 +.75cap←jut#-2.5u#+min(.5cap←stem#,u#);
adjust←fit(0,cap←serif←fit#);
pickup tiny.nib; pos1(cap←stem',0); pos2(cap←stem',0);
top y1=h; rt x1r=hround(w-2u); x2=x1; y2=.21h;
if serifs: pos3(vair,-90); pos4(cap←hair,-180);
 pos5(flare+(cap←stem-stem),-180);
 bot y3r=-o; x3=.5[x4,x2]; y5=1/6h; rt x5l=hround 2.75u; z5r=z4r;
 filldraw stroke z1e--z2e&super←arc.e(2,3);  % stem and arc
 dish←serif(1,2,a,1/3,1.3cap←jut,b,1/3,.75cap←jut);  % serif
 bulb(3,4,5);  % bulb
else: filldraw stroke z1e--z2e;  % stem
 pickup fine.nib; pos3(cap←stem',0); z3=z2;
 pos4(flare,angle(6.5u,-h)); pos5(1.1flare,-100);
 bot y4r=-o; x4r=.5[x5r,x3r]; lft x5r=hround.75u; bot y5r=vround.06h-o;
 filldraw stroke z3e{down}....term.e(4,5,left,1,4); fi % arc and terminal
math←fit(0,.5ic#-.5u#); penlabels(1,2,3,4,5); endchar;

cmchar "The letter K";
beginchar("K",13.5u#,cap←height#,0);
italcorr cap←height#*slant-.5u#;
adjust←fit(cap←serif←fit#,cap←serif←fit#);
numeric right←jut,stem[],alpha[];
if serifs: right←jut=.6cap←jut;
else: right←jut=.4tiny; fi
pickup tiny.nib; pos1(fudged.cap←stem,0); pos2(fudged.cap←stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5fudged.cap←stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
stem2=max(tiny.breadth,fudged.cap←stem-3stem←corr);
stem1=max(tiny.breadth,fudged.hair if hefty:-3stem←corr fi);
top y3=h; rt x3r=hround(r-letter←fit-u-right←jut);
bot y6=0; rt x6r=hround(r-letter←fit-.75u-right←jut);
x4=x1; y4=1/3h;
alpha1=diag←ratio(1,.5(stem1-tiny),y3-y4,x3r-x4);
penpos3(alpha1*(stem1-tiny),0); penpos4(whatever,-90);
alpha2=diag←ratio(1,.5(stem2-tiny),y1-y6,x6r-x1);
penpos6(alpha2*(stem2-tiny),0);
forsuffixes $=l,r: y3'$=h; y6'$=0; z4$=z3'$+whatever*(z3-z4);
 z5$=z6'$+whatever*(z1-z6)=whatever[z3,z4]; endfor
z5=.5[z5l,z5r];
z3'r=z3r+penoffset z3-z4 of currentpen+whatever*(z3-z4);
% we have also |z3'l=z3l+penoffset z4-z3 of currentpen+whatever*(z3-z4)|;\]
z6'r=z6r+penoffset z1-z6 of currentpen+whatever*(z1-z6);
z6'l=z6l+penoffset z6-z1 of currentpen+whatever*(z1-z6);
fill z4r--diag←end(4r,3'r,1,.5,3'l,4l)--z4l--cycle;  % upper diagonal
fill z5l--diag←end(5l,6'l,.5,1,6'r,5r)--z5r--cycle;  % lower diagonal
if serifs: numeric inner←jut;
 if rt x2r+cap←jut+.5u+1<=lft x6l-cap←jut: inner←jut=cap←jut;
 else: rt x2r+cap←jut+.5u+1=lft x6l-inner←jut; fi
 dish←serif(1,2,a,1/3,cap←jut,b,1/3,cap←jut); % upper stem serif
 dish←serif(2,1,c,1/3,cap←jut,d,1/3,cap←jut);  % lower stem serif
 dish←serif(3,4,e,2/3,1.2cap←jut,f,1/2,right←jut)(dark); % upper diagonal serif
 dish←serif(6,5,g,1/2,inner←jut,h,1/3,right←jut)(dark);fi % lower diagonal serif
math←fit(0,.5ic#); penlabels(1,2,3,4,5,6); endchar;

cmchar "The letter L";
beginchar("L",11u#-width←adj#,cap←height#,0);
adjust←fit(cap←serif←fit#,0);
pickup tiny.nib; pos1(cap←stem,0); pos2(cap←stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5cap←stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
pickup crisp.nib; pos3(slab,-90); pos4(hair,0);
bot y3r=0; x3=x2; y4=y3l+7/6beak+eps; rt x4r=hround(w-.75u);
arm(3,4,e,1.2beak←darkness,beak←jut);  % lower arm and beak
if serifs: dish←serif(1,2,a,1/3,cap←jut,b,1/3,1.25cap←jut);  % upper serif
 dish←serif(2,1,c,1/3,cap←jut,d,1/3,.5cap←jut); fi  % lower serif
math←fit(0,u#); penlabels(1,2,3,4); endchar;

cmchar "The letter M";
beginchar("M",16u#+width←adj#,cap←height#,0);
italcorr cap←height#*slant-cap←serif←fit#+cap←jut#-2.5u#+min(.5cap←stem#,u#);
adjust←fit(cap←serif←fit#,cap←serif←fit#);
numeric stem[]; % thicknesses of the four strokes
stem1=hround(fudged.hair+stem←corr);
stem2=hround(fudged.cap←stem-4stem←corr);
stem3=hround(fudged.hair-stem←corr);
stem4=hround(fudged.cap←stem-3stem←corr);
if stem4<stem1: stem4:=stem1; fi
pickup tiny.nib; pos1(stem1,0); pos2(stem1,0);
pos3(stem4,0); pos4(stem4,0);
x1=x2; x3=x4; x1l=w-x3r; rt x3r=hround min(w-2u,w-3u+.5stem4);
top y1=top y3=h; bot y2=bot y4=0;
filldraw stroke z1e--z2e; % left stem
filldraw stroke z3e--z4e; % right stem
penpos5(stem2,0); penpos6(stem2,0); penpos7(stem3,0); penpos8(stem3,0);
x5l=x1; x6l=x7l; x8=lft x3l; x6-x5=x8-x7; y5=y8=h; y6=y7;
if hefty: y6=if monospace: vround 1/3h else: o fi;
 numeric upper←notch,lower←notch;
 upper←notch=h-cap←notch←cut; lower←notch=y6+cap←notch←cut;
 x1'=rt x1r; z1'=whatever[z5l,z6l]; x3'=lft x3l; z3'=whatever[z7r,z8r];
 z0=whatever[z5r,z6r]=whatever[z7l,z8l];
 fill z5l..
  if y1'<upper←notch: {right}(x1'+1,upper←notch){down}... fi
  {z6-z5}diag←in(5l,6l,1,6r)..diag←out(7l,1,7r,8r){z8-z7}
  if y3'<upper←notch: ...{up}(x3'-1,upper←notch){right} fi
  ..z8r--diag←out(8r,1,8l,7l){z7-z8}
  if y0<=lower←notch: ..{z7-z8}z0{z5-z6}..
  else: ...{down}(x0+.5,lower←notch)--(x0-.5,lower←notch){up}... fi
  {z5-z6}diag←in(6r,5r,1,5l)--cycle;  % diagonals
else: y6=0; z0=whatever[z5r,z6r]=whatever[z7l,z8l];
 fill z5l..{z6-z5}diag←in(5l,6l,1,6r)..diag←out(7l,1,7r,8r){z8-z7}
  ..z8r--diag←out(8r,1,8l,7l){z7-z8}..{z7-z8}z0{z5-z6}
  ..{z5-z6}diag←in(6r,5r,1,5l)--cycle; fi  % diagonals
if serifs: serif(1,2,a,1/3,-cap←jut);  % upper left serif
 dish←serif(2,1,b,1/2,cap←jut,c,1/2,cap←jut)(dark); % lower left serif
 serif(3,4,d,1/3,cap←jut); %  upper right serif
 dish←serif(4,3,e,1/3,cap←jut,f,1/3,cap←jut); fi  % lower right serif
math←fit(0,max(.5ic#-.5u#,0));
penlabels(0,1,1',2,3,3',4,5,6,7,8); endchar;

cmchar "The letter N";
beginchar("N",13u#+width←adj#,cap←height#,0);
italcorr cap←height#*slant-cap←serif←fit#+cap←jut#-2.5u#+min(.5cap←stem#,u#);
adjust←fit(cap←serif←fit#,cap←serif←fit#);
numeric thin←stem; thin←stem=hround(fudged.hair+stem←corr);
pickup tiny.nib; pos1(thin←stem,0); pos2(thin←stem,0);
pos3(thin←stem,0); pos4(thin←stem,0);
pickup tiny.nib; top y1=top y3=h; bot y2=bot y4=0;
x1=x2; x3=x4; x1l=w-x3r;
rt x3r=hround min(w-2u,w-3u+.5fudged.cap←stem);
filldraw stroke z1e--z2e; % left stem
filldraw stroke z3e--z4e; % right stem
if hefty: penpos5(fudged.cap←stem,0); penpos6(fudged.cap←stem,0);
 x5l=x1; x6r=x4; y5=h; y6=0;
 numeric upper←notch,lower←notch;
 upper←notch=h-cap←notch←cut; lower←notch=cap←notch←cut;
 x1'=rt x1r; z1'=whatever[z5l,z6l]; x4'=lft x4l; z4'=whatever[z5r,z6r];
 fill z5l..
  if y1'<upper←notch: {right}(x1'+1,upper←notch){down}... fi
  {z6-z5}diag←in(5l,6l,1,6r)--z6r..
  if y4'>lower←notch: {left}(x4'-1,lower←notch){up}... fi
  {z5-z6}diag←in(6r,5r,1,5l)--cycle;  % diagonal
else: penpos5(whatever,0); penpos6(whatever,90);
 z5l=z1l; z6l=z4l;
 z7=z6l+(max(eps,cap←stem-3stem←corr-tiny),0) rotated (angle(z5l-z6l)-90);
 z5r=z7+whatever*(z5l-z6l); z6r=z7+whatever*(z5l-z6l);
 filldraw stroke z5e..z6e; fi  % diagonal
if serifs: if hefty: serif(1,2,a,1/3,-cap←jut); % upper left serif
 else: serif(5,6,a,1/3,-cap←jut); fi  % upper left serif
 dish←serif(2,1,b,1/2,cap←jut,c,1/2,cap←jut)(dark); % lower left serif
 dish←serif(3,4,e,1/2,cap←jut,f,1/2,cap←jut)(dark); fi  % upper right serif
math←fit(0,max(.5ic#-.5u#,0)); penlabels(1,1',2,3,4,4',5,6,7); endchar;

cmchar "The letter O";
beginchar("O",14u#-width←adj#,cap←height#,0);
italcorr .7cap←height#*slant-.5u#;
adjust←fit(0,0);
penpos1(vair',90); penpos3(vround(vair+1.5vair←corr),-90);
penpos2(cap←curve,180); penpos4(cap←curve,0);
if monospace: x2r=hround 1.5u;
 interim superness:=sqrt superness;  % make |"O"|, not |"0"|
else: x2r=hround u; fi
x4r=w-x2r; x1=x3=.5w; y1r=h+o; y3r=-o;
y2=y4=.5h-vair←corr; y2l:=y4l:=.52h;
penstroke pulled←super←arc.e(1,2)(.5superpull)
 & pulled←super←arc.e(2,3)(.5superpull)
 & pulled←super←arc.e(3,4)(.5superpull)
 & pulled←super←arc.e(4,1)(.5superpull) & cycle;  % bowl
math←fit(-.3cap←height#*slant-.5u#,ic#-.5u#); penlabels(1,2,3,4); endchar;

cmchar "The letter P";
beginchar("P",12u#,cap←height#,0);
italcorr .75cap←height#*slant-.5u#;
adjust←fit(cap←serif←fit#,0);
pickup tiny.nib; penpos1(cap←stem'-tiny,0); penpos2(cap←stem-tiny,0);
pos0(cap←stem',0); pos0'(cap←stem,0);
lft x1l=hround max(2u,3u-.5cap←stem'); top y1=h; bot y2=0;
x1l=x2l=x0l=x0'l; y0=y0'=y7;
penpos3(cap←band,90); penpos4(cap←band,90);
penpos5(cap←curve if hefty:-3stem←corr fi,0);
penpos6(.5[vair,cap←band],-90); penpos7(.5[vair,cap←band],-90);
z3r=top z1; y4=y3; y5=.5[y4l,y6l]; y6=y7;
x7=x2; y7l=vround .5h; x4=x6=.5w+.75u; x5r=hround(w-u);
x4l:=x6l:=x4-.25cap←curve;
filldraw stroke z1e--z0e--z0'e--z2e; % stem
fill stroke z3e..pulled←arc.e(4,5) & pulled←arc.e(5,6)..z7e;  % lobe
if serifs: dish←serif(1,0,a,1/3,cap←jut,b,1/3,.5cap←jut);  % upper serif
 dish←serif(2,0',c,1/3,cap←jut,d,1/3,cap←jut); fi  % lower serif
math←fit(0,ic#-2.5u#); penlabels(0,1,2,3,4,5,6,7); endchar;

cmchar "The letter Q";
beginchar("Q",14u#-width←adj#,cap←height#,comma←depth#);
italcorr .7cap←height#*slant-.5u#;
adjust←fit(0,0);
numeric light←curve; light←curve=cap←curve-hround stem←corr;
penpos1(vair',90); penpos3(vair',-90);
penpos2(light←curve,180); penpos4(light←curve,0);
if monospace: x2r=hround 1.5u;
 interim superness:=sqrt superness;  % make |"Q"| like |"O"|
else: x2r=hround u; fi
x4r=w-x2r; x1=x3=.5w; y1r=h+o; y2=y4=.5h-vair←corr; y3r=-o;
penstroke pulled←super←arc.e(1,2)(.5superpull)
 & pulled←super←arc.e(2,3)(.5superpull)
 & pulled←super←arc.e(3,4)(.5superpull)
 & pulled←super←arc.e(4,1)(.5superpull) & cycle;  % bowl
pickup tiny.nib;
if hefty: penpos5(1.2(.5[cap←bar,light←curve]),0); penpos6(1.2light←curve,0);
 x5=.5w; x6r=hround(w-1.5u);
 y5=vround .28h; y6=-d;
 fill diag←end(6r,5r,.25,1,5l,6l)--diag←end(5l,6l,.5,1,6r,5r)--cycle;  % tail
else: pos3'(vair,270); pos5(vair,180); pos6(vair,90);
 pos7(cap←curve,85); penpos8(eps,180);
 z3'=z3; x6=x3; top y6r=vround(.2h+.5vair);
 lft x5r=hround(.5w-1.25u-.5vair); y5=.5[y3,y6];
 bot y7l=-d; x7l=2/3[x6,x8]; y8=0; rt x8=hround(x4r+.1u);
 filldraw stroke z3'e{left}...z5e{up}...z6e{right}
  ..z7e{right}...z8e{up}; fi % tail
math←fit(-.3cap←height#*slant-.5u#,ic#); penlabels(1,2,3,4,5,6,7); endchar;

cmchar "The letter R";
beginchar("R",if serifs: 12u#+.5max(2u#,cap←curve#)
 else:12.5u#-.5width←adj# fi,cap←height#,0);
italcorr .75cap←height#*slant- if serifs: 1.75 else: .5 fi\\ u#;
adjust←fit(cap←serif←fit#,0);
pickup tiny.nib; pos1(cap←stem',0); pos2(cap←stem',0);
lft x1l=lft x2l=hround max(2u,3u-.5cap←stem'); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
penpos3(cap←band,90); penpos4(cap←band,90);
penpos5(cap←curve if hefty:-3stem←corr fi,0);
penpos6(vair,-90); penpos7(vair,-90);
z3r=top z1; y4=y3; y5=.5[y4l,y6l]; y6=y7;
x7=x2; y7l=vround(.5h+.5vair); x4=x6;
if serifs: x4=.5w-.5u; x5r=hround(w-2.25u);
else: x4=.5w+.5u; x5r=hround(w-u); fi
x4l:=x6l:=x4-.125cap←curve;
fill stroke z3e..pulled←arc.e(4,5) & pulled←arc.e(5,6)..z7e;  % lobe
if serifs: pos6'(vair,-90); pos0(cap←stem,180);
 pos8(cap←curve,180); pos9(vair,-90); pos10(hair,0);
 z6'=z6; lft x0r=lft x8r=hround(x5-2/3u-.5cap←curve);
 y8=1/3[y2,y7]; y0=3/5[y2,y7]; x9=.5[x8l,x10r];
 bot y9r=-o; rt x10r=hround(w-.05u); y10=1/4[y2,y7];
 filldraw stroke z6'e{right}..z0e---z8e....z9e{right}..z10e{up};  % tail
 dish←serif(1,2,a,1/3,cap←jut,b,1/3,.5cap←jut);  % upper serif
 dish←serif(2,1,c,1/3,cap←jut,d,1/3,cap←jut);  % lower serif
else: penpos8(cap←stem-2stem←corr,0); penpos9(cap←stem,0);
 x8=x6+.5u; y8=y6; x9r=hround(w-.5u); y9=0;
 fill z8l--diag←end(8l,9l,.5,1,9r,8r)--z8r--cycle; fi  % tail
math←fit(0,.75ic#); penlabels(0,1,2,3,4,5,6,7,8,9,10); endchar;

cmchar "The letter S";
beginchar("S",10u#,cap←height#,0);
italcorr cap←height#*slant-u#;
adjust←fit(0,0);
numeric theta; theta=90-angle(50u,h); slope:=-h/50u;  % angle at middle
numeric s←slab; s←slab=if serifs:slab else:vround .2[slab,cap←stem] fi;
numeric ess'; ess'=max(fine.breadth,cap←ess);
pickup fine.nib; pos2(max(fine.breadth,s←slab-vround vair←corr),-90);
pos0(ess',theta); pos7(s←slab,-90);
x2+x7=2x0=w; x7-x2=if serifs: u else: 0 fi; top y2l=h+o; bot y7r=-o;
y0=.52h; lft x3l=hround u; rt x6r=hround(w-u);
x3r-x3l=x6r-x6l=hround .5[s←slab,ess']-fine;
ellipse←set(2l,3l,4l,0l); ellipse←set(2r,3r,4r,0r); y3=y3r;
ellipse←set(7l,6l,5l,0l); ellipse←set(7r,6r,5r,0r); y6=y6r;
filldraw stroke super←arc.e(2,3) & z3e{down}
 ..z4e---z5e..z6e{down} & super←arc.e(6,7);  % main stroke
if serifs: pos1(hair,180); pos8(hair,180);
 rt x1l=hround(w-1.5u); lft x8r=hround u;
 bot y1=vround 2/3h+1; top y8=vround 1/3h-1;
 filldraw stroke z1e{x2-x1,10(y2-y1)}....{left}z2e;  % upper arc
 filldraw stroke z7e{left}....{up}z8e;  % lower arc
 path upper←arc, lower←arc;
 upper←arc=z1{x2-x1,10(y2-y1)}....{left}z2;
 lower←arc=z7{left}....{up}z8;
 x10=x1l; top y10=top y2l; x9=x8r; bot y9=bot y7r;
 x1l-x1'=x8'-x8r=1.6cap←curve-fine; y1'=y1; y8'=y8;
 numeric t; t=xpart(upper←arc intersectiontimes(z10--z1'));
 filldraw z1l--z10--subpath(t,0) of upper←arc--cycle;  % upper barb
 t:=xpart(lower←arc intersectiontimes(z9--z8'));
 filldraw z8r--z9--subpath(t,1) of lower←arc--cycle;  % lower barb
else: pos1(1.2flare,-100); pos8(1.2flare,-100);
 x1l=good.x(x1l+w-1.75u-rt x1); lft x8r=hround .8u;
 top y1l=vround .93h+o; bot y8r=vround .1h-o;
 filldraw stroke term.e(2,1,right,.9,4);  % upper arc and terminal
 filldraw stroke term.e(7,8,left,1,4); fi  % lower arc and terminal
math←fit(0,.5ic#); penlabels(0,1,1',2,3,4,5,6,7,8,8',9,10); endchar;

cmchar "The letter T";
beginchar("T",13u#-width←adj#,cap←height#,0);
italcorr cap←height#*slant-beak←jut#-.25u#;
adjust←fit(0,0);
h:=vround(h-2stem←corr);
pickup tiny.nib; pos1(cap←stem,0); pos2(cap←stem,0);
lft x1l=lft x2l=hround(.5w-.5cap←stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
pickup crisp.nib; pos3(slab,90); pos4(hair,0);
top y3r=h; x3=x1; rt x4r=hround(w-.65u); y4=good.y(y3l-beak)-eps;
arm(3,4,e,beak←darkness,.7beak←jut);  % right arm and beak
pos5(hair,180); x5=w-x4; y5=y4;
arm(3,5,f,beak←darkness,-.7beak←jut);  % left arm and beak
if serifs: dish←serif(1,2,a,1/3,.5cap←jut,b,1/3,.5cap←jut);  % upper bracketing
 dish←serif(2,1,c,1/3,1.414cap←jut,d,1/3,1.414cap←jut); fi  % lower serif
math←fit(-.75cap←height#*slant,ic#-2.5u#); penlabels(1,2,3,4,5,6); endchar;

cmchar "The letter U";
beginchar("U",13u#+.5width←adj#,cap←height#,0);
italcorr cap←height#*slant-cap←serif←fit#+cap←jut#-2.5u#+min(.5cap←stem#,u#);
if monospace: adjust←fit(cap←serif←fit#-.5u#,cap←serif←fit#-.5u#)
else: adjust←fit(cap←serif←fit#,cap←serif←fit#) fi;
pickup tiny.nib; pos1(cap←stem,0); pos2(cap←stem,0);
pos2'(cap←stem,180); z2'=z2;
pos3(cap←band,-90);
pos4(cap←hair,0); pos5(cap←hair,0);
x1=x2; x3=.5[x1,x5]; x4=x5; x1l=w-x5r;
top y1=top y5=h; y2=y4=1/3h; bot y3r=-o;
lft x1l=hround max(2u,3u-.5cap←stem);
filldraw stroke z1e--z2e; % left stem
filldraw stroke pulled←arc.e(2',3)
 & pulled←arc.e(3,4)&z4e--z5e; % arc and right stem
if serifs: dish←serif(1,2,a,1/3,cap←jut,b,1/3,cap←jut); % left serif
 dish←serif(5,4,c,1/2,cap←jut,d,1/2,cap←jut)(dark); fi  % right serif
math←fit(-cap←serif←fit#-.3cap←height#*slant-min(cap←height#*slant,u#),
 max(.5ic#-.5u#,0)); penlabels(1,2,3,4,5); endchar;

cmchar "The letter V";
beginchar("V",13u#,cap←height#,0);
italcorr cap←height#*slant+.25u#;
adjust←fit(cap←serif←fit#,cap←serif←fit#);
numeric left←stem,right←stem,outer←jut,alpha;
left←stem=cap←stem-stem←corr;
right←stem=min(cap←hair if hefty:-2stem←corr fi,left←stem);
outer←jut=.75cap←jut; x1l=w-x4r=l+letter←fit+outer←jut+.25u; y1=y4=h;
x2-x1=x4-x3; x2l+apex←corr=x3l; y2=y3=-apex←o;
alpha=diag←ratio(2,right←stem,y1-y2,x4r-x1l-apex←corr);
penpos1(alpha*left←stem,0); penpos2(alpha*left←stem,0);
penpos3(alpha*right←stem,0); penpos4(alpha*right←stem,0);
z0=whatever[z1r,z2r]=whatever[z3l,z4l];
if y0>cap←notch←cut: y0:=cap←notch←cut;
  fill z0+.5right{up}...{z4-z3}diag←end(3l,4l,1,1,4r,3r)
    --diag←end(4r,3r,1,1,2l,1l)--diag←end(2l,1l,1,1,1r,2r){z2-z1}
    ...{down}z0+.5left--cycle; % left and right diagonals
else: fill z0--diag←end(0,4l,1,1,4r,3r)--diag←end(4r,3r,1,1,2l,1l)
    --diag←end(2l,1l,1,1,1r,0)--cycle; fi % left and right diagonals
if serifs: numeric inner←jut; pickup tiny.nib;
 prime←points←inside(1,2); prime←points←inside(4,3);
 if rt x1'r+cap←jut+.5u+1<=lft x4'l-cap←jut: inner←jut=cap←jut;
 else: rt x1'r+inner←jut+.5u+1=lft x4'l-inner←jut; fi
 dish←serif(1',2,a,1/3,outer←jut,b,1/2,inner←jut);  % left serif
 dish←serif(4',3,c,.6,inner←jut,d,1/2,outer←jut)(dark); fi  % right serif
math←fit(.75u#-cap←height#*slant,ic#-4u#); penlabels(0,1,2,3,4); endchar;

cmchar "The letter W";
beginchar("W",18u#,cap←height#,0);
italcorr cap←height#*slant+.25u#;
adjust←fit(cap←serif←fit#,cap←serif←fit#);
numeric stem[],outer←jut,upper←notch,alpha,mid←corr;
outer←jut=.7cap←jut; x1l=w-x8r=l+letter←fit+outer←jut+.25u;
stem1=fudged.cap←stem-stem←corr;
stem4=min(fudged.hair if hefty:-2stem←corr fi,stem1);
stem2=stem4 if hefty:-2stem←corr fi;
stem3=stem1 if hefty:-2stem←corr fi;
x2-x1=x4-x3=x6-x5=x8-x7; x2l+apex←corr=x3l; x6l+apex←corr=x7l;
y1=y8=h; y2=y3=y6=y7=-apex←o; y4=y5=if monospace: vround .6 fi\\ h;
mid←corr=if monospace or hefty:-apex←corr else: 1/3jut fi;
alpha=diag←ratio(4,stem2-stem3+stem4,y1-y2,x8r-x1l+mid←corr-2apex←corr);
penpos1(alpha*stem1,0); penpos2(alpha*stem1,0);
penpos3(alpha*stem2,0); penpos4(alpha*stem2,0);
penpos5(alpha*stem3,0); penpos6(alpha*stem3,0);
penpos7(alpha*stem4,0); penpos8(alpha*stem4,0);
x4l-x1l=floor(x4l-x1l+.5(x5r+mid←corr-x4r)); % |x5r+mid←corr| $\approx$ |x4r|
z23=whatever[z1r,z2r]=whatever[z3l,z4l];
z45=whatever[z3r,z4r]=whatever[z5l,z6l];
z67=whatever[z5r,z6r]=whatever[z7l,z8l]; upper←notch=y4-cap←notch←cut;
fill diag←end(1l,2l,1,1,3r,4r){z4-z3}
 ...if y45<upper←notch:(x45,upper←notch)+.5left{up}
   --(x45,upper←notch)+.5right{down} else: z45&z45 fi
 ...{z6-z5}diag←end(5l,6l,1,1,7r,8r)--diag←end(7r,8r,1,1,8l,7l){z7-z8}
 ...if y67>cap←notch←cut:(x67,cap←notch←cut)+.5right{down}
   --(x67,cap←notch←cut)+.5left{up} else: z67&z67 fi
 ...{z5-z6}special←diag←end(6,5,4,3){z3-z4}
 ...if y23>cap←notch←cut:(x23,cap←notch←cut)+.5right{down}
   --(x23,cap←notch←cut)+.5left{up} else: z23&z23 fi
 ...{z1-z2}diag←end(2r,1r,1,1,1l,2l)--cycle;  % diagonals
if serifs: numeric inner←jut[]; pickup tiny.nib;
 prime←points←inside(1,2); prime←points←inside(5,6); prime←points←inside(8,7);
 if monospace: inner←jut1=inner←jut4=1.5cap←jut;
 elseif hefty: inner←jut1=inner←jut4=cap←jut;
 else: fill diag←end(6r,5r,1,1,5l,6l)
  --.5[z5l,z6l]--.5[z5r,z6r]--cycle; % middle stem
  inner←jut2=.7inner←jut1; inner←jut4=1.1inner←jut3;
  if rt x1'r+cap←jut+.5u+1<=lft x5'l-.7cap←jut: inner←jut1=cap←jut;
  else: rt x1'r+inner←jut1+.5u+1=lft x5'l-inner←jut2; fi
  if rt x5'r+cap←jut+.5u+1<=lft x8'l-1.1cap←jut: inner←jut3=cap←jut;
  else: rt x5'r+inner←jut3+.5u+1=lft x8'l-inner←jut4; fi
  dish←serif(5',6,e,1/3,inner←jut2,f,1/2,inner←jut3); fi  % middle serif
 dish←serif(1',2,a,1/3,outer←jut,b,1/2,inner←jut1);  % left serif
 dish←serif(8',7,c,.6,inner←jut4,d,1/2,outer←jut)(dark); fi  % right serif
math←fit(.75u#-cap←height#*slant,ic#-2.5u#);
penlabels(0,1,2,3,4,5,6,7,8,23,45,67); endchar;

cmchar "The letter X";
beginchar("X",13u#,cap←height#,0);
italcorr cap←height#*slant-.25u#;
adjust←fit(cap←serif←fit#,cap←serif←fit#);
numeric stem[],outer←jut,xjut,alpha[];
stem1=cap←stem-2stem←corr; stem2=min(cap←hair,stem1);
outer←jut=.75cap←jut; xjut= if serifs: (stem1-stem2)/4 else: 0 fi;
x1l=l+letter←fit+.5u+outer←jut; x2r=r-letter←fit-u-outer←jut-xjut;
x3l=l+letter←fit+.25u+outer←jut+xjut; x4r=r-letter←fit-.25u-outer←jut;
y1=y2=h; y3=y4=0;
alpha1=diag←ratio(1,stem1,h,x4r-x1l);
alpha2=diag←ratio(1,stem2,h,x2r-x3l);
penpos1(alpha1*stem1,0); penpos2(alpha2*stem2,0);
penpos3(alpha2*stem2,0); penpos4(alpha1*stem1,0);
if hefty: z0=whatever[z1,z4]=whatever[z2,z3];
 x12=x34=x0; y13=y24=y0;
 z12=whatever[z2l,z3l]; z13=whatever[z2l,z3l];
 z24=whatever[z2r,z3r]; z34=whatever[z2r,z3r];
 forsuffixes $=13,24,34: z$'=.1[z$,z0]; endfor
 fill diag←end(12,1r,.5,1,1l,13')--z13'--diag←end(13',3l,1,.5,3r,34')--z34'
  --diag←end(34',4l,.5,1,4r,24')--z24'
  --diag←end(24',2r,1,.5,2l,12)--z12--cycle; % diagonals
else: fill diag←end(4r,1r,.5,1,1l,4l)
  --diag←end(1l,4l,.5,1,4r,1r)--cycle; % left diagonal
 fill diag←end(2l,3l,.5,1,3r,2r)
  --diag←end(3r,2r,.5,1,2l,3l)--cycle; fi  % right diagonal
if serifs: numeric inner←jut[]; pickup tiny.nib;
 prime←points←inside(1,4); prime←points←inside(2,3);
 prime←points←inside(3,2); prime←points←inside(4,1);
 if rt x1'r+cap←jut+.5u+1<=lft x2'l-cap←jut-xjut: inner←jut1=cap←jut;
 else: rt x1'r+inner←jut1+.5u+1=lft x2'l-inner←jut1-xjut; fi
 if rt x3'r+cap←jut+.5u+1<=lft x4'l-cap←jut-xjut: inner←jut2=cap←jut;
 else: rt x3'r+inner←jut2+.5u+1=lft x4'l-inner←jut2-xjut; fi
 dish←serif(1',4,a,1/3,outer←jut,b,2/3,inner←jut1);  % upper left serif
 dish←serif(4',1,c,2/3,inner←jut2,d,1/3,outer←jut);  % lower right serif
 dish←serif(2',3,e,2/3,inner←jut1+xjut,
  f,1/2,outer←jut+xjut)(dark);  % upper right serif
 dish←serif(3',2,g,1/2,outer←jut+xjut,
  h,2/3,inner←jut2+xjut)(dark); fi  % lower left serif
math←fit(0,.5ic#); penlabels(0,1,2,3,4,12,13,24,34); endchar;

cmchar "The letter Y";
beginchar("Y",13u#,cap←height#,0);
italcorr cap←height#*slant+.45u#;
adjust←fit(cap←serif←fit#,cap←serif←fit#);
numeric left←stem,right←stem,outer←jut,dy,alpha;
left←stem=cap←stem-stem←corr;
right←stem=min(cap←hair if hefty:-2stem←corr fi,left←stem);
outer←jut=.75cap←jut; x1l=w-x4r=l+letter←fit+outer←jut+.05u;
x2l=x5l=hround(.5w-.5left←stem); x3r=x5r; y1=y4=h; y2=y3=y5=.4h;
dy=y1-y2; alpha=((x2l-x1l)++dy)/dy;
penpos1(alpha*left←stem,0); penpos2(alpha*left←stem,0);
penpos3(alpha*right←stem,0); penpos4(alpha*right←stem,0);
penpos5(left←stem,0); penpos6(left←stem,0); x5=x6; y6=0;
z0=whatever[z1r,z2r]=whatever[z3l,z4l];
if y0>y2+cap←notch←cut: y0:=y2+cap←notch←cut;
  fill z0+.5right{up}...{z4-z3}diag←end(3l,4l,1,1,4r,3r)--z5r
    --diag←end(5r,6r,1,1,6l,5l)--z5l--diag←end(2l,1l,1,1,1r,2r){z2-z1}
    ...{down}z0+.5left--cycle; % diagonals and stem
else: fill z0--diag←end(0,4l,1,1,4r,3r)--z5r
    --diag←end(5r,6r,1,1,6l,5l)--z5l
    --diag←end(2l,1l,1,1,1r,0)--cycle; fi  % diagonals and stem
if serifs: numeric inner←jut; pickup tiny.nib;
 prime←points←inside(1,2); prime←points←inside(4,3); prime←points←inside(6,5);
 if rt x1'r+cap←jut+.5u+1<=lft x4'l-cap←jut: inner←jut=cap←jut;
 else: rt x1'r+inner←jut+.5u+1=lft x4'l-inner←jut; fi
 dish←serif(1',2,a,1/3,outer←jut,b,1/2,inner←jut);  % upper left serif
 dish←serif(4',3,c,.6,inner←jut,d,1/2,outer←jut)(dark);  % upper right serif
 dish←serif(6',5,e,1/3,cap←jut,f,1/3,cap←jut); fi  % lower serif
math←fit(.5u#-cap←height#*slant,ic#-4u#);
penlabels(0,1,2,3,4,5,6); endchar;

cmchar "The letter Z";
beginchar("Z",11u#,cap←height#,0);
italcorr cap←height#*slant-.5u#;
adjust←fit(0,0);
numeric arm←thickness[],z←stem;
if hefty: arm←thickness1=Vround(slab-vair←corr); arm←thickness2=slab;
 z←stem=.8[vair,cap←stem];
else: arm←thickness1=slab; arm←thickness2=vround(slab+vair←corr);
 z←stem=.9[vair,cap←stem]; fi
pickup tiny.nib; x3l=x4l=w-x1r=w-x2r; lft x3l=hround u;
top y1=h; y2=min(y1,h-2/3arm←thickness1);
bot y4=0; y3=max(y4,2/3arm←thickness2);
numeric alpha; alpha=diag←ratio(1,z←stem-tiny,y2-y3,x2r-x3l);
penpos1(alpha*(z←stem-tiny),0); penpos2(alpha*(z←stem-tiny),0);
penpos3(alpha*(z←stem-tiny),0); penpos4(alpha*(z←stem-tiny),0);
pair delta; delta=penoffset z3-z2 of currentpen;
fill top lft z1l--z2l+delta---z3l+delta..lft z3l---lft z4l..bot z4l
 ---bot rt z4r--z3r-delta---z2r-delta..rt z2r---rt z1r..top z1r
 ---cycle;  % diagonal
pickup crisp.nib; pos5(arm←thickness1,90); pos6(hair,180);
top y5r=h; x5=x1; lft x6r=hround 1.25u; y6=good.y(y5l-beak)-eps;
arm(5,6,a,beak←darkness**.8,-.4beak←jut);  % upper arm and beak
pos7(arm←thickness2,-90); pos8(hair,0);
bot y7r=0; x7=x4; rt x8r=hround(w-.9u); y8=good.y(y7l+1.2beak)+eps;
arm(7,8,b,beak←darkness**.9,.6beak←jut);  % lower arm and beak
math←fit(0,.5ic#); penlabels(1,2,3,4,5,6,7,8); endchar;