% Actual phonetic character codes.  Created by Emma Pease, CSLI,
% Stanford University.  Based for the most part on computer modern characters

cmchar "Reverse Cedilla accent";
beginchar(oct"011",8u#,0,.875desc_depth#);
adjust_fit(0,0);
x1=.5w+.5u;
if serifs: pickup crisp.nib; pos1(stem,0); pos2(stem,0);
 pos3(vair,90); pos4(stem,180); pos5(vair,-90);
 x1=x2; z3l=z2r; x4=x2-1.5u; x5=x3+1.5u;
 bot y1=-o; bot y2=-vround 2/7d-o; y4=.5[y3,y5]; bot y5=-d-o;
 filldraw stroke z1e--z2e;  % stem
 filldraw stroke z3e{left}...z4e{down}...{right}z5e;  % hook
else: pickup fine.nib; pos1(vair,0); top y1=-o-2;
 pos2(.5[vair,stem],0); bot y2=-d-o; x2=x1+1.25u;
 filldraw stroke z1e--z2e; fi  % diagonal
penlabels(1,2,3,4,5); endchar;

cmchar "The letter phonetic a";
beginchar("a",10u#+serif_fit#,x_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+oo;
numeric edge; edge=lft x2l;
pickup fine.nib; pos3(if hefty:thin_join else: hair fi,0);
pos4(vair,90); pos5(curve,180);
pos6(vair,270); penpos7(x3r-x3l,360);
lft x3l=1/3[lft x2,edge]; y3=1/8[bar_height,x_height];
x4l=.5(w-serif_fit)-.3u; top y4r=x_height+oo;
lft x5r=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[x5r,x4]);
(x',y6r)=whatever[z7l,z6l]; x6r:=max(x',.5[x5r,x6]);
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}...{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.r(2,0,b,1/3,jut,min(oo,serif_drop)); fi  % lower serif
penlabels(0,1,2,3,4,5,6,7); endchar;

cmchar "The letter rotated phonetic a";
beginchar("A",10u#+serif_fit#,x_height#,0);
italcorr .5x_height#*slant+min(.5curve#-u#,-.25u#);
adjust_fit(serif_fit#,0);
pickup tiny.nib; pos1(stem',0); pos2(stem,0);
pos0'(stem',0); pos0(stem,0); z0l=z0'l; x0'=x1; x0=x2;
lft x1l=hround(2.5u-.5stem'); top y1=h+min(oo,serif_drop);
numeric edge; edge=rt x2r;
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 x2l),1/3[rt x2,edge]);
y3=1/8[bar_height,x_height];
x4l=w-.5(w-serif_fit)+.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; filldraw stroke z1e--z0'e--z0e--z2e;  % 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_serif.l(1,0',a,1/3,jut,serif_drop); fi  % upper serif
penlabels(0,1,2,3,4,5,6,7,8); endchar;

cmchar "The letter voiced implosive b";
beginchar("b",10u#+serif_fit#,asc_height#,0);
italcorr .5x_height#*slant+min(.5curve#-u#,-.25u#);
adjust_fit(serif_fit#,0);
pickup tiny.nib; pos1(stem',0); pos2(stem,0);
pos0'(stem',0); pos0(stem,0); z0l=z0'l; x0'=x1; x0=x2;
lft x1l=hround(2.5u-.5stem'); top y1=.25[x_height,h];
numeric edge; edge=rt x2r;
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 x2l),1/3[rt x2,edge]);
y3=1/8[bar_height,x_height];
x4l=w-.5(w-serif_fit)+.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; filldraw stroke z1e--z0'e--z0e--z2e;  % 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: pickup tiny.nib;
 pos9(vair,-270); pos9'(vair,-90);z9=z9';x9=.5[x1,x10]; top y9r=h;
 pos10(hair,-360); rt x10r=w- hround u; y10=.75[x_height,h]-.5flare;
 pos11(flare,-360); %z11l=z10l;
 bulb(9,10,11); filldraw stroke super_arc.e(1,9');  % tail
else: pickup fine.nib; pos1'(stem,0); z1'=z1;
 z1''r=z1'r; z1''=z1'; z1''l=(x1'l,0);
 pos9(vair,-90); x9=4.5u; top y9l=h;
 pos10(.5[vair,flare],90); rt x10=hround 1.25u;
 y10r=good.y 5/6[x_height,h]; y10l:=good.y y10l;
 filldraw stroke z1'e..z1''e&super_arc.e(1'',9)
  & term.e(9,10,left,.9,4); fi  % tail
penlabels(0,1,2,3,4,5,6,7,8,9,10,11); endchar;

cmchar "The letter variant open o";
beginchar("C",8u#,x_height#,0);
italcorr x_height#*slant-.2u#;
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
pickup fine.nib; pos2(vair',90); pos4(vair',270);
x2=x4=.5(w+u); top y2r=vround(h+1.5oo); bot y4r=-oo;
pos3(curve,180); lft x3r=hround max(.6u,1.35u-.5curve); y3=.5h;
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:=x;
filldraw stroke pulled_super_arc.e(2,3)(.7superpull)
  & pulled_super_arc.e(3,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;
filldraw stroke pulled_super_arc.e(2,3)(.7superpull)
  & pulled_super_arc.e(3,4)(.5superpull)
  ..tension .9 and 1..z5e; fi  % arc and lower terminal
  currentpicture:=currentpicture rotatedaround ((.5w,.5h),180);
penlabels(0,1,2,3,4,5); endchar;

cmchar "The letter open o";
beginchar("c",8u#,x_height#,0);
italcorr x_height#*slant-.2u#;
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
pickup fine.nib; pos2(vair',90); pos4(vair',270);
x2=x4=.5(w-u); top y2r=vround(h+1.5oo); bot y4r=-oo;
pos3(curve,0); rt x3r=hround min(w-.6u,w-1.35u+.5curve); y3=.5h;
if serifs: pos1(hair,180); pos0(flare,180);
 y1=min(bar_height+.5flare+2vair'+2,.9[bar_height,h]-.5flare);
 lft x1r=hround(.7u); bulb(2,1,0);  % bulb
 pos5(hair,180); lft x5r=hround(.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,3)(.7superpull)
  & pulled_super_arc.e(3,4)(.5superpull)
  ..tension .9 and 1..{x5-x4,5(y5-y4)}z5e;  % arc and lower terminal
else: pos1(4/7[vair',flare],80);
 lft x1r=hround(.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); lft x5r=hround(.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{left}..tension .9 and 1..z5e;
  if angle direction 1 of p.e>75:
   p.e:=z4e{left}..tension atleast.9 and 1..{dir 75}z5e; fi endfor
filldraw stroke pulled_super_arc.e(2,3)(.7superpull)
  & pulled_super_arc.e(3,4)(.5superpull)
  & p.e; fi  % arc and lower terminal
penlabels(0,1,2,3,4,5); endchar;

cmchar "The letter glottal d";
beginchar("D",10.5u#+serif_fit#,asc_height#,0);
italcorr asc_height#*slant-serif_fit#+.5stem#-2u#;
adjust_fit(0,serif_fit#);
pickup tiny.nib; 
pos2(stem,0);
lft x2l=w-hround(3u+.5stem');
pickup fine.nib; numeric bulb_diam;
if serifs: bulb_diam=hround .8[stem,flare];
pos8(bulb_diam,0); y8+.5bulb_diam=.9[x_height,h+oo];
if monospace: rt x8r=hround(w-.5u)+1 else: lft x8l=hround(w-.75u+.5)
fi;
else: pos8(5/7[vair,flare],90); top y8r=h;
rt x8=hround(if monospace:w-.5u else:w+.75u fi); fi;
 pickup tiny.nib; bot y2=-oo;
 penpos a0(x2r-x2l,0); x.a0l=x2l; top y.a0=x_height;
 filldraw stroke z2e--z.a0e;  % stem
 pickup fine.nib; pos a0'(x2r-x2l-(hround stem_corr)+tiny,180);
 y.a0'=y.a0; lft x.a0'r=tiny.lft x2l;
 penpos a1(x.a0'l-x.a0'r,180); x.a1=x.a0'; y.a1+.5vair=.5[x_height,h];
 pos a2(vair,90); top y.a2r=h+oo;
 if serifs: x.a2=.6[x.a1,x8r]; (x.a,y.a2r)=whatever[z.a2l,z.a1l];
  x.a2r:=min(x.a,.5[x.a2,x8r]); pos a3(hair,0); bulb(a2,a3,8);  % bulb
  filldraw stroke z.a0'e--z.a1e & super_arc.e(a1,a2);  % arc
  sloped_serif.r(2,a0,b,1/3,jut,min(oo,serif_drop)); % lower serif
 else: x.a2=.6[x.a1,x8]; y.a1l:=1/3[y.a1l,y.a2l];
  filldraw stroke z.a0'e--z.a1e & super_arc.e(a1,a2)
   & term.e(a2,8,right,.9,4); fi  % arc and terminal
numeric edge; edge=lft x2l;
pickup fine.nib; pos3(if hefty:thin_join else: hair fi,0);
pos4(vair,90); pos5(curve,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-.5u)-.3u; top y4r=x_height+oo;
lft x5r=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[x5r,x4]);
(x',y6r)=whatever[z7l,z6l]; x6r:=max(x',.5[x5r,x6]);
filldraw stroke z3e{up}...pulled_arc.e(4,5)
 & pulled_arc.e(5,6)...{up}z7e; % bowl
penlabels(a1,a2,2,3,4,5,6,7,8,a0); endchar;

cmchar "The letter eth";
beginchar("d",9u#,asc_height#,0);
italcorr .7x_height#*slant;
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
penpos1(vair,90); penpos3(vair',-90);
penpos2(curve,180); penpos4(curve,0);
x2r=hround max(.5u,1.25u-.5curve);
x4r=w-x2r; x1=x3=.5w; y1r=x_height;  % +vround 1.5oo; 
y3r=-oo;
y2=y4=.5x_height-vair_corr; y2l:=y4l:=.52x_height;
penstroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & pulled_arc.e(3,4) & pulled_arc.e(4,1) & cycle;  % bowl
penpos5(hair/(sind 45),45); penpos4'(stem,0);
x4r=x4'r; y4=y4';
top y5r=h+oo; x5=x2;
penstroke pulled_arc.e(4',5);
penpos6(bar+stem_corr,120); penpos7(bar+stem_corr,120);
y6=.35[y1,y5]; y7r=h+oo;
x7r=rt x4; x6l=rt x2l;
filldraw stroke z6e--z7e;
penlabels(1,2,3,4,5,6,7); endchar;

cmchar "The letter schwa";
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 left_curve<tiny.breadth: left_curve:=tiny.breadth; fi
pickup tiny.nib; pos1(right_curve,180);
pos2(vair,-90); pos3(left_curve,0);
y1=good.y (h-bar_height); bot y2r=-vround 1.5oo; y0l=top y1;
lft x1r=hround min(.5u,u-.5right_curve);
rt x3r=hround max(w-.5u,w-1.25u+.5left_curve); x2=.5w-.25u;
{{interim superness:=more_super;
 filldraw stroke super_arc.e(1,2)}};  % right bowl
y3=.5[y2,y4]; top y4r=h+oo; x4=x2+.25u;
if serifs: pos4(vair',90); pos5(hair,180);
 y5=min(good.y(h-.5(h-bar_height)+.9),y4l-vair); x5r=x1r;
 (x,y4l)=whatever[z4r,z5]; x4l:=min(x,x4l-.5u);
 filldraw stroke pulled_arc.e(2,3) & pulled_arc.e(3,4)
  ...{x5-x4,5(y5-y4)}z5e; % left bowl, arc, and terminal
else: pos4(vair,270);
 filldraw stroke super_arc.e(2,3) & super_arc.e(3,4);  % left bowl and arc
 pickup fine.nib; pos4'(vair,90); z4=z4';
 pos5(.5[vair,flare],275); rt x5r=hround(.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
path testpath; testpath=super_arc.r(2,3) & super_arc.r(3,4);
y1'r=y0r=y0l-.6[thin_join,vair]; y1'l=y0l; x1'l=x1'r=x1;
forsuffixes $=l,r:
 x0$=xpart(((w,y0$)--(x1,y0$)) intersectionpoint testpath); endfor
fill stroke z0e--z1'e;  % crossbar
penlabels(0,1,1',2,3,4,5); endchar;

cmchar "The letter variant schwa";
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 left_curve<tiny.breadth: left_curve:=tiny.breadth; fi
pickup tiny.nib; pos1(right_curve,0);
pos2(vair,90); pos3(left_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 x3r=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;
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:=x;
 filldraw stroke pulled_arc.e(2,3) & pulled_arc.e(3,4)
  ...{x5-x4,5(y5-y4)}z5e; % left bowl, arc, and terminal
else: pos4(vair,270);
 filldraw stroke super_arc.e(2,3) & super_arc.e(3,4);  % left bowl and arc
 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
path testpath; testpath=super_arc.r(2,3) & super_arc.r(3,4);
y1'r=y0r=y0l+.6[thin_join,vair]; y1'l=y0l; x1'l=x1'r=x1;
forsuffixes $=l,r:
 x0$=xpart(((0,y0$)--(x1,y0$)) intersectionpoint testpath); endfor
fill stroke z0e--z1'e;  % crossbar
  currentpicture:=currentpicture rotatedaround ((.5w,.5h),180);
penlabels(0,1,2,3,4,5); endchar;




cmchar "The letter flap";
numeric r_flare#; r_flare#=.75[if serifs: stem# else: vair# fi,flare#];
define_whole_blacker_pixels(r_flare);
beginchar("f",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
pos0'(hround(stem-3stem_corr),180); 
rt x0'l=hround(2.5u-.5stem')+stem'; top y0'=bar_height;
filldraw stroke z0'e{up}...{right}z4e;  % arc
pickup tiny.nib; pos0(stem',0); pos2(stem',0);
pos1(hround(stem-3stem_corr),0); top y1=h+min(oo,serif_drop);
%pos0'(hround(stem-3stem_corr),0); 
y0=y0'; x1l=x0l=x2l;
lft x1l=hround(2.5u-.5stem'); bot y2=0;
filldraw stroke z0e--z2e;  % stem
if serifs: dish_serif(2,0,b,1/3,jut,c,1/3,1.25jut); fi  % lower serif
penlabels(1,2,0',4,5,6); endchar;

cmchar "rotated Variant letter g";
beginchar("g",10u#+serif_fit#,x_height#+desc_depth#,0);
h:=vround(x_height#*hppp); d:=vround(desc_depth#*hppp); % vertical adj.
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);
pickup fine.nib; pos3(if hefty:thin_join else: hair fi,0);
pos4(vair,90); pos5(curve,180);
pos6(vair,270); penpos7(x3r-x3l,360);
lft x3l=2/3[lft x2,edge]; y3=bar_height;
x4l=.5(w-serif_fit)-.3u; top y4r=x_height+oo;
lft x5r=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[x5r,x4]);
(x',y6r)=whatever[z7l,z6l]; x6r:=max(x',.5[x5r,x6]);
filldraw stroke z3e{up}...{left}z4e&super_arc.e(4,5)
 &super_arc.e(5,6)&z6e{right}...{up}z7e;  % bowl
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
  currentpicture:=currentpicture rotatedaround ((.5w,.5h),180);
penlabels(0,1,2,3,4,5,6,7,8,9,10,11); endchar;

cmchar "Variant letter g";
beginchar("G",10u#+serif_fit#,x_height#,desc_depth#);
h:=vround(x_height#*hppp); d:=vround(desc_depth#*hppp); % vertical adj.
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);
pickup fine.nib; pos3(if hefty:thin_join else: hair fi,0);
pos4(vair,90); pos5(curve,180);
pos6(vair,270); penpos7(x3r-x3l,360);
lft x3l=2/3[lft x2,edge]; y3=bar_height;
x4l=.5(w-serif_fit)-.3u; top y4r=x_height+oo;
lft x5r=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[x5r,x4]);
(x',y6r)=whatever[z7l,z6l]; x6r:=max(x',.5[x5r,x6]);
filldraw stroke z3e{up}...{left}z4e&super_arc.e(4,5)
 &super_arc.e(5,6)&z6e{right}...{up}z7e;  % bowl
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,5,6,7,8,9,10,11); endchar;

cmchar "The letter voiced 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#);
pickup tiny.nib; pos1(stem,0); pos2(stem,0);
pos1'(stem',0); pos2'(stem',0); pos3(stem,0);
lft x1l=hround(2.5u-.5stem); x1l=x1'l=x2l=x2'l; x3=w-x1;
top y1=.25[x_height,h]; bot y2=0; y1=y1'; y2=y2';
filldraw stroke z1'e--z2'e;  % left stem
h_stroke(2,a,3,4);  % arch and right stem
if serifs: pickup tiny.nib;
 pos9(vair,-270); pos9'(vair,-90);z9=z9';x9=.5[x1,x10]; top y9r=h;
 pos10(hair,-360); 
 rt x10r=min(w- hround u,rt x3r); 
 y10=.75[x_height,h]-.5flare;
 pos11(flare,-360); %z11l=z10l;
 bulb(9,10,11); filldraw stroke super_arc.e(1,9');  % tail
else: pickup fine.nib; pos1'(stem,0); z1'=z1;
 z1''r=z1'r; z1''=z1'; z1''l=(x1'l,0);
 pos9(vair,-270); x9=4.5u; top y9r=h;
 pos10(.5[vair,flare],90); rt x10=hround 1.25u;
 y10r=good.y 5/6[x_height,h]; y10l:=good.y y10l;
 filldraw stroke z1'e..z1''e&super_arc.e(1'',9)
  & term.e(9,10,left,.9,4); fi  % tail
if serifs: 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_serif(2,1,c,1/3,jut,d,1/3,jut); % lower left serif
 dish_serif(4,3,e,1/3,inner_jut,f,1/3,jut); fi % lower right serif
penlabels(1,2,3,4,9,10,11); endchar;

cmchar "letter variant i";
beginchar("i",4u#,x_height#,0); l_width#:=4u#;
italcorr max(1/3x_height#*slant+.5hair#+.5u#,
 x_height#*slant+.5stem#-2u#) if math_fitting:+.5u# fi;
adjust_fit(if monospace:u#,u# else: u#,u# fi); pickup fine.nib;
x2-.5stem=hround(1.5u-.5stem); x4=w; hook_out(2,3,4);  % closing hook
pickup tiny.nib; pos1(stem,0); pos2'(stem,0); z2'=z2;
top y1=h; x1=x2; filldraw stroke z1e--z2e;  % stem
sloped_serif.l(1,2,a,1/3,jut,serif_drop);  % serif
math_fit(-.5u#,1/3x_height#*slant+.5hair#+u#); penlabels(1,2,3,4); endchar;

cmchar "The letter dj";
beginchar("J",10.5u#,asc_height#,desc_depth#);
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-3u+.5stem'+serif_fit); top y1=h;
numeric edge; edge=lft x2l;
pickup fine.nib; pos3(if hefty:thin_join else: hair fi,0);
pos4(vair,90); pos5(curve,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-.5u)-.3u; top y4r=x_height+oo;
lft x5r=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[x5r,x4]);
(x',y6r)=whatever[z7l,z6l]; x6r:=max(x',.5[x5r,x6]);
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}...{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
 pickup tiny.nib; pos2'(stem',-180); z2'=z2;
 pos8(vair,-90); pos9(hair,0); pos10(flare,0);
 x8=.5[x2',x9r]; bot y8r=-d-oo; y9-.5flare=-.88d;
 if monospace: rt x9r = w else: z9r=z10r; lft x10l= w-floor .75u fi;
 (xc,y8r)=whatever[z8l,z2'l]; x8r:=min(xc,.5[x9r,x8]);
 filldraw stroke z2'e{down}...z8e{right}; bulb(8,9,10); % arc and bulb
else: pickup fine.nib; pos2'(stem',180); z2'=z2;
 pos9(.2[vair,stem'],-90); pos10(vair,-90);
 rt x10r=w-(hround.75u); bot y10r=vround 5/6(-d-oo);
 (x,y10l)=whatever[z10r,z2]; x7l:=x;
 z8l=z2'l; (x2'r,y8r)=whatever[z10r,z8l]; x8r=x2'r;y8=y8l;
 x9r=.5[x10l,x8l]; x9l:=.5[x10l,x8l]; bot y9r=-d-oo;
 filldraw stroke z2'e..{down}z5e & super_arc.e(8,9)
  & z9e{right}..z10e; fi % arc and terminal
penlabels(0,1,2',3,4,5,6,7,8,9,10); endchar;


cmchar "Dotless letter j barred";
beginchar("j",5.5u#,x_height#,desc_depth#);
italcorr x_height#*slant-serif_fit#+.5stem#-2u#;
adjust_fit(serif_fit#+2stem_shift# if monospace:+.5u# fi,
 serif_fit#-2stem_shift# if monospace:-.5u# fi);
pickup tiny.nib; pos1(stem',0); pos2(stem',0);
rt x1r=hround(.5w+.25u+.5stem'); x1=x2;
top y1=x_height if serifs: +min(oo,serif_drop) fi; bot y2=-1/3d;
filldraw stroke z1e--z2e;  % stem
if serifs: sloped_serif.l(1,2,a,1/3,1.1jut,serif_drop);  % upper serif
 pickup tiny.nib; pos5(vair,-90); pos6(hair,-180); pos7(flare,-180);
 x5=.5[x2,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,z2l]; x5r:=max(x,.5[x6r,x5]);
 filldraw stroke z2e{down}...z5e{left};  bulb(5,6,7); % arc and bulb
else: pickup fine.nib; pos2'(stem',0); z2'=z2;
 pos6(.2[vair,stem'],-90); pos7(vair,-90);
 lft x7r=hround -.75u; bot y7r=vround 5/6(-d-oo);
 x3r=x1r; top y4r=min(2x_height,h+1);
 (x,y7l)=whatever[z7r,(x1,min(h,asc_height))]; x7l:=x;
 z5r=z2'r; (x2'l,y5l)=whatever[z7l,z5r]; x5l=x2'l; y5=y5r;
 x6r=.5[x7r,x5r]; x6l:=.5[x7l,x5l]; bot y6r=-d-oo;
 filldraw stroke z2'e..{down}z5e & super_arc.e(5,6)
  & term.e(6,7,left,1,4); fi  % arc and terminal
pickup crisp.nib; bot y3r=bot y4r=0; 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(1,2,3,4,5,6,7); endchar;

cmchar "The letter hook 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=max(tiny.breadth,hround(fudged.stem-stem_corr));
stem2=max(tiny.breadth,hround(fudged.stem-2stem_corr));
stem3=max(tiny.breadth,hround(fudged.hair if hefty:-\\4stem_corr fi));
stem4=max(tiny.breadth,hround(fudged.stem-3stem_corr));
if serifs: right_jut=.6jut; else: right_jut=.4tiny; fi
pos1(stem1,0); pos2(stem2,0); top y1=.25[x_height,h]; bot y2=0;
lft x1l=lft x2l=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=x1; 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-x1);
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
pos0(stem1,0); pos0'(stem2,0); y0=y0'; x0=x1; x0'=x2;
rt z0r=whatever[z3,z4]; filldraw stroke z1e..z0e--z0'e..z2e; % 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
 dish_serif(2,0',b,1/3,jut,c,1/3,inner_jut);  % lower stem serif
 dish_serif(3,4,d,2/3,1.4jut,e,1/2,right_jut)(dark); % upperDiagonal serif
 dish_serif(6,5,f,1/2,inner_jut,g,1/3,right_jut)(dark);fi % lowerDiagonal serif
if serifs: pickup tiny.nib;
 pos7(vair,-270); pos7'(vair,-90);z7=z7';x7=.5[x1,x8]; top y7r=h;
 pos8(hair,-360); rt x8r=rt x3r; y8=.75[x_height,h]-.5flare;
 pos9(flare,-360); 
 bulb(7,8,9); filldraw stroke super_arc.e(1,7');  % hook
else: pickup fine.nib; pos1'(stem,0); z1'=z1;
 z1''r=z1'r; z1''=z1'; z1''l=(x1'l,0);
 pos7(vair,-90); x7=4.5u; top y7l=h;
 pos8(.5[vair,flare],90); rt x8=hround 1.25u;
 y8r=good.y 5/6[x_height,h]; y8l:=good.y y8l;
 filldraw stroke z1'e..z1''e&super_arc.e(1'',7)
  & term.e(7,8,left,.9,4); fi  % tail
penlabels(0,1,2,3,4,5,6,7,8,9,11); endchar;

cmchar "The letter rotated 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(mfudged.stem-2stem_corr);
pickup tiny.nib; pos1(mfudged.stem,0); pos2(mfudged.stem,0);
pos1'(shaved_stem,0); pos2'(shaved_stem,0);
pos3(mfudged.stem,0); pos5(mfudged.stem,0);
lft x1l=hround(2.5u-.5stem); x1l=x1'l=x2l=x2'l;
lft x3l=hround(.5w-.5stem); x5-x3=x3-x1;
if not monospace: r:=hround(x5+x1)-l; fi  % change width for better fit
top y1=h+min(oo,serif_drop); bot y2=0; y1=y1'; y2=y2';
filldraw stroke z1'e--z2'e;  % left stem
h_stroke(2,a,3,4);  % left arch and middle stem
h_stroke(4,b,5,6);  % right arch and right stem
if serifs: sloped_serif.l(1',2',c,1/3,jut,serif_drop); % 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_serif(2,1,d,1/3,jut,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); fi % lower right serif
  currentpicture:=currentpicture rotatedaround ((.5w,.5h),180);
penlabels(1,2,3,4,5,6); endchar;

cmchar "The letter emgma";
beginchar("M",15u#,x_height#,desc_depth#);
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(mfudged.stem-2stem_corr);
pickup tiny.nib; pos1(mfudged.stem,0); pos2(mfudged.stem,0);
pos1'(shaved_stem,0); pos2'(shaved_stem,0);
pos3(mfudged.stem,0); pos5(mfudged.stem,0);
lft x1l=hround(2.5u-.5stem); x1l=x1'l=x2l=x2'l;
lft x3l=hround(.5w-.5stem); x5-x3=x3-x1;
if not monospace: r:=hround(x5+x1)-l; fi  % change width for better fit
top y1=h+min(oo,serif_drop); bot y2=0; y1=y1'; y2=y2';
filldraw stroke z1'e--z2'e;  % left stem
h_stroke(2,a,3,4);  % left arch and middle stem
h_stroke(4,b,5,6);  % right arch and right stem
if serifs: sloped_serif.l(1',2',c,1/3,jut,serif_drop); % 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_serif(2,1,d,1/3,jut,e,1/3,jut); % lower left serif
 dish_serif(4,3,f,1/3,inner_jut,g,1/3,jut); % lower middle serif
x10=x6; bot y10=-1/3d; penpos10(x5r-x5l,0);   % stuff added
pickup tiny.nib; filldraw stroke z6e--z10e;  % right stem continuation
pickup tiny.nib; pos7(vair,-90); pos8(hair,-180); pos9(flare,-180);
 x7=.5[x10,x8r]; bot y7r=-d-oo; y8-.5flare=-.88d;
 if monospace: lft x8r=lft x4l; else: z8r=z9r; lft x9r= rt x4r; fi 
 (x,y7r)=whatever[z7l,z10l]; x7r:=max(x,.5[x8r,x7]);
 filldraw stroke z10e{down}...z7e{left};  bulb(7,8,9); fi  % arc and bulb
penlabels(1,2,3,4,5,6,7,8,9,10); endchar;


cmchar "The letter engma";
beginchar("n",10u#,x_height#,desc_depth#);
italcorr .5[bar_height#,x_height#]*slant-serif_fit#+.5stem#-2u#;
adjust_fit(serif_fit#+stem_shift#,serif_fit#-stem_shift#);
pickup tiny.nib; pos1(stem,0); pos2(stem,0);
numeric shaved_stem; shaved_stem=hround(stem-2stem_corr);
pos1'(shaved_stem,0); pos2'(shaved_stem,0); pos3(stem,0);
lft x1l=hround(2.5u-.5stem); x1l=x1'l=x2l=x2'l; x3=w-x1;
top y1=h+min(oo,serif_drop); bot y2=0; y1=y1'; y2=y2';
filldraw stroke z1'e--z2'e;  % left stem
h_stroke(2,a,3,4);  % arch and right stem
if serifs: sloped_serif.l(1',2',b,1/3,jut,serif_drop); % 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_serif(2,1,c,1/3,jut,d,1/3,jut); % lower left serif
% dish_serif(4,3,e,1/3,inner_jut,f,1/3,jut); fi % lower right serif
x8=x4; bot y8=-1/3d; penpos8(x3r-x3l,0);   % stuff added
pickup tiny.nib; filldraw stroke z4e--z8e;  % right stem continuation
pickup tiny.nib; pos5(vair,-90); pos6(hair,-180); pos7(flare,-180);
 x5=.5[x8,x6r]; bot y5r=-d-oo; y6-.5flare=-.88d;
 if monospace: lft x6r=0; else: z6r=z7r; lft x7r= rt x2r; fi 
 (x,y5r)=whatever[z5l,z8l]; x5r:=max(x,.5[x6r,x5]);
 filldraw stroke z8e{down}...z5e{left};  bulb(5,6,7); fi  % arc and bulb
penlabels(1,2,3,4,5,6,7,8); endchar;

cmchar "The letter thorn";
beginchar("p",10u#+serif_fit#,asc_height#,desc_depth#);
italcorr .5x_height#*slant+min(.5curve#-.85u#,-.1u#);
adjust_fit(serif_fit#,0);
pickup tiny.nib; pos1(stem',0); pos2(stem,0);
pos0'(stem',0); pos0(stem,0); z0l=z0'l; x0'=x1; x0=x2;
lft x1l=hround(2.5u-.5stem'); top y1=h if serifs: +min(oo,serif_drop) fi;
numeric edge; edge=rt x2r;
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=1/3[rt x2,edge]; y3=1/8[bar_height,x_height];
x4l=w-.5(w-serif_fit)+.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[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;
filldraw stroke z1e--z0'e--z0e--z2e;  % 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_serif.l(1,0',a,1/3,jut,serif_drop);  % upper serif
 dish_serif(2,0,b,1/3,jut,c,1/3,jut); fi  % lower serif
penlabels(0,1,2,3,4,5,6,7,8); endchar;

cmchar "The letter rotated 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; bot y4r=0-oo;
if serifs: pos4(vair,-90); pos5(hair,180);
 x4=min(1.75u,.25u+r_flare);
 lft x5r=hround(.5u-.5); y5-.5r_flare=h-.9[bar_height,h]-oo;
 pos6(r_flare,180); bulb(4,5,6);  % bulb
else: pos4(r_flare,-90); lft x4=hround(.25u); fi
pos3(thin_join,0); lft x3l=w-hround(2.5u-.5stem')-stem'; bot y3=h-bar_height;
filldraw stroke z3e{down}...{left}z4e;  % arc
pickup tiny.nib; pos0(stem',0); pos2(stem',0);
pos1(hround(stem-3stem_corr),0); bot y1=0-min(oo,serif_drop);
pos0'(hround(stem-3stem_corr),0); y0=y0'=y3; x1r=x0r=x0'r=x2r;
rt x1r=w-hround(2.5u-.5stem');  top y2=h;
filldraw stroke z1e--z0'e--z0e--z2e;  % stem
if serifs: sloped_serif.r(1,0',a,1/3,jut,serif_drop);  % lower serif
sloped_serif.l(2,0,b,1/3,jut,serif_drop); fi  % upper serif
% dish_serif(2,0,b,1/3,1.25jut,c,1/3,jut); fi  % upper serif
penlabels(0,1,2,3,4,5,6); endchar;

cmchar "The letter esh";
numeric dot_diam#; dot_diam#=max(dot_size#,cap_curve#);
beginchar("s",5.5u#,asc_height#,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);
numeric shaved_stem; shaved_stem=hround(stem-2stem_corr);
pickup tiny.nib; pos0(stem',0); pos1(shaved_stem,0);
x0=x1;
x1=.5w;
top y0=x_height if serifs: +min(oo,serif_drop) fi; 
bot y1=-1/3d;
pickup fine.nib; numeric bulb_diam;
if serifs: 
 pickup tiny.nib; pos5(vair,-90); pos6(hair,-180); pos7(flare,-180);
 x5=.5[x1,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,z1l]; x5r:=max(x,.5[x6r,x5]);
 filldraw stroke z1e{down}...z5e{left};  bulb(5,6,7); % lower arc and bulb
 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: pickup fine.nib; pos1'(stem',0); z1'=z1;
 pos6(.2[vair,stem'],-90); pos7(vair,-90);
 lft x7r=hround -.75u; bot y7r=vround 5/6(-d-oo);
 (x,y7l)=whatever[z7r,z3]; x7l:=x;
 z5r=z1'r; (x1'l,y5l)=whatever[z7l,z5r]; x5l=x1'l; y5=y5r;
 x6r=.5[x7r,x5r]; x6l:=.5[x7l,x5l]; bot y6r=-d-oo;
 filldraw stroke z1'e..{down}z5e & super_arc.e(5,6)
  & z6e{left}..z7e;   % arc and terminal
 pos2(5/7[vair,flare],90); top y2r=h;
 rt x2=hround(if monospace:w-.5u else:w+.75u fi); fi
pickup tiny.nib; 
penpos3(x1r-x1l,0); x3l=x1l; top y3=x_height;
filldraw stroke z1e--z3e;  % stem
pickup fine.nib; pos3'(x1r-x1l-(hround stem_corr)+tiny,180);
y3'=y3; lft x3'r=tiny.lft x1l;
penpos4(x3'l-x3'r,180); x4=x3'; y4+.5vair=.5[x_height,h];
pos8(vair,90); top y8r=h+oo;
if serifs: x8=.5[x4,x2r]; (xa,y8r)=whatever[z8l,z4l];
  x8r:=min(xa,.5[x8,x2r]); pos9(hair,0); bulb(8,9,2);  % bulb
  filldraw stroke z3'e--z4e & super_arc.e(4,8);  % arc
else: x8=.6[x4,x2]; y4l:=1/3[y4l,y8l];
  filldraw stroke z3'e--z4e & super_arc.e(4,8)
   & term.e(8,2,right,.9,4); fi  % arc and terminal
penlabels(1,2,3,4,5,6,7,8); endchar;


cmchar "The letter wedge";
beginchar("U",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;
right_stem=fudged.stem-stem_corr;
left_stem=min(fudged.hair if hefty:-2stem_corr fi,right_stem);
outer_jut=.75jut; 
x1l=w-x4r=l+letter_fit+outer_jut+.25u; y1=y4=0;
x2-x1=x4-x3; x2r+apex_corr=x3r; y2=y3=h+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-notch_cut: y0:=h-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
if serifs: numeric inner_jut; pickup tiny.nib;
 prime_points_inside(1,2); prime_points_inside(4,3);
 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_serif(1',2,a,1/3,outer_jut,b,1/2,inner_jut)(dark);  % left serif
 dish_serif(4',3,c,.6,inner_jut,d,1/2,outer_jut); fi  % right serif
penlabels(0,1',2,3,4'); endchar;


cmchar "The letter rotated h";
beginchar("u",10u#,x_height#,desc_depth#);
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
pickup tiny.nib; pos1(stem,0); pos2(stem,0);
pos3(stem,0); pos4(stem',0);
lft x1l=hround(2.5u-.5stem); x1=x2; x3=w-x1; x3r=x4r;
if serifs: top y1=h+min(oo,serif_drop); bot y4=-d;
else: top y1=h; bot y4=-d; fi
pos0(stem,0); pos0'(stem',0); x0=x3; x0'=x4; y0=y0';
penpos2'(stem-fine,-180); z2'=z2; y3=y1; y2=.5bar_height;
penpos5(light_vair-fine,-90); penpos6(thin_join-fine,0);
y6=y0=2/3bar_height;
filldraw stroke z1e--z2e;  % left stem
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,x2'r]);
filldraw stroke {{interim superness:=hein_super;
  pulled_arc.e(2',5)}} & z5e{right}...{up}z6e;  % arc
if serifs: sloped_serif.l(1,2,a,1/3,jut,serif_drop); % upper left serif
 sloped_serif.l(3,0,b,1/3,jut,serif_drop); % upper right serif
 dish_serif(4,0',c,1/3,jut,d,1/3,jut); fi % lower right serif
penlabels(1,2,3,4,5); labels(6); endchar;

cmchar "The letter rotated 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; x1l=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);
x2-x1=x4-x3=x6-x5=x8-x7; x2l+apex_corr=x3l; 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-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| $\approx$ |x4r+mid_corr|
z23=whatever[z1r,z2r]=whatever[z3l,z4l];
z45=whatever[z3r,z4r]=whatever[z5l,z6l];
z67=whatever[z5r,z6r]=whatever[z7l,z8l];
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>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(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.5jut;
 elseif hefty: inner_jut1=inner_jut4=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+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_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
  currentpicture:=currentpicture rotatedaround ((.5w,.5h),180);
penlabels(0,1,2,3,4,5,6,7,8,23,45,67); endchar;

cmchar "The letter yogh";
beginchar("x",8u#,x_height#,desc_depth#);
italcorr x_height#*slant-.5serif_fit#-.3u#;
adjust_fit(0,.5serif_fit#);
numeric arm_thickness[],z_stem,stem[];
stem1=fudged.stem-4stem_corr;
if hefty: arm_thickness1=stem1; arm_thickness2=stem1;
 z_stem=fudged.hair;
else: arm_thickness1=stem1; arm_thickness2=stem1; z_stem=fudged.hair; fi
if arm_thickness1<tiny.breadth: arm_thickness1:=tiny.breadth; fi
pickup tiny.nib; rt x1r=rt x2r=hround(w-.8u); 
lft x3l=lft x4l=hround .3[.5u, w-.8u]; 
top y1=h; y2=min(y1,h-2/3arm_thickness1);
bot y4=.3[0,h]; y3=max(y4,2/3arm_thickness2);
numeric alpha; alpha=diag_ratio(1,z_stem-tiny,y2-y3,x2r-x3l-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);
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 .75u; y6=good.y(y5l-beak/1.4)-eps;
arm(5,6,a,beak_darkness,-.4beak_jut);  % upper arm and beak
pickup fine.nib; pos11(vair,-90);
pos12(vair,180); x12r=x3r; %.5[1.5u,x7];
x8=x13=hround .5[.5u, w-.8u];
pos7(curve,0); rt x7r=hround(w-.75u); 
lft x11=lft x4; %min(hround 3u,lft x12)-eps;
pos8(vair,-90); bot y8r=-d; pos13(vair, 90); y13=.1[y3,y5];
y7=.5[bot y13l,top y8l];
top y11l=top y4l; %vround(0+.5vair); 
y3=y12;
filldraw stroke pulled_arc.e(12,13); %link
filldraw stroke pulled_arc.e(13,7)
 & pulled_arc.e(7,8);  % bowl
if serifs: numeric bulb_diam[];
 bulb_diam2=flare+cap_stem-stem;
 pos10(bulb_diam2,-180); pos9(cap_hair,-180);
 lft x10r=hround .75u; y10=-.3d; %max(.1h+.5bulb_diam2,.3h-.5bulb_diam2);
 bulb(8,9,10);  % lower bulb
else:  pos9(bot_thickness,angle(-2u,-h));
 lft x9r=hround .75u; top y9l=vround -.3d;
 y9r:=good.y y9r-eps; x9l:=good.x x9l;
 filldraw stroke term.e(8,9,left,1,4); fi  % lower terminal
penlabels(1,2,3,4,5,6,7,8,9,10,12,13); endchar;


cmchar "The letter rotated y";
beginchar("y",if serifs:9.5u# else:9u# fi,x_height#+desc_depth#,0);
h:=vround(x_height#*hppp); d:=vround(desc_depth#*hppp); %adj. vertical
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;
x1l=w-x4r=l+letter_fit+outer_jut+.25u; y1=y4r=h; y2=y3=0; x2l=x3l;
numeric alpha,alpha[]; x9=3u; y9=bot_vair-d-oo;
alpha1=diag_ratio(2,bot_stem,y1-y3,x4r-x1l-apex_corr);
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*left_stem,0); penpos2(alpha3*left_stem,0);
z0=whatever[z1r,z2r]=z4l+whatever*(z3r-z4r);
if y0>notch_cut: y0:=notch_cut;
  fill z0+.5right{up}...{z4r-z3r}diag_end(0,4l,1,1,4r,3r)
    --z3r--z2l--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)--z3r--z2l
    --diag_end(2l,1l,1,1,1r,0)--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=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);
 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_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);  % 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); fi % arc and terminal
  currentpicture:=currentpicture rotatedaround ((.5w,.5h),180);
penlabels(0,1,2,3,4,5,6,7,8,9); endchar;

cmchar "The letter hausa 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'$=.9h; 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(6,5,g,1/2,inner_jut,h,1/3,right_jut)(dark);fi % lower diagonal serif
if serifs: z10r=z3'l; z10r-z10l=whatever*(z1-z6); z10l=whatever[z4r,z3'r];
 pos7(vair,90); x7=hround(x3+.5u); top y7 = top y3; 
 pos8(cap_hair,0); pos9(flare,0);
 y8= .3[y5r,y7]; rt x8r=hround(w); 
 fill z10r{z3-z4}..top z7r{right}--bot z7l{left}...{z4-z3}z10l--cycle;
% filldraw stroke z10e{z3-z4}...z7e{right}; 
 bulb(7,8,9); fi	% bulb
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6,7,8,9,10); endchar;

cmchar "The letter hausa D";
beginchar("T",15.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(4u,5u-.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=.5(w+2u#)+.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:  nodish_serif(1,2,a,1/3,.5cap_jut,b,1/3,.5cap_jut);  % upper serif
nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi  % lower serif
if serifs: pickup fine.nib; top y10r= y3r;
 pos8(flare,180); pos9(hair,180);
 pos10(cap_band,90);  rt x8r=0; x10=lft x1l - .5cap_jut;
 y8=vround(.7h);
 bulb(10,9,8); fi % bulb
math_fit(0,ic#-.5u#); penlabels(1,2,3,4,5,6,7,8,9,10); endchar;

cmchar "The letter hausa B";
beginchar("B",14.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(4u,5u-.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: nodish_serif(1,2,a,1/3,.5cap_jut,b,1/3,.5cap_jut);  % upper serif
 nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi  % lower serif
if serifs: pickup fine.nib; top y15r= y3r;
 pos13(flare,180); pos14(hair,180);
 pos15(cap_band,90);  rt x13r=0; x15=lft x1l - .5cap_jut;
 y13=vround(.7h);
 bulb(15,14,13); fi % bulb
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); endchar;

cmchar "The letter rotated 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#); 
transform mirror; mirror=identity rotatedaround ((.5w,.5h),180)
reflectedabout ((.5w,0),(.5w,h));
  currentpicture:=currentpicture transformed mirror;
penlabels(0,1,2,3,4,5,6,7,8,9,10); endchar;


cmchar "Glottal stop";
beginchar("?",8.5u#,asc_height#,0);
italcorr .8asc_height#*slant;
adjust_fit(0,0);
pickup tiny.nib; pos7(stem',0); bot y7=0; x7=.47w;
numeric bot_width;
bot_width=if hefty:max(hround .8dot_size,fine.breadth) else: hair fi;
pickup fine.nib; pos2(vair,90); pos3(curve,0);
pos4(vair,-90); pos5(stem',0); pos6(stem',0);
x2=x4=x5=x6=x7; rt x3r=hround(w-u); bot y6=1+.5[top y7r,x_height];
top y2r=h+oo; y3=.75[y6,y2]; y4=.5[y6,y2]; y5=.1[y6,y2];
{{interim superness:=more_super;
filldraw stroke pulled_super_arc.e(2,3)(superpull)
 & subpath (0,1) of super_arc.e(3,4) .. z5e---z7e\\}};  % arc and stem
if serifs: pos1(hair,180); pos0(flare,180);
 lft x1r=hround u; y1=y3; bulb(2,1,0);  % bulb
 dish_serif(7,5,e,1/3,jut,f,1/3,jut); %serif
else: pos1(vround 5/7[vair,flare],110);
 lft x1r=hround u; top y1r=vround .9[y6,top y2r];
 filldraw stroke term.e(2,1,left,1,4); fi  % terminal
penlabels(0,1,2,3,4,5,6,7); endchar;

cmchar "Upward harpoon";
beginchar("z",9u#,asc_height#,asc_depth#);
italcorr .76asc_height#*slant+.5crisp#-u#;
adjust_fit(0,0); pickup crisp.nib;
pos1(rule_thickness,0); pos2(rule_thickness,0);
pos3(bar,90); pos4(bar,90);
lft x1l=hround(.5w-.5rule_thickness); y1-.5rule_thickness=-d;
x0=x1=x2; top y0=h; x0-x3=x4-x0=3u+eps;
y3=y4=y0-.24asc_height-eps;
pos5(bar,angle(z4-z0)); z5l=z0;
pos6(bar,angle(z3-z0)); z6l=z0;
z9=.381966[.5[z3,z4],z0];
numeric t; path p; p=z4l{z9-z4}..z6r;
t=xpart(p intersectiontimes((x2r,-d)--(x2r,h))); y2=ypart point t of p;
filldraw z0..{z4-z9}z4r--subpath (0,t) of\\(z4l{z9-z4}..z6r)
 --z2r---z1r..z1l---z2l--(x2l,y0)--cycle;  % arrowhead and stem
penlabels(0,1,2,3,4,5,6,9); endchar;

cmchar "The letter variant u";
beginchar(oct"012",10u#,x_height#,0);
italcorr .75x_height#*slant-.5u#;
adjust_fit(0,0);
pickup tiny.nib; pos1(vair,90); pos2(curve,180);
pos3(vair,180); pos4(curve,0); pos5(vair,0);
x1=.5w; top y1r=h+o; lft x2r=hround u; y2=y4=2/3h; x4=w-x2;
rt x3l=hround(1/3(w+.5u)+.5hair); bot y3=bot y5=0; x5=w-x3;
filldraw stroke z3e{up}...{up}z2e
 & pulled_super_arc.e(2,1)(.5superpull)
 & pulled_super_arc.e(1,4)(.5superpull)
 & z4e{down}...{down}z5e;  % bowl
numeric arm_thickness; path p; p=z3{up}...{up}z2;
arm_thickness=vround(if hefty:slab+2stem_corr else:.75[slab,vstem] fi);
pickup crisp.nib; pos6(arm_thickness,-90); pos7(fudged.hair,-180);
bot y6r=0; x6=x3; lft x7r=hround .8u; 
y7=good.y(y6l+.3beak)+eps;
(x,y)=p intersectionpoint((0,y6l)--(w,y6l)); x6l:=x;
arm(6,7,a,.5beak_darkness,-1.2beak_jut);  % left arm and beak
pos8(arm_thickness,-90); pos9(fudged.hair,0);
y8=y6; y9=y7; x8+x6=x9+x7=w; x8l:=w-x6l;
arm(8,9,b,.5beak_darkness,1.2beak_jut);  % right arm and beak
math_fit(0,.5ic#); 
  currentpicture:=currentpicture rotatedaround ((.5w,.5h),180);
penlabels(1,2,3,4,5,6,7,8,9); endchar;

cmchar "The letter variant varu";
beginchar(oct"010",11u#,x_height#,0);
italcorr x_height#*slant;
adjust_fit(0,0); pickup fine.nib;
pos2(curve,-180); lft x2r=hround.5u; y2=y8=bar_height;
y4=y6=vround.4h;
%y1+.5hair=h; x1=x2+.75u; pos1(hair,angle(2(x1-x2),y1-y2)+90);
y1r=h+oo; x1=.5w; pos1(hair,90);
pos3(hair,-90); pos4(hair,0); pos5(vair,90);
pos6(hair,180); pos7(hair,270); pos8(curve,360);
bot y3r=bot y7r=-oo; top y5r=vround(.1[y4,h]+.5vair);
x3=.5[x2,x4]; x7+.25u=.5[x6,x8]; rt x8r=hround(w-.5u);
x5+.5stem=hround(.5w+.5stem)+eps;
x5=.5[x4,x6]; rt x4r-lft x6r=min(stem,2hair)+2eps;
if x4l<x6l: x4l:=x6l:=x5; fi
filldraw circ_stroke z1e{left}...z2e{down}...z3e{right}
 ...{up}z4e...{left}z5e;  % left arc
filldraw stroke z5e{left}...z6e{down}...z7e{right}...{up}z8e...z1e{left};
math_fit(-bar_height#*slant,2/3ic#); penlabels(1,2,3,4,5,6,7,8); endchar;


cmchar "Lowercase Greek bar lambda";
beginchar(oct"001",10.5u#,asc_height#,0);
adjust_fit(0,0); pickup fine.nib;
pos1(vair,90); lft x1=hround .1u; top y1r=h;
x2=x1+2u; y2=.7[x_height,h]; x3=w-2u; bot y4=-oo; y3=max(.07h,y4+eps);
z4-(.25u,0)=whatever[z2,z3]; numeric theta; theta=angle(z2-z3)-90;
pos2(stem,theta); pos3(stem,theta); pos4(stem,0);
filldraw circ_stroke z1e{right}...z2e---z3e
 ...{2(x4e-x3e),y4e-y3e}z4e;  % long diagonal
y5=.5[bar_height,x_height]; z5=whatever[z2,z3];
x6=1.5u; y6-.5stem=-oo; pos5(hair,theta-90); pos6(stem,angle(z5-z6)-90);
filldraw circ_stroke z6e--z5e; % short diagonal
pos7(bar,90+theta); pos8(bar,90+theta);
z7r=whatever[z1l,z6l]; z9=.8[z3,z2];z9=.5[z7,z8];
(x9-x7)*(y2-y1)/(x2-x1)=y7-y9;
showdependencies;
  %angle(z2-z3)+90=angle(z7-z8);
filldraw stroke z7e--z8e;
penlabels(1,2,3,4,5,6,7,8,9); endchar;


cmchar "Lowercase Greek upsidedown iota";
beginchar(oct"000",5u#,x_height#,0);
italcorr x_height#*slant+.5hair#-u#;
adjust_fit(if monospace: u#,u# else: 0,0 fi); pickup fine.nib;
pos1(stem,0); rt x1r=hround(w-1.5u+.5stem); y1-.5stem=-oo;
x2=x1+.25u; x4=0; hook_in(4,3,2);  % opening hook
filldraw circ_stroke z1e{up}...{u,x_height}z2e;  % stem
math_fit(0,ic#); penlabels(1,2,3,4); endchar;


cmchar "The letter enya";
beginchar(oct"116",10.5u#,x_height#,desc_depth#);
italcorr .5[bar_height#,x_height#]*slant-serif_fit#+.5stem#-2u#;
adjust_fit(serif_fit#+stem_shift#,serif_fit#-stem_shift#);
pickup tiny.nib; pos1(stem,0); pos2(stem,0); pos8(stem',0);
numeric shaved_stem; shaved_stem=hround(stem-2stem_corr);
pos1'(shaved_stem,0); pos2'(shaved_stem,0); pos3(stem,0);
lft x1l=hround(3u-.5stem); x1l=x1'l=x2l=x2'l=x8l; x3=w+.5u-x1;
top y1=h+min(oo,serif_drop); bot y2=0; y1=y1'; y2=y2';
bot y8=-1/3d;
filldraw stroke z1'e--z2'e;  % left stem
h_stroke(8,a,3,4);  % arch and right stem
if serifs: sloped_serif.l(1',2',b,1/3,jut,serif_drop); % 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_serif(4,3,e,1/3,inner_jut,f,1/3,jut); fi % lower right serif
if serifs: 
 pickup tiny.nib; pos5(vair,-90); pos6(hair,-180); pos7(flare,-180);
 x5=.5[x8,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,z8l]; x5r:=max(x,.5[x6r,x5]);
 filldraw stroke z8e{down}...z5e{left};  bulb(5,6,7); % arc and bulb
else: pickup fine.nib; pos8'(stem',0); z8'=z8;
 pos6(.2[vair,stem'],-90); pos7(vair,-90);
 lft x7r=hround -.75u; bot y7r=vround 5/6(-d-oo);
 (x,y7l)=whatever[z7r,z3]; x7l:=x;
 z5r=z8'r; (x8'l,y5l)=whatever[z7l,z5r]; x5l=x8'l; y5=y5r;
 x6r=.5[x7r,x5r]; x6l:=.5[x7l,x5l]; bot y6r=-d-oo;
 filldraw stroke z8'e..{down}z5e & super_arc.e(5,6)
  & z6e{left}..z7e; fi  % arc and terminal
penlabels(1,2,3,4,5,6,7,8); endchar;


cmchar "The ligature fj";
beginchar(oct"106",10u#+2letter_fit#,asc_height#,desc_depth#);
% written by Dimitri Vulis
% mostly based on cm program for fi from romligs
italcorr asc_height#*slant-serif_fit#+.5if serifs:stem# else:dot_size# fi-2u#;
adjust_fit(0,serif_fit#);
pickup tiny.nib; pos1(stem',0); lft x1l=hround(2.5u-.5stem');
pos11(stem',0); rt x11r=hround(w-2.5u+.5stem');
pos12(stem',0); x11=x12; bot y12=-1/3d;
pickup fine.nib; numeric bulb_diam, inner_jut;
if serifs: bulb_diam=hround 1/4[.8[stem,flare],dot_size];
 pos2(bulb_diam,0); x2r=x12r;
 y2+.5bulb_diam=.8[x_height,h+oo]; top y11=x_height+min(oo,serif_drop);
 if rt x1r+jut+.5u+2<=lft x11l-jut: inner_jut=jut;
 else: rt x1r+inner_jut+.5u+2=lft x11l-inner_jut; fi
else: bulb_diam=max(stem,dot_size);
 pos2(6/7[vair,flare],90); top y2r=h; rt x2=hround 5.3u;
 pickup tiny.nib; pos13(bulb_diam,0); pos14(bulb_diam,90);
 x13=x11-.5; top y14r=min(2x_height,h+1); top y11=x_height;
 if bot y14l-x_height<tiny: y14l:=min(y14r-eps,y11+2tiny); fi
 x13=x14; y13=.5[y14l,y14r]; dot(13,14);    % dot
fi
f_stroke(1,2,a,b,c,jut,inner_jut); % left stem, arc, terminal, serif
pickup tiny.nib; filldraw stroke z11e--z12e;        % right stem
pickup crisp.nib; top y3r=top y4r=x_height; lft x3=hround .5u-1;
pos3(bar,90); pos4(bar,90);
if serifs: x4=x11;  % bar will overlap upper right serif
 sloped_serif.l(11,12,d,1/3,jut,min(oo,serif_drop));        % upper right serif
 pickup tiny.nib; pos16(vair,-90); pos17(hair,-180); pos15(flare,-180);
 x16=.5[x12,x17r]; bot y16r=-d-oo; y17-.5flare=-.88d;
 if monospace: lft x17r=0 else: z17r=z15r; rt x17l=floor 5.25u fi;
 (x,y16r)=whatever[z16l,z12l]; x16r:=max(x,.5[x17r,x16]);
 filldraw stroke z12e{down}...z16e{left};  bulb(16,17,15); % arc and bulb
else: pickup fine.nib; pos12'(stem',0); z12'=z12;
 pos17(.2[vair,stem'],-90); pos15(vair,-90);
 lft x15r=hround 3.75u; bot y15r=vround 5/6(-d-oo);
 (x,y15l)=whatever[z15r,z13]; x15l:=x;
 z16r=z12'r; (x12'l,y16l)=whatever[z15l,z16r]; x16l=x12'l; y16=y16r;
 x17r=.5[x15r,x16r]; x17l:=.5[x15l,x16l]; bot y17r=-d-oo;
 filldraw stroke z12'e..{down}z16e & super_arc.e(16,17)
  & z17e{left}..z15e;         % arc and terminal
 rt x4= hround 5.3u;
 fi
pickup crisp.nib; filldraw stroke z3e--z4e; % bar
penlabels(1,2,3,4,11,12,13,14,15,16,17); endchar;

cmchar "The letter reverse D";
beginchar(oct"002",13.5u#,cap_height#,0);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,cap_serif_fit#);
pickup tiny.nib; pos1(cap_stem',0); pos2(cap_stem',0);
rt x1r=rt x2r=hround max(w-2u,w-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);
z3l=top z1; y4=y3; y5=.51[y4,y6]; y6=y7;
z7l=bot z2; x4=x6=.5w-.25u; x5l=hround(u);
x4r:=x6r:=x4+.25cap_curve;
fill stroke z3e..pulled_arc.e(4,5) & pulled_arc.e(5,6)..z7e;  % lobe
if serifs: nodish_serif(1,2,a,1/3,.5cap_jut,b,1/3,cap_jut);  % upper serif
 nodish_serif(2,1,c,1/3,.5cap_jut,d,1/3,cap_jut); fi  % lower serif
math_fit(0,ic#-.5u#); penlabels(1,2,3,4,5,6,7); endchar;