% Computer Modern Blackboard lower case:
% Was romanl.mf; modified for blackboard letter
% Gilles F. ROBERT (29-03-93) v1.0

% 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.
% modified March 93 by Gilles F. ROBERT for blackboard letters

% Character codes \0141 through \0172 are generated.

cmchar "The letter a";
beginchar("a",9u#,x_height#,0);
bh#:=min(bar_height#,1.14x_height#-bar_height#); define_pixels(bh);
italcorr 1/3[bh#,x_height#]*slant+.5stem#-serif_fit#-2u#;
adjust_fit(0,serif_fit# if serifs: if hair#+.5stem#>1.5u#:-.25u# fi\\fi);
pickup fine.nib; top y3r=h+vround 1.5oo;
if serifs: pos1(flare,180); pos2(hair,180);
 pos3(vair,90);  lft x1r=hround max(u,2.1u-.5flare); x3=.5w-.5u;
 y1=min(bh+.5flare+2vair+2,.9[bh,h]-.5flare);
 bulb(3,2,1);  % bulb
else: pos1(5/7[vair,flare],95); x1l=good.x 1.5u; x1r:=good.x x1r;
 pos3(1/8[vair,thin_join],90);
 x3=.5w-.2u; top y1r=vround .82[bh,top y3r];
 filldraw stroke term.e(3,1,left,.9,4); fi  % terminal
pos4(stem,0); rt x4r=hround(w-2.5u+.5stem); y4=1/3[bh,h];
pos5(stem,0); x5=x4; y5=max(.55bh,2vair);
filldraw stroke super_arc.e(3,4)&z4e..z5e;  % arc and stem
pen_duplicate(7);
pos6(.3[thin_join,vair],90); x6=x4; bot y6=bh;
pos7(hround(.5curve-stem_corr),180);
lft x.G7r=hround max(.5u,1.5u-.5curve); y7=1/3[top y8l,top y6r];
pos8(vair,270); x8l=.5w-.75u; bot y8r=-oo;
pos9(thin_join,360); z9l=z5l;
(x,y8r)=whatever[z8l,z9l]; x8r:=max(x,x8-u);
{{interim superness:=more_super;
 filldraw stroke z9e{down}...z8e{left}...{up}z.G7e&super_arc.e(G7,6)}}; % bowl
Delta_x = min(hround(curve_interspace+.5curve-stem_corr),.5(x9r-x.G7l));
define_upper_and_lower(D6,D8,D7,{{interim superness:=more_super;
 z9r{down}...z8r{left}...{up}z.G7r&super_arc.r(G7,6)}});
filldraw stroke z.D6e--z.D8e; % inner stroke
if serifs: numeric shaved_stem; shaved_stem=hround(stem-3stem_corr);
 if hair#+.5stem#>1.5u#: pickup tiny.nib;
  pos5'(shaved_stem,0); rt x5'r=fine.rt x5r; y5'=y5;
  pos10(shaved_stem,0); x10=x5'; y10=.2[.5tiny,bh];
  pos11(shaved_stem,0); rt x11r=hround(w-.25u); bot y11=0;
  pos12(shaved_stem,0); x11=x12; top y12=slab+eps;
  filldraw z5'l---z10l...z11l{right}--z11r
   --z12r{left}...z10r+.75(z12-z11)---z5'r--cycle;  % foot
 else: pickup crisp.nib; pos5'(shaved_stem,0); rt x5'r=fine.rt x5r; y5'=y5;
  pos10(shaved_stem,0); x10=x5'; y10=1/3bh;
  pos11(.2[vair,stem],90); x11r=.5[x10r,x12r]; bot y11l=-vround .5oo;
  pos12(hair,180); rt x12l=hround(w-.1u); y12=max(y10,y11+vair);
  pos13(hair,180); x13=x12; top y13=max(vround .6bh,top y12);
  (x',y11l)=whatever[z11r,z12r]; x11l:=max(x',x10);
  filldraw stroke z5'e---z10e...z11e{right}...z12e---z13e; fi  % hook
else: numeric shaved_stem; shaved_stem=hround(stem-stem_corr);
 pickup tiny.nib; pos5'(shaved_stem,0); rt x5'r=fine.rt x5r; y5'=y5;
 pos10(shaved_stem,0); x10=x5'; bot y10=0;
 filldraw stroke z5'e--z10e; fi  % base of stem
penlabels(1,2,3,4,5,6,G7,8,D6,D7,D8,9,10,11,12,13); endchar;

cmchar "The letter b";
beginchar("b",10u#+serif_fit#,asc_height#,0);
italcorr .5x_height#*slant+min(.5curve#-u#,-.25u#);
adjust_fit(serif_fit#,0);
pen_duplicate(0,0',1,2);
pickup tiny.nib; pos1(.5stem',0); pos2(.5stem,0);
pos0'(.5stem',0); pos0(.5stem,0); z0l=z0'l; x0'=x1; x0=x2;
lft x.G1l=hround(2.5u-.5stem'); top y1=h;
Delta_x = hround(interspace+.5stem);
numeric edge; edge=rt x.D2r;
pickup fine.nib; pos3(if hefty:thin_join else: hair fi,180);
pos4(vair,90); pos5(curve,0); pos6(vair,-90); penpos7(x3l-x3r,-180);
rt x3l=max(rt x3l-(lft x3r-tiny.lft x.D2l),1/3[rt x.D2,edge]);
y3=1/8[bar_height,x_height];
x4l=w-.5(w-serif_fit-interspace)+.5u; top y4r=x_height+oo;
rt x5r=hround min(w-1.35u+.5curve,w-.6u); y5=.5x_height;
x6l=x4l-.2u; bot y6r=-oo;
x7=x3; y7=min(y3,y6+y4-y3+.6vair);
(x,y4r)=whatever[z3l,z4l]; x4r:=min(x,.5[x4,x5r]);
(x',y6r)=whatever[z7l,z6l]; x6r:=min(x',.5[x6,x5r]);
filldraw stroke z3e{up}...pulled_arc.e(4,5)&pulled_arc.e(5,6)...{up}z7e; % bowl
y0=ypart(((edge,h)--(edge,0))intersectionpoint(z3l{up}...{right}z4l));
y2=ypart(((edge,h)--(edge,0))intersectionpoint(z6l{left}...{up}z7l));
pickup tiny.nib; double filldraw stroke z1e--z0'e--z0e--z2e;  % double stem
pickup crisp.nib; pos8(hair,0); pos7'(stem+interspace,0);
z7'=z2; x8l=x7'l; bot y8=0;
filldraw stroke z7'e--z8e;  % point
if serifs: sloped_biserif.l(1,0',a,1/3,jut,serif_drop,a',1/3); % upper serif
 mid_biserif(2,0',b,1/3); % lower serif
else: mid_biserif(1,0',a,1/3); fi % upper terminal
penlabels(G0,D0,G1,D1,G2,D2,3,4,5,6,7,8); endchar;

cmchar "The letter c";
beginchar("c",8u#,x_height#,0);
italcorr x_height#*slant-.2u#;
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
pen_duplicate(3);
pickup fine.nib; pos2(vair',90); pos4(vair',270);
x2=x4=.5(w+u); top y2r=vround(h+1.5oo); bot y4r=-oo;
pos3(.5curve,180); lft x.G3r=hround max(.6u,1.35u-.5curve); y3=.5h;
Delta_x = min(hround(curve_interspace+.5curve),x2r-x.G3l);
if serifs: pos1(hair,0); pos0(flare,0);
 y1=min(bar_height+.5flare+2vair'+2,.9[bar_height,h]-.5flare);
 rt x1r=hround(w-.7u); bulb(2,1,0);  % bulb
 pos5(hair,0); rt x5r=hround(w-.5u);
 y5=max(good.y(.5bar_height-.9),y4l+vair');
 (x,y4l)=whatever[z4r,z5l]; x4l:=min(x,x4l+.5u);
 filldraw stroke pulled_super_arc.e(2,G3)(.7superpull)
  & pulled_super_arc.e(G3,4)(.5superpull)
  ..tension .9 and 1..{x5-x4,5(y5-y4)}z5e;  % arc and lower terminal
else: pos1(4/7[vair',flare],80);
 rt x1r=hround(w-.6u); top y1r=vround .82[bar_height,top y2r];
 filldraw stroke term.e(2,1,right,.8,4);  % upper terminal
 pos5(.6[vair',flare],275); rt x5r=hround(w-.5u);
 y5r=good.y(y5r+1/3bar_height-y5); y5l:=good.y y5l; x5l:=good.x x5l;
 forsuffixes e=l,r: path p.e; p.e=z4e{right}..tension .9 and 1..z5e;
  if angle direction 1 of p.e>75:
   p.e:=z4e{right}..tension atleast.9 and 1..{dir 75}z5e; fi endfor
 filldraw stroke pulled_super_arc.e(2,G3)(.7superpull)
  & pulled_super_arc.e(G3,4)(.5superpull) & p.e; fi  % arc and lower terminal
define_upper_and_lower(D2,D4,D3,
 pulled_super_arc.r(2,G3)(.7superpull) & pulled_super_arc.r(G3,4)(.5superpull));
filldraw stroke z.D2e--z.D4e; % inner stroke
penlabels(0,1,2,G3,4,D2,D3,D4,5); endchar;

cmchar "The letter d";
beginchar("d",10u#+serif_fit#,asc_height#,0);
italcorr asc_height#*slant-serif_fit#+.5stem#-2u#;
adjust_fit(0,serif_fit#);
pickup tiny.nib; pos1(stem',0); pos2(stem,0);
pos0'(stem',0); pos0(stem,0); z0r=z0'r; x0'=x1; x0=x2;
rt x1r=hround(w-2.5u+.5stem'); top y1=h;
numeric edge; edge=lft x2l;
pickup fine.nib; pos3(if hefty:thin_join else: hair fi,0);
pen_duplicate(5);
pos4(vair,90); pos5(.5curve,180); pos6(vair,270); penpos7(x3r-x3l,360);
lft x3l=min(lft x3l-(rt x3r-tiny.rt x2r),1/3[lft x2,edge]);
y3=1/8[bar_height,x_height];
x4l=.5(w-serif_fit)-.3u; top y4r=x_height+oo;
lft x.G5r=hround max(1.35u-.5curve,.6u); y5=.5x_height;
x6l=x4l-.2u; bot y6r=-oo;
x7=x3; y7=min(y3,y6+y4-y3+.6vair);
(x,y4r)=whatever[z3l,z4l]; x4r:=max(x,.5[x.G5r,x4]);
(x',y6r)=whatever[z7l,z6l]; x6r:=max(x',.5[x.G5r,x6]);
filldraw stroke z3e{up}...pulled_arc.e(4,G5)
 & pulled_arc.e(G5,6)...{up}z7e; % bowl
Delta_x = min(hround(curve_interspace+.5curve),x6r-x.G5l);
define_upper_and_lower(D4,D6,D5,
 z3r{up}...pulled_arc.r(4,G5) & pulled_arc.r(G5,6)...{up}z7r);
filldraw stroke z.D4e--z.D6e; % inner stroke
y0=ypart(((edge,h)--(edge,0))intersectionpoint(z3l{up}...{left}z4l));
pickup tiny.nib; bot y2=if serifs:-min(oo,serif_drop) else: 0 fi;
filldraw stroke z1e--z0'e--z0e--z2e;  % stem
if serifs: sloped_serif.l(1,0',a,1/3,jut,serif_drop);  % upper serif
 sloped_serif.r(2,0,b,1/3,jut,min(oo,serif_drop)); fi  % lower serif
penlabels(0,1,2,3,4,G5,6,D4,D5,D6,7); endchar;

cmchar "The letter e";
beginchar("e",7.25u#+max(.75u#,.5curve#),x_height#,0);
italcorr .5[bar_height#,x_height#]*slant+.5min(curve#-1.5u#,0);
adjust_fit(if monospace: .25u#,.5u# else: 0,0 fi);
numeric left_curve,right_curve;
left_curve=right_curve+6stem_corr=curve if not serifs: -3stem_corr fi;
if right_curve<tiny.breadth: right_curve:=tiny.breadth; fi
if .5left_curve<tiny.breadth: left_curve:=2tiny.breadth; fi
pen_duplicate(3);
pickup tiny.nib; pos1(right_curve,0);
pos2(vair,90); pos3(.5left_curve,180);
y1=good.y bar_height; top y2r=h+vround 1.5oo; y0l=bot y1;
rt x1r=hround min(w-.5u,w-u+.5right_curve);
lft x.G3r=hround max(.5u,1.25u-.5left_curve); x2=.5w+.25u;
{{interim superness:=more_super;
 filldraw stroke super_arc.e(1,2)}};  % right bowl
y3=.5[y2,y4]; bot y4r=-oo; x4=x2+.25u;
Delta_x = min(hround(curve_interspace+.5curve),x2r-x.G3l);
if serifs: pos4(vair',270); pos5(hair,360);
 y5=max(good.y(.5bar_height-.9),y4l+vair); x5r=x1r;
 (x,y4l)=whatever[z4r,z5]; x4l:=min(x,x4l+.5u);
 filldraw stroke pulled_arc.e(2,G3) & pulled_arc.e(G3,4)
  ...{x5-x4,5(y5-y4)}z5e; % left bowl, arc, and terminal
 define_upper_and_lower(D2,D4,D3,pulled_arc.r(2,G3) & pulled_arc.r(G3,4));
 filldraw stroke z.D2e--z.D4e; % inner stroke
else: pos4(vair,270);
 filldraw stroke super_arc.e(2,G3) & super_arc.e(G3,4);  % left bowl and arc
 define_upper_and_lower(D2,D4,D3,super_arc.r(2,G3) & super_arc.r(G3,4));
 filldraw stroke z.D2e--z.D4e; % inner stroke
 pickup fine.nib; pos4'(vair,270); z4=z4';
 pos5(.5[vair,flare],275); rt x5r=hround(w-.6u);
 y5r=good.y(y5r+1/3bar_height-y5); y5l:=good.y y5l; x5l:=good.x x5l;
 filldraw stroke term.e(4',5,right,1,4); fi  % terminal
y1'r=y0r=y0l+.6[thin_join,vair]; y1'l=y0l; x1'l=x1'r=x1;
forsuffixes $=l,r:
 x0$=x.D3r; endfor
fill stroke z0e--z1'e;  % crossbar
penlabels(0,1,2,G3,4,D2,D3,D4,5); endchar;

cmchar "The letter f";
beginchar("f",5.5u#,asc_height#,0);
italcorr asc_height#*slant+if serifs:flare#-.25u# else: 1.25u# fi;
adjust_fit(stem_shift#,if monospace: .5u# else:-stem_shift# fi);
pen_duplicate(1);
pickup tiny.nib; pos1(.5stem',0); lft x.G1l=hround(2.5u-.5stem');
pickup fine.nib; numeric bulb_diam;
if serifs: bulb_diam=hround .8[stem,flare];
 pos2(bulb_diam,0); y2+.5bulb_diam=.9[x_height,h+oo];
 if monospace: rt x2r=hround(w-.5u)+1 else: lft x2l=hround(w-.75u+.5) fi;
else: pos2(5/7[vair,flare],90); top y2r=h;
 rt x2=hround(if monospace:w-.5u else:w+.75u fi); fi
f_double_stroke(1,2,a,b,bc,c,jut,if not monospace:1.25fi\\ jut); % double stem, terminal, serif
pickup crisp.nib; top y3r=top y4r=x_height; lft x3=hround .5u-1;
pos3(bar,90); pos4(bar,90);
rt x4=hround(w-if monospace:.75u+1 else:1/3u fi);
filldraw stroke z3e--z4e;  % bar
penlabels(G1,D1,2,3,4); endchar;

iff not variant_g: cmchar "The letter g";
beginchar("g",9u#,x_height#,desc_depth#);
italcorr x_height#*slant+.25u#;
adjust_fit(0,0);
numeric light_vair,light_curve,loop_top,loop_side;
light_vair=Vround(.5[thin_join,vair]+vair_corr);
light_curve=max(fine.breadth,hround(curve-3stem_corr));
light_curve'=max(4fine.breadth/3,hround(curve-3stem_corr));
loop_top=Vround .77[vair,fudged.stem];
loop_side=hround .64[vair,fudged.stem];
pickup fine.nib; pos1(light_vair,90);
pen_duplicate(2);
pos2(.5light_curve',180); pos3(light_vair,270);
pos4(light_curve,360); pos11(loop_top,90);
y11r=good.y(y11r+.15bar_height-y11); x1=x3=.5[x.G2,x4]; y2=y4=.5[y1,y3];
lft x.G2r=hround(1.75u-.375light_curve'); rt x4r=hround(w-2.75u+.5light_curve);
top y1r=h+oo; y3r=good.y(y3r+.27[top y11r,bot y1l]-y3);
filldraw stroke pulled_arc.e(1,G2) & pulled_arc.e(G2,3);  % left half of bowl
filldraw stroke pulled_arc.e(3,4) & pulled_arc.e(4,1);  % right half of bowl
Delta_x = min(hround(curve_interspace+.5light_curve'),x1r-x.G2l);
define_upper_and_lower(D1,D3,D2,pulled_arc.r(1,G2) & pulled_arc.r(G2,3));
filldraw stroke z.D1e--z.D3e; % inner stroke
x0=superness[x1r,x4r]; y0=superness[y4r,y1r];  % NE point on the super bowl
x8'=superness[x3r,x.G2r]; y8'=superness[y.G2r,y3r];  % SW point on the super bowl
x8''=superness[x3,x.G2]; y8''=superness[y.G2,y3];
pos0(thin_join,angle(z0-z8')+90);
pos8(thin_join,angle(z0-z8')-90); z8=.618[z8',z8''];
if serifs: pos5(vair,90);
 pos6(hair,0); pos7(.5[hair,flare],0); x5=.75[x0,x6]; top y5r=h+o;
 rt x6r=hround(w-.25u); y6+(.5[hair,flare])/2=.95[bar_height,h]+oo;
 filldraw stroke z0e..{right}z5e; bulb(5,6,7);  % ear
else: pos5(vair',100); top y5r=h+oo;
 rt x5l=hround(w-.25u); y5l:=good.y y5l;
 filldraw z0l{z5-z0}..z5l--z5r{left}..{curl 1}z0r--cycle; fi  % ear
pos10(loop_top,90); x10=x8+.75u; y10=y11;
pos12(loop_side,0); pos13(light_vair,-90);
pos14(loop_side,-180); pos10'(.5[thin_join,vair],-270);
rt x12r=hround max(w-1.25u+.5loop_side,w-.5u); y12=y14=.5[y11,y13];
x11=x13=max(.5w,x10+eps); bot y13r=-d-oo-1; x14=w-x12; z10'l=z10l;
filldraw stroke z8e{z8-z0}..z10e---z11e;  % link
filldraw stroke {{interim superness:=hein_super; super_arc.e(11,12)}}
 & super_arc.e(12,13) & super_arc.e(13,14) & super_arc.e(14,10');  % loop
penlabels(0,1,G2,3,D1,D2,D3,4,5,6,7,8,10,11,12,13,14); labels(8',8''); endchar;

iff variant_g: cmchar "Variant letter g";
beginchar("g",10u#+serif_fit#,x_height#,desc_depth#);
italcorr x_height#*slant-serif_fit#+.5stem#-2u# if serifs:+.5u# fi;
adjust_fit(0,serif_fit# if serifs: -.5u# fi);
pickup tiny.nib; pos1(stem',0); pos2(stem,0);
pos0'(stem',0); pos0(stem,0); z0r=z0'r; x0'=x1; x0=x2;
rt x1r=hround(w-2.5u+.5stem');
numeric edge; edge=lft x2l;
path edge_path; edge_path=(edge,h)--(edge,0);
pen_duplicate(5);
pickup fine.nib; pos3(if hefty:thin_join else: hair fi,0);
pos4(vair,90); pos5(.5curve,180); pos6(vair,270); penpos7(x3r-x3l,360);
lft x3l=min(lft x3l-(rt x3r-tiny.rt x2r),2/3[lft x2,edge]); y3=bar_height;
x4l=.5(w-serif_fit)-.3u; top y4r=x_height+oo;
lft x.G5r=hround max(1.35u-.5curve,.6u); y5=.5x_height;
x6l=x4l-.2u; bot y6r=vround 1/3vair;
lft x7l=edge; y7=min(y3,y6+y4-y3+.6vair);
(x,y4r)=whatever[z3l,z4l]; x4r:=max(x,.5[x.G5r,x4]);
(x',y6r)=whatever[z7l,z6l]; x6r:=max(x',.5[x.G5r,x6]);
filldraw stroke z3e{up}...{left}z4e&super_arc.e(4,G5)
 &super_arc.e(G5,6)&z6e{right}...{up}z7e;  % bowl
Delta_x = min(hround(curve_interspace+.5curve),x6r-x.G5l);
define_upper_and_lower(D4,D6,D5,super_arc.r(4,G5) & super_arc.r(G5,6));
filldraw stroke z.D4e--z.D6e; % inner stroke
y1=ypart(edge_path intersectionpoint(z3l{up}...{left}z4l));
y0=ypart(edge_path intersectionpoint(z7l{down}...{left}z6l));
pickup tiny.nib; bot y2=if serifs: -.25d else: 0 fi;
filldraw stroke z1e--z0'e--z0e--z2e;  % stem
pickup crisp.nib;
pos8(hround(hair-stem_corr),0); pos7'(stem',0);
z7'=z1; x8r=x7'r; top y8=h+oo;
filldraw stroke z7'e--z8e;  % point
if serifs: pickup tiny.nib;
 pos9(vair,-90); x9=.5[x2,x10]; bot y9r=-d-o-1;
 pos10(hair,-180); lft x10r=hround u; y10=-.75d+.5flare;
 pos11(flare,-180); z11r=z10r;
 bulb(9,10,11); filldraw stroke super_arc.e(2,9);  % tail
else: pickup fine.nib; pos2'(stem,0); z2'=z2;
 z2''r=z2'r; z2''=z2'; z2''l=(x2'l,0);
 pos9(vair,-90); x9=4.5u; bot y9r=-d-o-1;
 pos10(.5[vair,flare],-90); lft x10=hround 1.25u;
 y10r=good.y -5/6d; y10l:=good.y y10l;
 filldraw stroke z2'e..z2''e&super_arc.e(2'',9)
  & term.e(9,10,left,.9,4); fi  % tail
penlabels(0,1,2,3,4,G5,6,D4,D5,D6,7,8,9,10,11); endchar;

cmchar "The letter h";
beginchar("h",10u#,asc_height#,0);
italcorr .5[bar_height#,x_height#]*slant-serif_fit#+.5stem#-2u#;
adjust_fit(serif_fit#+stem_shift#,serif_fit#-stem_shift#);
pen_duplicate(1,1',2,2');
pickup tiny.nib; pos1(.5stem,0); pos2(.5stem,0);
pos1'(.5stem',0); pos2'(.5stem',0); pos3(stem,0);
Delta_x = hround(interspace+.5stem);
lft x.G1l=hround(2.5u-.5stem); x1l=x1'l=x2l=x2'l; x3r=w-x.G1l;
top y1=h; bot y2=0; y1=y1'; y2=y2';
double filldraw stroke z1'e--z2'e;  % left (double) stem
h_stroke(D2,a,3,4);  % arch and right stem
if serifs: sloped_biserif.l(1',2',b,1/3,jut,serif_drop,b',1/3); % upper left serif
 numeric inner_jut; pickup tiny.nib;
 if rt x2r+jut+.5u+1<=lft x4l-jut: inner_jut=jut;
 else: rt x2r+jut+.5u+1=lft x4l-inner_jut; fi
 dish_biserif(2,1,c,1/3,jut,cd,1/3,d,1/3,jut); % lower left serif
 dish_serif(4,3,e,1/3,inner_jut,f,1/3,jut); % lower right serif
else: mid_biserif(1,2,b,1/3); % upper left terminal
 mid_biserif(2,1,cd,1/3); fi  % lower left terminal
penlabels(G1,D1,G2,D2,3,4); endchar;

cmchar "The letter i";
numeric dot_diam#; dot_diam#=max(dot_size#,cap_curve#);
beginchar("i",5u#,min(asc_height#,10/7x_height#+.5dot_diam#),0);
define_whole_blacker_pixels(dot_diam);
italcorr h#*slant-serif_fit# + .5dot_diam# -2u#;
adjust_fit(serif_fit#+stem_shift# if monospace:+.25u#fi,serif_fit#-stem_shift#);
pen_duplicate(1,2);
pickup tiny.nib; pos1(.5stem',0); pos2(.5stem',0);
Delta_x = hround(interspace+.5stem');
if odd(w-stem'-interspace): change_width; fi
lft x.G1l=hround(.5w-.5stem'-.5interspace); x1=x2;
top y1=x_height if serifs: +min(oo,serif_drop) fi; bot y2=0;
double filldraw stroke z1e--z2e;  % double stem
pos3(dot_diam,0); pos4(dot_diam,90);
if serifs: x3r=max(x1r,hround(x1+.5dot_diam-.2jut)-.5tiny)
else: x3=x1-.5 fi;
top y4r=h+1;
if bot y4l-top y1<slab: y4l:=min(y4r-eps,y1+tiny+slab); fi
x3=x4; y3=.5[y4l,y4r]; dot(3,4);  % dot
if serifs: sloped_biserif.l(1,2,a,1/3,.95jut,serif_drop,a',1/3);  % upper serif
 dish_biserif(2,1,b,1/3,jut,bc,1/3,c,1/3,.9jut);  % lower serif
else: mid_biserif(1,2,a,1/3);  % upper terminal
 mid_biserif(2,1,bc,1/3); fi  % lower terminal
penlabels(G1,D1,G2,D2,3,4); endchar;

cmchar "The letter j";
numeric dot_diam#; dot_diam#=max(dot_size#,cap_curve#);
beginchar("j",5.5u#,min(asc_height#,10/7x_height#+.5dot_diam#),desc_depth#);
define_whole_blacker_pixels(dot_diam);
italcorr h#*slant-serif_fit#+.5stem#-2u#;
adjust_fit(serif_fit#+2stem_shift# if monospace:+\\.5u# fi,
 serif_fit#-2stem_shift# if monospace:-.5u# fi);
pen_duplicate(1,2);
pickup tiny.nib; pos1(.5stem',0); pos2(.5stem',0);
rt x.D1r=hround(.5w+.25u+.5stem'+.5interspace); x1=x2;
top y1=x_height if serifs: +min(oo,serif_drop) fi; bot y2=-1/3d;
filldraw stroke z.D1e--z.D2e; % right stem
pos3(dot_diam,0); pos4(dot_diam,90);
x3r=x.D1r; top y4r=h+1;
if bot y4l-top y1<slab: y4l:=min(y4r-eps,y1+tiny+slab); fi
x3=x4; y3=.5[y4l,y4r]; dot(3,4);  % dot
if serifs:
 pickup tiny.nib; pos5(vair,-90); pos6(hair,-180); pos7(flare,-180);
 x5=.5[x.D2,x6r]; bot y5r=-d-oo; y6-.5flare=-.88d;
 if monospace: lft x6r=0 else: z6r=z7r; rt x7l=floor .75u fi;
 (x,y5r)=whatever[z5l,z.D2l]; x5r:=max(x,.5[x6r,x5]);
 filldraw stroke z.D2e{down}...z5e{left};  bulb(5,6,7); % arc and bulb
 Delta_x = min(hround(interspace+.5stem'),x.D2l-x5r);
 define_lower(G5,G2,z.D2r{down}...z5r{left});
 filldraw stroke z.G1e--z.G5e; % left (inner) stem
 sloped_biserif.l(1,2,a,1/3,1.1jut,serif_drop,a',1/3);  % upper serif
else: pen_duplicate(2');
 pickup fine.nib; pos2'(.5stem',0); z2'=z2;
 pos6(.2[vair,.5stem'],-90); pos7(vair,-90);
 lft x7r=hround -.75u; bot y7r=vround 5/6(-d-oo);
 (x,y7l)=whatever[z7r,z3]; x7l:=x;
 z5r=z.D2'r; (x.D2'l,y5l)=whatever[z7l,z5r]; x5l=x.D2'l; y5=y5r;
 x6r=.5[x7r,x5r]; x6l:=.5[x7l,x5l]; bot y6r=-d-oo;
 filldraw stroke z.D2'e..{down}z5e & super_arc.e(5,6)
  & z6e{left}..z7e; % arc and terminal
 Delta_x = min(hround(interspace+.5stem'),x.D2l-x7l);
 define_lower(G5,G2',z.D2'r..{down}z5r & super_arc.r(5,6)
  & z6r{left}..z7r);
 filldraw stroke z.G2'e--z.G5e; % inner stroke
 pickup tiny.nib; filldraw stroke z.G1e--z.G2e; % right stem
 mid_biserif(1,2,a,1/3); fi  % upper terminal
penlabels(G1,D1,G2,D2,G2',D2',3,4,5,G5,6,7); endchar;

cmchar "The letter k";
beginchar("k",9.5u#,asc_height#,0);
italcorr x_height#*slant-.2u#;
adjust_fit(serif_fit#,serif_fit#); pickup tiny.nib;
numeric right_jut,stem[],alpha[];
stem1=stem2=max(tiny.breadth,hround(.5fudged.stem-stem_corr));
stem3=max(tiny.breadth,hround(fudged.hair if hefty:-\\4stem_corr fi));
stem4=max(tiny.breadth,hround(fudged.stem-3stem_corr));
pen_duplicate(1,2);
if serifs: right_jut=.6jut; else: right_jut=.4tiny; fi
pos1(stem1,0); pos2(stem2,0); top y1=h; bot y2=0;
Delta_x = hround(interspace+stem1);
lft x.G1l=lft x.G2l=hround(2.5u-.5stem1);
top y3=x_height; rt x3r=hround(r-letter_fit-.7u-right_jut)+eps;
bot y6=0; rt x6r=hround(r-letter_fit-.3u-right_jut)+eps;
x4=x11=x.D1; y4=.7bar_height; y11=y3;
alpha1=diag_ratio(1,.5(stem3-tiny),y3-y4,x3r-x4);
alpha2=diag_ratio(1,.5(stem4-tiny),y11-y6,x6r-x.D1);
penpos3(alpha1*(stem3-tiny),0); penpos4(whatever,-90);
z5=.5[z5l,z5r]; penpos6(alpha2*(stem4-tiny),0);
forsuffixes $=l,r: y3'$=x_height; y6'$=0; z4$=z3'$+whatever*(z3-z4);
 z5$=z6'$+whatever*(z11-z6)=whatever[z3,z4]; endfor
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 z11-z6 of currentpen+whatever*(z11-z6);
z6'l=z6l+penoffset z6-z11 of currentpen+whatever*(z11-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
pen_duplicate(0,0');
pos0(stem1,0); pos0'(stem2,0); y0=y0'; x0=x1; x0'=x2;
rt z.D0r=whatever[z3,z4]; double filldraw stroke z1e..z0e--z0'e..z2e; % double stem
if serifs: numeric inner_jut;
 if rt x2r+jut+.5u+1<=lft x6l-jut: inner_jut=jut;
 else: rt x2r+inner_jut+.5u+1=lft x6l-inner_jut; fi
  sloped_biserif.l(1,0,a,1/3,jut,serif_drop,a',1/3); % upper stem serif
 dish_biserif(2,0',b,1/3,jut,bc,1/3,c,1/3,inner_jut);  % lower stem serif
 dish_serif(3,4,d,2/3,1.4jut,e,1/2,right_jut)(dark); % upper diagonal serif
 dish_serif(6,5,f,1/2,inner_jut,g,1/3,right_jut)(dark); % lower diagonal serif
else: mid_biserif(1,0,a,1/3); % upper stem terminal
 mid_biserif(2,0',bc,1/3); fi  % lower stem terminal
penlabels(G0,D0,G1,D1,G2,D2,3,4,5,6,11); endchar;

cmchar "The letter l";
beginchar("l",5u#,asc_height#,0); l_width#:=5u#+2serif_fit#;
italcorr asc_height#*slant-serif_fit#+.5stem#-2u#;
adjust_fit(serif_fit#+stem_shift#,serif_fit#-stem_shift#);
pen_duplicate(1,2);
pickup tiny.nib; pos1(.5stem',0); pos2(.5stem',0);
Delta_x = hround(interspace+.5stem');
if odd(w-stem'-interspace): change_width; fi
lft x.G1l=hround(.5w-.5stem'-.5interspace); x1=x2; top y1=h; bot y2=0;
double filldraw stroke z1e--z2e;  % double stem
if serifs: sloped_biserif.l(1,2,a,1/3,jut,serif_drop,a',1/3);  % upper serif
 dish_biserif(2,1,b,1/3,jut,bc,1/3,c,1/3,jut);  % lower serif
else: mid_biserif(1,2,a,1/3);  % upper terminal
 mid_biserif(2,1,bc,1/3); fi  % lower terminal
penlabels(G1,D1,G2,D2); endchar;

cmchar "The letter m";
beginchar("m",15u#,x_height#,0);
italcorr .5[bar_height#,x_height#]*slant-serif_fit#+.5stem#-2u#;
adjust_fit(serif_fit#+stem_shift#,serif_fit#-stem_shift#);
numeric shaved_stem; shaved_stem=hround(.5mfudged.stem-stem_corr);
pen_duplicate(1,1',2,2');
pickup tiny.nib; %pos1(.5mfudged.stem,0); pos2(.5mfudged.stem,0);
pos1(shaved_stem,0); pos2(shaved_stem,0);
pos1'(shaved_stem,0); pos2'(shaved_stem,0);
pos3(mfudged.stem,0); pos5(mfudged.stem,0);
Delta_x = hround(interspace+.5mfudged.stem);
lft x.G1l=hround(2.5u-.5stem); x1l=x1'l=x2l=x2'l; % stem, sic
lft x3l=hround(.5w-.5mfudged.stem+.5interspace); x5l-x3r=x3l-x.D1r;
if not monospace: r:=hround(x5+x.D1)+r-w-interspace; fi  % change width for better fit
top y1=h+min(oo,serif_drop); bot y2=0; y1=y1'; y2=y2';
double filldraw stroke z1'e--z2'e;  % left (double) stem
h_stroke(D2,a,3,4);  % left arch and middle stem
h_stroke(4,b,5,6);  % right arch and right stem
if serifs: sloped_biserif.l(1',2',c,1/3,jut,serif_drop,c',1/3); % upper left serif
 numeric inner_jut; pickup tiny.nib;
 if rt x.D2r+jut+.5u+1<=lft x4l-jut: inner_jut=jut;
 else: rt x.D2r+jut+.5u+1=lft x4l-inner_jut; fi
 dish_biserif(2,1,d,1/3,jut,de,1/3,e,1/3,jut); % lower left serif
 dish_serif(4,3,f,1/3,inner_jut,g,1/3,jut); % lower middle serif
 dish_serif(6,5,h,1/3,inner_jut,i,1/3,jut); % lower right serif
else: mid_biserif(1,2,c,1/3); % upper left terminal
 mid_biserif(2,1,de,1/3); fi  % lower left terminal
penlabels(G1,D1,G2,D2,3,4,5,6); endchar;

cmchar "The letter n";
beginchar("n",10u#,x_height#,0);
italcorr .5[bar_height#,x_height#]*slant-serif_fit#+.5stem#-2u#;
adjust_fit(serif_fit#+stem_shift#,serif_fit#-stem_shift#);
pen_duplicate(1,1',2,2');
pickup tiny.nib; %pos1(.5stem,0); pos2(.5stem,0);
numeric shaved_stem; shaved_stem=hround(.5stem-stem_corr);
pos1(shaved_stem,0); pos2(shaved_stem,0);
pos1'(shaved_stem,0); pos2'(shaved_stem,0); pos3(stem,0);
Delta_x = hround(interspace+.5stem);
lft x.G1l=hround(2.5u-.5stem); x1l=x1'l=x2l=x2'l; x3r=w-x.G1l;
top y1=h+min(oo,serif_drop); bot y2=0; y1=y1'; y2=y2';
double filldraw stroke z1'e--z2'e;  % left (double) stem
h_stroke(D2,a,3,4);  % arch and right stem
if serifs: sloped_biserif.l(1',2',b,1/3,jut,serif_drop,b',1/3); % upper left serif
 numeric inner_jut; pickup tiny.nib;
 if rt x.D2r+jut+.5u+1<=lft x4l-jut: inner_jut=jut;
 else: rt x.D2r+jut+.5u+1=lft x4l-inner_jut; fi
 dish_biserif(2,1,c,1/3,jut,cd,1/3,d,1/3,jut); % lower left serif
 dish_serif(4,3,e,1/3,inner_jut,f,1/3,jut); % lower right serif
else: mid_biserif(1,2,b,1/3); % upper left terminal
 mid_biserif(2,1,cd,1/3); fi  % lower left terminal
penlabels(G1,D1,G2,D2,3,4); endchar;

cmchar "The letter o";
beginchar("o",9u#,x_height#,0);
italcorr .7x_height#*slant;
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
pen_duplicate(2);
penpos1(vair,90); penpos3(vair',-90);
penpos2(.5curve,180); penpos4(curve,0);
x.G2r=hround max(.5u,1.25u-.5curve);
x4r=w-x.G2r; x1=x3=.5w; y1r=h+vround 1.5oo; y3r=-oo;
y2=y4=.5h-vair_corr; y2l:=y4l:=.52h;
penstroke pulled_arc.e(1,G2) & pulled_arc.e(G2,3)
 & pulled_arc.e(3,4) & pulled_arc.e(4,1) & cycle;  % bowl
Delta_x = min(hround(curve_interspace+.5curve),x1r-x.G2l);
define_upper_and_lower(D1,D3,D2,pulled_arc.r(1,G2) & pulled_arc.r(G2,3));
filldraw stroke z.D1e--z.D3e; % inner stroke
penlabels(1,G2,3,D1,D2,D3,4); endchar;

cmchar "The letter p";
beginchar("p",10u#+serif_fit#,x_height#,desc_depth#);
italcorr .5x_height#*slant+min(.5curve#-.85u#,-.1u#);
adjust_fit(serif_fit#,0);
pen_duplicate(0,0',1,2);
pickup tiny.nib; pos1(.5stem',0); pos2(.5stem,0);
pos0'(.5stem',0); pos0(.5stem,0); z0l=z0'l; x0'=x1; x0=x2;
Delta_x = hround(interspace+.5stem);
lft x.G1l=hround(2.5u-.5stem'); top y1=h if serifs: +min(oo,serif_drop) fi;
numeric edge; edge=rt x.D2r;
pickup fine.nib; pos3(if hefty:thin_join else: hair fi,180);
pos4(vair',90); pos5(curve,0); pos6(vair,-90); penpos7(x3l-x3r,-180);
rt x3l=max(rt x3l-(lft x3r-tiny.lft x.D2l), 1/3[rt x.D2,edge]);
y3=1/8[bar_height,x_height];
x4l=w-.5(w-serif_fit)+.5u+.5interspace; top y4r=x_height+oo;
rt x5r=hround min(w-1.35u+.5curve,w-.6u); y5=.5x_height;
x6l=x4l-.2u; bot y6r=-oo;
x7=x3; y7=min(y3,y6+y4-y3+.6vair);
(x,y4r)=whatever[z3l,z4l]; x4r:=min(x,.5[x5r,x4]);
(x',y6r)=whatever[z7l,z6l]; x6r:=min(x',.5[x5r,x6]);
filldraw stroke z3e{up}...{right}z4e&super_arc.e(4,5)
 &super_arc.e(5,6)&z6e{left}...{up}z7e;  % bowl
y0=ypart(((edge,h)--(edge,0))intersectionpoint(z3l{up}...{right}z4l));
pickup tiny.nib; bot y2=-d;
double filldraw stroke z1e--z0'e--z0e--z2e;  % double stem
%pickup crisp.nib; pos8(hair,0); pos7'(stem,0);
%z7'=z2; x8l=x7'l; bot y8=0;
%filldraw stroke z7'e--z8e;  % point
if serifs: sloped_biserif.l(1,0',a,1/3,jut,serif_drop,a',1/3);  % upper serif
 dish_biserif(2,0,b,1/3,jut,bc,1/3,c,1/3,jut);  % lower serif
else: mid_biserif(1,0,a,1/3);  % upper terminal
 mid_biserif(2,0,bc,1/3); fi  % lower terminal
penlabels(G0,D0,G1,D1,G2,D2,3,4,5,6,7,8); endchar;

cmchar "The letter q";
beginchar("q",10u#+serif_fit#,x_height#,desc_depth#);
italcorr x_height#*slant-serif_fit#+.5stem#-2u# if serifs:+.5u# fi;
adjust_fit(0,serif_fit# if serifs: -.5u# fi);
pickup tiny.nib; pos1(stem',0); pos2(stem,0);
pos0'(stem',0); pos0(stem,0); z0r=z0'r; x0'=x1; x0=x2;
rt x1r=hround(w-2.5u+.5stem');
numeric edge; edge=lft x2l;
pen_duplicate(5);
pickup fine.nib; pos3(if hefty:thin_join else: hair fi,0);
pos4(vair',90); pos5(.5curve,180); pos6(vair,270); penpos7(x3r-x3l,360);
lft x3l=min(lft x3l-(rt x3r-tiny.rt x2r),2/3[lft x2,edge]); y3=bar_height;
x4l=.5(w-serif_fit)-.3u; top y4r=x_height+oo;
lft x.G5r=hround max(1.35u-.5curve,.6u); y5=.5x_height;
x6l=x4l-.2u; bot y6r=-oo; y7=min(y3,y6+y4-y3+.6vair);
lft x7l=min(lft x7l-(rt x7r-tiny.rt x2r),1/3[lft x2,edge]);
(x,y4r)=whatever[z3l,z4l]; x4r:=max(x,.5[x.G5r,x4]);
(x',y6r)=whatever[z7l,z6l]; x6r:=max(x',.5[x.G5r,x6]);
filldraw stroke z3e{up}...{left}z4e&super_arc.e(4,G5)
 &super_arc.e(G5,6)&z6e{right}...{up}z7e;  % bowl
Delta_x = min(hround(curve_interspace+.5curve),x6r-x.G5l);
define_upper_and_lower(D4,D6,D5,super_arc.r(4,G5) & super_arc.r(G5,6));
filldraw stroke z.D4e--z.D6e; % inner stroke
y1=ypart(((edge,h)--(edge,0))intersectionpoint(z3l{up}...{left}z4l));
y0=ypart(((edge,h)--(edge,0))intersectionpoint(z6l{right}...{up}z7l));
pickup tiny.nib; bot y2=-d;
filldraw stroke z1e--z0'e--z0e--z2e;  % stem
pickup crisp.nib;
pos8(hround(hair-stem_corr),0); pos7'(stem',0);
z7'=z1; x8r=x7'r; top y8=h+oo;
filldraw stroke z7'e--z8e;  % point
if serifs: dish_serif(2,0,b,1/3,jut,c,1/3,jut); fi  % lower serif
penlabels(0,1,2,3,4,G5,6,D4,D5,D6,7,8); endchar;

cmchar "The letter r";
numeric r_flare#; r_flare#=.75[if serifs: stem# else: vair# fi,flare#];
define_whole_blacker_pixels(r_flare);
beginchar("r",if serifs:max(7u#,5.5u#+r_flare#) else:6.5u# fi,x_height#,0);
italcorr x_height#*slant if not serifs: +.25u# fi;
adjust_fit(serif_fit#,0);
pickup fine.nib; top y4r=h+oo;
if serifs: pos4(vair,90); pos5(hair,0);
 x4=w-max(1.75u,.25u+r_flare);
 rt x5r=hround(w-.5u+.5); y5+.5r_flare=.9[bar_height,h]+oo;
 pos6(r_flare,0); bulb(4,5,6);  % bulb
else: pos4(r_flare,90); rt x4=hround(w-.25u); fi
pos3(thin_join,180); rt x3l=hround(2.5u-.5stem')+stem'+interspace; top y3=bar_height;
filldraw stroke z3e{up}...{right}z4e;  % arc
pen_duplicate(0,0',1,2);
pickup tiny.nib; pos0(hround(.5stem-stem_corr),0); pos2(hround(.5stem-stem_corr),0);
pos1(hround(.5stem-stem_corr),0); top y1=h+min(oo,serif_drop);
pos0'(hround(.5stem-stem_corr),0); y0=y0'=y3; x1l=x0l=x0'l=x2l;
Delta_x = hround(interspace+.5stem-stem_corr);
lft x.G1l=hround(2.5u-.5stem+stem_corr); bot y2=0;
double filldraw stroke z1e--z0'e--z0e--z2e;  % double stem
if serifs: sloped_biserif.l(1,0',a,1/3,jut,serif_drop,a',1/3);  % upper serif
 dish_biserif(2,0,b,1/3,jut,bc,1/3,c,1/3,1.25jut);  % lower serif
else: mid_biserif(1,0,a,1/3);  % upper terminal
 mid_biserif(2,0,bc,1/3); fi  % lower terminal
penlabels(G1,D1,G2,D2,3,4,5,6); endchar;

cmchar "The letter s";
beginchar("s",7.1u#,x_height#,0);
italcorr x_height#*slant-if serifs:.55u# else:.3u# fi;
adjust_fit(if monospace: .5u#,.4u# else: 0,if serifs:0 else:-.2u# fi fi);
numeric theta; theta=90-angle(40u,h); slope:=-h/40u;  % angle at middle
numeric s_slab; s_slab=if serifs:vair else:Vround .1[vair,stem] fi;
numeric ess'; ess'=max(fine.breadth,ess);
pen_duplicate(3,6);
pickup fine.nib; pos2(max(fine.breadth,s_slab-vround vair_corr),-100);
pos0(ess',theta); pos7(s_slab,-90); x2l=x0=x7=.5w;
top y2l=h+vround 1.5oo; bot y7r=-oo;
y0-.5ess'=y7l+if serifs:.54 else: .52 fi\\(y2r-y7l-ess');
lft x.G3l=hround .6u; rt x.D6r=hround(w-.6u);
x3r-x3l=x6r-x6l=hround .5[.75s_slab,.75ess']-fine;
Delta_x = min(hround(curve_interspace+x3r-x3l+fine),x2l-x.G3r); % x2l-x.G3r=x.D6l-x7r
ellipse_set(2l,G3l,4l,0l); ellipse_set(2r,G3r,4r,0r); y3=y3r;
ellipse_set(7l,D6l,5l,0l); ellipse_set(7r,D6r,5r,0r); y6=y6r;
interim superness:=more_super;
filldraw stroke super_arc.e(2,G3) & z.G3e{down}
 ..z4e---z5e..z.D6e{down} & super_arc.e(D6,7);  % main stroke
define_upper_and_lower(D2,D4,D3,super_arc.l(2,G3) & z.G3l{down}..z4l---z5l);
define_upper_and_lower(G5,G7,G6,z4r---z5r..z.D6r{down} & super_arc.r(D6,7));
filldraw stroke z.D2e--z.D4e; filldraw stroke z.G5e--z.G7e; % inner strokes
if serifs: pos1(hair,180); pos8(hair,180);
 rt x1l=hround(w-1.05u); lft x8r=hround .6u;
 bot y1=min(bot y2r,vround 1/5[top y5r,h]);
 top y8=max(top y7l,vround 5/6 bot y4l);
 filldraw stroke z1e{up}....{left}z2e;  % upper arc
 filldraw stroke z7e{left}....{x8-x7,5(y8-y7)}z8e;  % lower arc
 path upper_arc, lower_arc;
 upper_arc=z1{up}....{left}z2; lower_arc=z7{left}....{x8-x7,5(y8-y7)}z8;
 pos10(.3[fine.breadth,cap_hair],0); pos9(.3[fine.breadth,cap_hair],0);
 x10r=x1l; top y10=top y2l; x9l=x8r; bot y9=bot y7r;
 x1l-x1'=x8'-x8r=1.6cap_curve-fine; y1'=y1; y8'=y8;
 numeric t; t=xpart(upper_arc intersectiontimes(z10l--z1'));
 filldraw z1l--z10r--z10l--subpath(t,0) of upper_arc--cycle;  % upper barb
 t:=xpart(lower_arc intersectiontimes(z9r--z8'));
 filldraw z8r--z9l--z9r--subpath(t,1) of lower_arc--cycle;  % lower barb
else: pos1(4/7[s_slab,flare],-100); pos8(flare,-100);
 x1l=good.x(x1l+w-u-rt x1); lft x8r=hround .5u;
 top y1l=vround(.93h+1.5oo); bot y8r=vround .1h-oo;
 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
penlabels(0,1,1',2,G3,4,D2,D3,D4,5,D6,7,G5,G6,G7,8,8',9,10); endchar;

cmchar "The letter t";
beginchar("t",6u#+max(u#,.5stem#),
 min(asc_height#,if hefty:9/7 else:10/7 fi\\ x_height#),0);
italcorr x_height#*slant if serifs: -.9u# else: -.4u# fi;
adjust_fit(0,if serifs: 0 else: -.5u# fi);
pen_duplicate(2,3);
numeric shaved_stem; shaved_stem=hround(.5stem if hefty:-\\stem_corr fi);
pickup fine.nib; pos2(shaved_stem,180);pos3(shaved_stem,180);
lft x.G2r=lft x.G3r=hround(2.5u-.5shaved_stem);
y2=y8; y3=max(.5bar_height,2vair);
pickup crisp.nib; pos8(bar,90);
rt x8=hround(w-1.3u); top y8r=x_height; lft x7=hround 1/3u; y7l=y8l;
pickup fine.nib; interim superness:=more_super;
pos4(vair',-90); bot y4r=-oo; rt x5r=hround(w-u);
if serifs: pos5(hair,0); y5=y3; x4l=.5[x.G3l,x5l];
 (x,y4r)=whatever[z4l,z5l]; x4r:=max(x,.5[x.G3r,x4]);
 filldraw stroke z.G2e..super_arc.e(G3,4)...{up}z5e;  % stem and hook
 Delta_x = min(hround(interspace+shaved_stem),x4r-x.G3l);
 define_lower(D4,D3,super_arc.r(G3,4));
 filldraw stroke z.D2e--z.D4e; % inner stroke
 pickup crisp.nib; pos6(hair,0); pos5'(hair,0);
 x6=x5=x5'; top y6=max(vround .75bar_height,top y5); y5=y5';
 filldraw stroke z5'e--z6e;  % terminal
else: pos5(vair,-75); top y5l=vround .2[top y4l,bar_height];
 x5l:=good.x x5l; x4l=1/3[x.G3l,x5l]; x4r:=1/3[x.G3r,x5r]; y3l:=y3l+.2vair;
 filldraw stroke z.G2e..super_arc.e(G3,4);  % stem and hook
 path p; p=stroke z4e{right}..tension .9 and atleast 1..z5e;  % terminal
 Delta_x = min(hround(interspace+shaved_stem),x5r-x.G3l);
 if (xpart(z5l-precontrol 1 of p)<0) or (xpart(z5r-postcontrol 2 of p)<0):
  filldraw stroke z4e{right}...{up}z5e;
  define_lower(D4,D3,super_arc.r(G3,4)&z4r{right}...{up}z5r);
 else: filldraw p; define_lower(D4,D3,super_arc.r(G3,4)
  & z4r{right}..tension .9 and atleast 1..z5r); fi;
 filldraw stroke z.D2e--z.D4e; fi  % inner stroke
if hefty: pos7(bar,90);
 filldraw stroke z7e--z8e;  % crossbar
 pickup tiny.nib; pos1(hround(shaved_stem-stem_corr),0);
 rt x1r=fine.rt x.D2l; top y1=h;
 penpos2'(x1r-x1l,0); x2'=x1; y2'=y2;
 filldraw stroke z1e--z2'e;  % upper terminal
else: pos7(vair,90); pos1(hair,0);
 rt x1r=fine.rt x.D2l; top y1=h;
 filldraw z1l{down}...{left}z7r--z7l--z8l
  --z8r--(x1r,y8r)--z1r--cycle; fi  % upper terminal and crossbar
penlabels(1,G2,D2,G3,D3,4,D4,5,6,7,8); endchar;

cmchar "The letter u";
beginchar("u",10u#,x_height#,0);
italcorr x_height#*slant-serif_fit#+.5stem#-2u#;
adjust_fit(serif_fit#+stem_shift#,serif_fit#-stem_shift#);
numeric light_vair; light_vair=vair if hefty: -vround 2vair_corr fi;
if light_vair<fine.breadth: light_vair:=fine.breadth; fi
pen_duplicate(1,2);
pickup tiny.nib; pos1(.5stem,0); pos2(.5stem,0);
pos3(stem,0); pos4(stem',0);
lft x.G1l=hround(2.5u-.5stem); x1=x2; x3r=w-x.G1l; x3r=x4r;
if serifs: top y1=h+min(oo,serif_drop); bot y4=-min(oo,serif_drop);
else: top y1=h; bot y4=0; fi
pos0(stem,0); pos0'(stem',0); x0=x3; x0'=x4; y0=y0';
pen_duplicate(2');
penpos2'(.5stem-fine,-180); z2'=z2; y3=y1; y2=.5bar_height;
penpos5(max(eps,light_vair-fine),-90); penpos6(thin_join-fine,0);
y6=y0=2/3bar_height;
filldraw stroke z3e..z0e--z0'e..z4e;  % right stem
pickup fine.nib; bot y5r=-oo; x5l=.5w-.25u; lft x6l=tiny.lft x0l;
(x,y5r)=whatever[z5l,z6l]; x5r:=max(x,.5[x5,x.G2'r]);
filldraw stroke {{interim superness:=hein_super;
  pulled_arc.e(G2',5)}} & z5e{right}...{up}z6e;  % arc
pickup tiny.nib;
Delta_x = min(hround(interspace+.5stem),x5r-x.G2r);
define_lower(D5,D2,{{interim superness:=hein_super;
  pulled_arc.r(G2',5)}} & z5r{right}...{up}z6r);
double filldraw stroke z1e--z2e;  % left (double) stem
filldraw stroke z.D2e--z.D5e; % inner stroke
pickup fine.nib;
if serifs: sloped_biserif.l(1,2,a,1/3,jut,serif_drop,a',1/3); % upper left serif
 sloped_serif.l(3,0,b,1/3,jut,serif_drop); % upper right serif
 sloped_serif.r(4,0',c,1/3,jut,min(oo,serif_drop)); % lower right serif
else: mid_biserif(1,2,a,1/3); fi  % upper left terminal
penlabels(G1,D1,G2,D2,3,4,5,D5); labels(6); endchar;

cmchar "The letter v";
beginchar("v",if serifs: 9.5u# else:9u# fi,x_height#,0);
italcorr x_height#*slant+.25u#;
adjust_fit(serif_fit# if monospace:+\\.5u#,.5u#+ else:,fi\\ serif_fit#);
numeric left_stem,right_stem,outer_jut,alpha;
left_stem=fudged.stem-stem_corr;
right_stem=min(fudged.hair if hefty:-2stem_corr fi,left_stem);
pen_duplicate(1,2);
outer_jut=.75jut; x.G1l=w-x4r=l+letter_fit+outer_jut+.25u; y1=y4=h;
x2-x1=x4-x3; x.D2r=x3r; y2=y3=-apex_oo;
alpha=diag_ratio(2,right_stem,y1-y2,x4r-x.G1l-apex_corr-interspace);
penpos1(alpha*.5left_stem,0); penpos2(alpha*.5left_stem,0);
penpos3(alpha*right_stem,0); penpos4(alpha*right_stem,0);
Delta_x = hround(alpha*(interspace+.5left_stem));
z0=whatever[z.D1r,z.D2r]=whatever[z3l,z4l];
if y0>notch_cut: y0:=notch_cut;
  fill z0+.5right{up}...{z4-z3}diag_end(3l,4l,1,1,4r,3r)
    --diag_end(4r,3r,1,1,D2l,D1l)--diag_end(D2l,D1l,1,1,D1r,D2r){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,D2l,D1l)
    --diag_end(D2l,D1l,1,1,D1r,0)--cycle; fi % left and right diagonals
fill diag_end(G2l,G1l,1,1,G1r,G2r)--diag_end(G1r,G2r,1,1,G2l,G1l)--cycle;
if serifs: numeric inner_jut; pickup tiny.nib;
 prime_points_inside(1,2); prime_points_inside(4,3);
 prime_points_inside(2,1); pen_duplicate(1',2');
 if rt x.D1'r+jut+.5u+1<=lft x4'l-jut: inner_jut=jut;
 else: rt x.D1'r+inner_jut+.5u+1=lft x4'l-inner_jut; fi
 dish_biserif(1',2,a,1/3,outer_jut,ab,1/3,b,1/2,inner_jut);  % left serif
 mid_biserif(2',1,ab',1/3);  % lower terminal
 dish_serif(4',3,c,.6,inner_jut,d,1/2,outer_jut)(dark);  % right serif
else: mid_biserif(1,2,ab,1/3);  % upper terminal
 mid_biserif(2,1,ab',1/3); fi  % lower terminal
penlabels(0,G1,D1,G2,D2,3,4); endchar;

cmchar "The letter w";
beginchar("w",13u#,x_height#,0);
italcorr x_height#*slant+.25u#;
adjust_fit(serif_fit#,serif_fit#);
numeric stem[],outer_jut,upper_notch,alpha,mid_corr;
outer_jut=.7jut; x.G1l=w-x8r=l+letter_fit+outer_jut+.25u;
stem1=fudged.stem-stem_corr;
stem4=min(fudged.hair if hefty:-2stem_corr fi,stem1);
stem2=if hefty:.1[vair,stem4] else: stem4 fi;
stem3=max(stem2,stem1-3stem_corr);
pen_duplicate(1,2);
x2-x1=x4-x3=x6-x5=x8-x7; x.D2r=x3r; x6l+apex_corr=x7l;
y1=y8=h; y2=y3=y6=y7=-apex_oo;
y4=y5=if monospace: vround .6 fi\\ h; upper_notch=y4-notch_cut;
mid_corr=if monospace or hefty:-.3apex_corr else: .5jut fi;
alpha=diag_ratio(4,stem2-stem3+stem4,y1-y2,x8r-x.G1l+mid_corr-2apex_corr+interspace);
penpos1(alpha*.5stem1,0); penpos2(alpha*.5stem1,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);
Delta_x = hround(alpha*(interspace+.5stem1));
x4l-x1l=floor(x4l-x1l+.5(x5r+mid_corr-x4r)); % |x5r| $\approx$ |x4r+mid_corr|
z23=whatever[z.D1r,z.D2r]=whatever[z3l,z4l];
z45=whatever[z3r,z4r]=whatever[z5l,z6l];
z67=whatever[z5r,z6r]=whatever[z7l,z8l];
fill diag_end(D1l,D2l,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>notch_cut:(x67,notch_cut)+.5right{down}
   --(x67,notch_cut)+.5left{up} else: z67&z67 fi
 ...{z5-z6}special_diag_end(6,5,4,3){z3-z4}
 ...if y23>notch_cut:(x23,notch_cut)+.5right{down}
   --(x23,notch_cut)+.5left{up} else: z23&z23 fi
 ...{z1-z2}diag_end(D2r,D1r,1,1,D1l,D2l)--cycle;  % diagonals
fill diag_end(G2r,G1r,1,1,G1l,G2l)--diag_end(G1l,G2l,1,1,G2r,G1r)--cycle;
if serifs: numeric inner_jut[]; pickup tiny.nib;
 prime_points_inside(1,2); prime_points_inside(5,6); prime_points_inside(8,7);
 prime_points_inside(2,1); pen_duplicate(1',2');
 if monospace: inner_jut1=inner_jut4=1.5jut;
 elseif hefty: inner_jut1=inner_jut4=jut;
 else: fill diag_end(6r,5r,1,1,5l,6l)--.9[z5l,z6l]
   ..{z5-z6}.1[z5r,z6r]--cycle; % middle stem
  inner_jut2=.7inner_jut1; inner_jut4=1.1inner_jut3;
  if rt x1'r+jut+.5u+1<=lft x5'l-.7jut: inner_jut1=jut;
  else: rt x1'r+inner_jut1+.5u+1=lft x5'l-inner_jut2; fi
  if rt x5'r+jut+.5u+1<=lft x8'l-1.1jut: inner_jut3=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_biserif(1',2,a,1/3,outer_jut,ab,1/3,b,1/2,inner_jut1);  % left serif
 mid_biserif(2',1,ab',1/3);  % lower left terminal
 dish_serif(8',7,c,.6,inner_jut4,d,1/2,outer_jut)(dark);  % right serif
else: mid_biserif(1,2,ab,1/3);  % upper terminal
 mid_biserif(2,1,ab',1/3); fi  % lower terminal
penlabels(0,G1,D1,G2,D2,3,4,5,6,7,8,23,45,67); endchar;

cmchar "The letter x";
beginchar("x",if serifs:9.5u# else:9u# fi,x_height#,0);
italcorr x_height#*slant-.05u#;
adjust_fit(serif_fit# if monospace:+\\.5u#,.5u#+ else:,fi\\ serif_fit#);
numeric stem[],outer_jut,xjut,alpha[];
stem1=fudged.stem-4stem_corr; stem2=min(fudged.hair,stem1);
outer_jut=.75jut; xjut= if serifs: (stem1-stem2)/4 else: 0 fi;
pen_duplicate(1,4);
x.G1l=l+letter_fit+.1u+outer_jut; x2r=r-letter_fit-.3u-outer_jut-xjut;
x3l=l+letter_fit+outer_jut+xjut; x.D4r=r-letter_fit-outer_jut;
y1=y2=h; y3=y4=0;
alpha1=diag_ratio(1,stem1,h,x.D4r-x.G1l);
alpha2=diag_ratio(1,stem2,h,x2r-x3l);
penpos1(alpha1*.5stem1,0); penpos2(alpha2*stem2,0);
penpos3(alpha2*stem2,0); penpos4(alpha1*.5stem1,0);
Delta_x = hround(alpha1*(interspace+.5stem1));
if hefty:
 z12=whatever[z2l,z3l]=whatever[z.D1r,z.D4r];
 z13=whatever[z2l,z3l]=whatever[z.G1l,z.G4l];
 z24=whatever[z2r,z3r]=whatever[z.D1r,z.D4r];
 z34=whatever[z2r,z3r]=whatever[z.G1l,z.G4l];
 fill diag_end(12,D1r,.5,1,D1l,D4l)--diag_end(D1l,D4l,.5,1,D4r,24)--z24
  --diag_end(24,2r,1,.5,2l,12)--z12--cycle; % upper diagonals
 fill diag_end(34,G4l,.5,1,G4r,G1r)--diag_end(G4r,G1r,.5,1,G1l,13)--z13
  --diag_end(13,3l,1,.5,3r,34)--z34--cycle; % lower diagonals
else: forsuffixes e=l,r: forsuffixes $=G,D:
  z$0e = whatever[z2e,z3e] = whatever[z$1,z$4]; endfor endfor
 fill diag_end(D4r,D1r,.5,1,D1l,D4l)
  --diag_end(D1l,D4l,.5,1,D4r,D1r)--cycle; % upper left diagonal
 fill diag_end(G4r,G1r,.5,1,G1l,G4l)
  --diag_end(G1l,G4l,.5,1,G4r,G1r)--cycle; % lower left diagonal
 fill z.D0l--z.D0r--diag_end(D0r,2r,.5,1,2l,D0l)--cycle;  % upper right diagonal
 fill diag_end(G0l,3l,.5,1,3r,G0r)--z.G0r--z.G0l--cycle; fi  % lower 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);
 pen_duplicate(1',4');
 if rt x.D1'r+jut+.5u+1<=lft x2'l-jut-xjut: inner_jut1=jut;
 else: rt x.D1'r+inner_jut1+.5u+1=lft x2'l-inner_jut1-xjut; fi
 if rt x3'r+jut+.5u+1<=lft x.G4'l-jut-xjut: inner_jut2=jut;
 else: rt x3'r+inner_jut2+.5u+1=lft x.G4'l-inner_jut2-xjut; fi
 dish_biserif(1',4,a,1/3,outer_jut,ab,1/2,b,2/3,inner_jut1);  % upper left serif
 dish_biserif(4',1,c,2/3,inner_jut2,cd,1/2,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);  % lower left serif
else: mid_biserif(1,4,ab,1/2);  % upper left terminal
 mid_biserif(4,1,cd,1/2); fi  % lower right terminal
penlabels(0,G0,D0,G1,D1,2,3,G4,D4,12,13,24,34); endchar;

cmchar "The letter y";
beginchar("y",if serifs:9.5u# else:9u# fi,x_height#,desc_depth#);
italcorr x_height#*slant+.25u#;
adjust_fit(serif_fit# if monospace:+\\.5u#,.5u#+ else:,fi\\ serif_fit#);
numeric left_stem,right_stem,bot_stem,bot_vair,outer_jut;
left_stem=fudged.stem-stem_corr;
right_stem=fudged.hair if hefty:-2stem_corr fi;
bot_stem=fudged.hair if hefty:-8stem_corr fi;
bot_vair=Vround(if serifs: vair else:.5[vair,bot_stem] fi);
outer_jut=.75jut;
pen_duplicate(1,2);
x.G1l=w-x4r=l+letter_fit+outer_jut+.25u; y1=y4r=h; y2=y3=0; x.G2l=x3l;
numeric alpha,alpha[]; x9=3u; y9=bot_vair-d-oo;
alpha1=diag_ratio(2,bot_stem,y1-y3,x4r-x.G1l-apex_corr-interspace);
alpha2=diag_ratio(1,bot_stem,y1-y9,x4r-x9);
if alpha1<alpha2: x2l-x1l=x4r-x3r+apex_corr; alpha=alpha1;
else: alpha=alpha2; z3l=whatever[z9,z4r-(alpha*bot_stem,0)]; fi
penpos3(alpha*bot_stem,0); penpos4(alpha*right_stem,0);
alpha3=(y1++(x2l-x1l))/y1;
penpos1(alpha3*.5left_stem,0); penpos2(alpha3*.5left_stem,0);
Delta_x = hround(alpha3*(interspace+.5left_stem));
 z.D0r=whatever[z.D1r,z.D2r]=z4l+whatever*(z3r-z4r);
 z.G0l=z.G2l;%=z3l
 z.G0r=whatever[z.G1r,z.G2r]=whatever[z.G0l,z.D0r];
 z.D0l=whatever[z.D1l,z.D2l]=whatever[z.G0l,z.D0r];
if y.G0r>notch_cut: y0:=notch_cut;
 %y.G0l:=y.G0l-0/3*(y.G0r-y0);
  y.G0r:=y.G0r-1/3*(y.G0r-y0);
 %y.D0l:=y.D0l-0/3*(y.G0r-y0);
  y.D0r:=y.D0r-1/3*(y.G0r-y0);
  fill z.D0r+.5right{up}...{z4r-z3r}diag_end(D0r,4l,1,1,4r,3r)
    --z3r--z.G0l--diag_end(G0l,G1l,1,1,G1r,G0r){z2-z1}
    ...{down}z.G0r--z.D0l--diag_end(D0l,D1l,1,1,D1r,D0r){z2-z1}
    ...{down}z.D0r+.5left--cycle; % left and right diagonals
else: fill z.D0r--diag_end(D0r,4l,1,1,4r,3r)--z3r--z.G0l
    --diag_end(G0l,G1l,1,1,G1r,G0r)--z.G0r--z.D0l
    --diag_end(D0l,D1l,1,1,D1r,D0l)--cycle; fi % left and right diagonals
penpos5(alpha*bot_stem,0); z5r=whatever[z3r,z4r]; y5-.5vair=-.5d;
if serifs: numeric light_bulb; light_bulb=hround 7/8[hair,flare]; clearpen;
 penpos6(vair,-90); penpos7(hair,-180); penpos8(light_bulb,-180);
 x6=2u; y6r=-d-oo; y8-.5light_bulb=-.85d; x8r=hround .35u;
 fill stroke z3e---z5e...{left}z6e; bulb(6,7,8);  % arc and bulb
 numeric inner_jut; pickup tiny.nib;
 prime_points_inside(1,2); prime_points_inside(4,3);
 pen_duplicate(1');
 if rt x1'r+jut+.5u+1<=lft x4'l-jut: inner_jut=jut;
 else: rt x1'r+inner_jut+.5u+1=lft x4'l-inner_jut; fi
 dish_biserif(1',2,a,1/3,outer_jut,ab,1/3,b,1/2,inner_jut);  % left serif
 dish_serif(4',3,c,.6,inner_jut,d,1/2,outer_jut)(dark);  % right serif
else: penpos6(bot_vair,-90); x6=2.5u; y6r=-d-oo;
 fill stroke z3e---z5e...{left}z6e;  % arc
 pickup fine.nib; pos6'(bot_vair,-90); z6'=z6;
 pos7(2/3[bot_vair,flare],-85);
 lft x7l=hround u; bot y7r=vround-.96d-oo; y7l:=good.y y7l;
 filldraw stroke term.e(6',7,left,1,4); % arc and terminal
 mid_biserif(1,2,ab,1/3); fi  % left terminal
penlabels(G0,D0,G1,D1,G2,D2,3,4,5,6,7,8,9); endchar;

cmchar "The letter z";
beginchar("z",8u#,x_height#,0);
italcorr x_height#*slant-.5serif_fit#-.3u#;
adjust_fit(0,.5serif_fit#);
numeric arm_thickness[],z_stem;
if hefty: arm_thickness1=Vround(vair-vair_corr); arm_thickness2=vair;
 z_stem=max(.6[vair,.5stem],tiny+eps);
else: arm_thickness1=vair; arm_thickness2=vair';
 z_stem=max(.9[vair,.5stem],tiny+eps); fi
pen_duplicate(1,2,3,4);
pickup tiny.nib; rt x.D1r=rt x.D2r=hround(w-.8u); lft x.G3l=lft x.G4l=hround .5u;
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+interspace-tiny,y2-y3,x.D2r-x.G3l-slant*(y2-y3));
penpos1(alpha*(z_stem-tiny),0); penpos2(alpha*(z_stem-tiny),0);
penpos3(alpha*(z_stem-tiny),0); penpos4(alpha*(z_stem-tiny),0);
Delta_x = hround(alpha*(interspace+z_stem));
pair delta; delta=penoffset z3-z2 of currentpen;
double
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;  % double diagonal
pickup crisp.nib; pos5(arm_thickness1,90); pos6(hair,180);
top y5r=h; x5=x.D1; lft x6r=hround .75u; y6=good.y(y5l-beak/1.4)-eps;
arm(5,6,a,beak_darkness,-.4beak_jut);  % upper arm and beak
pos7(arm_thickness2,-90); pos8(hair,0);
bot y7r=0; x7=x.G4; rt x8r=hround(w-.75u); y8=good.y(y7l+beak/1.2)+eps;
arm(7,8,b,beak_darkness,.6beak_jut);  % lower arm and beak
penlabels(G1,D1,G2,D2,G3,D3,G4,D4,5,6,7,8); endchar;
