
cmchar "The letter thorn";
beginchar("t",10u#+serif_fit#,asc_height#,desc_depth#);
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 ;
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[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 edh";
beginchar("d",9u#,asc_height#,0);
italcorr .7x_height#*slant + u# ;
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
oh := vround x_height ;
penpos1(vair,90); penpos3(vair',-90);
penpos2(curve,180); penpos4(curve,0);  penpos4'(hair,0) ;
x2r=hround max(.5u,1.25u-.5curve);
x4r=w-x2r; x1=x3=.5w; y1r=oh + vround 1.5oo; y3r=-oo;
y2=y4=.5oh-vair_corr; y2l:=y4l:=.52oh;
x4'l = x4l ; y4 = y4' ;
penstroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & pulled_arc.e(3,4) -- pulled_arc.e(4',1) & cycle;  % bowl
fill z4l -- z4r -- z4-(0,u) -- cycle ; % fill in a little gap!
penpos5(.5[vair,hair],40) ;
x5 = 3u ; top y5r = h ;
penstroke z5e .. tension 1.1 and 0.9 .. z4e{down} ;
path p ;
p = z5 .. tension 1.1 and 0.9 .. z4{down} ;
z6 = ((0,.6[x_height,asc_height]) -- (w,.5[x_height,asc_height]))
     intersectionpoint p ;
penpos6'(.5[vair,hair],-60) ; penpos 6''(.5[vair,hair],-60) ;
top y6''l = h ; z6'' = z6 + whatever*dir30;
z6 = .5[z6',z6''] ; filldraw stroke z6'e -- z6''e ;
penlabels(1,2,3,4,5,6,6',6''); endchar;
 
 
cmchar "The letter yogh";
beginchar("g",9u#,x_height#,desc_depth#);
italcorr x_height#*slant-.5serif_fit#-.3u#;
adjust_fit(0,0);
numeric arm_thickness,arm_thickness#,z_stem ;
arm_thickness# = .7[hair#,stem#] ;
define_whole_vertical_blacker_pixels(arm_thickness) ;
z_stem = .1[vair,stem] ;
pickup tiny.nib; rt x1r=rt x2r=hround(w-1.2u);
top y1=h; y2=min(y1,h-2/3arm_thickness);
lft x3l = hround .45w ; y3 = .7bar_height ;
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);
pair delta; delta=penoffset z3-z1 of currentpen;
fill top lft z1l--z1l+delta---z3l+delta..lft z3l
 ..bot z3r--z3r-delta---rt z1r..top z1r
 ---cycle;  % diagonal
z99 = rt z1r ; z98 = z99 + (u,0) ;   % for cutting away
z97 = z99 + 2u*(z3-z1) ; z96 = z97 + (u,0) ;
pickup crisp.nib; pos5(arm_thickness,90); pos6(hair,180);
top y5r=h; x5=x1; lft x6r=hround .75u; y6=good.y(y5l-beak/1.6)-eps;
arm(5,6,a,beak_darkness,-.4beak_jut);  % upper arm and beak
% now cut away the excess arm
erase fill z99 --- z98 --- z96 --- z97 --- cycle ;
pickup fine.nib ;
pos10'(vair,90) ; pos11(curve,0) ;
pos12(.1[vair,curve],-90) ;
z10' - z3 = whatever*dir 30 ;
x10' = x3 + u ; x10 = x10' ; y10r = good.y y10'r ; pos10(vair,90) ;
bot y12r = -d-oo ; x12 = .5w ;
y11 = .5[y10,y12] ; rt x11r = hround(w-.9u) ;
z3' = z3 ; z3'l = z3r ; z3'r = z3l ;
filldraw stroke z3'e .. z10e{right} ;
filldraw stroke pulled_arc.e(10,11) & pulled_arc.e(11,12) ;
if serifs: pos13(hair,-180) ; y13=-.1d ; lft x13r = hround .8u ;
   pos14(flare,-180) ; bulb(12,13,14) ;
else: pos13(5/7[vair,flare],angle(-3u,-h)) ;
lft x13r = hround .9u ; y13 = -.1d ;
x13l := good.x x13l ; y13l := good.y y13l ;
filldraw stroke term.e(12,13,left,1,4) ; fi
penlabels(1,2,3,4,5,6,7,8,10,11,12,13,14); endchar;

cmchar "Knuth's lowercase thorn";
beginchar("u",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;
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);
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;
x6=x3; bot y6r=-oo;
(x,y4r)=whatever[z3l,z4l]; x4r:=min(x,.5[x5r,x4]);
filldraw stroke z3e{up}...{right}z4e&super_arc.e(4,5)
 &z5e{down}...{5(x6-x5),y6-y5}z6e;  % 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,0); fi  % lower serif
penlabels(0,1,2,3,4,5,6,8); endchar;
