% tipaextr.mf: TIPX Symbols --- a supplement for TIPA.
% Copyright 1996-2003 FUKUI Rei
%
% This program may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.2
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.2 or later is part of all distributions of LaTeX 
% version 1999/12/01 or later.
%
% This program consists of all files listed in Manifest.txt.
%
% Version 1.2 2003/01/01
%
%  (Most of the symbols are now obsolete and not adopted in
%   the T3 encoding for TIPA.)
% 

%%%%% Adaptations for Times_Compat are not yet complete.

numeric ipacode; ipacode := -1;

cmchar "Reversed Polish hook";
beginchar(incr ipacode,6u#,0,desc_depth#);
adjust_fit(if monospace: 1u#,1u# else: 0,0 fi);
pickup if serifs: crisp.nib; else: fine.nib; fi
pos1(vair,-120); pos4(vair,45);
if serifs: pos2(stem,170);pos3(max(.7stem,hair),100);
else: pos2(vair,170);pos3(vair,100); fi
x1+u=x4+2u=.5w; y1=0; y2l=y4r=-3/5d; bot y3l=-d-oo;
x3r=.7[x4r,x2r]; x2l=w-u;
if serifs: filldraw circ_stroke z1e{(3,-1)}...{down}z2e
  ...{left}z3e...{(-1,1)}z4e;
else: filldraw stroke z1e{(3,-1)}...{down}z2e...{left}z3e...{(-1,1)}z4e; fi
penlabels(1,2,3,4); endchar;

cmchar "Right-tail (long)";
beginchar(incr ipacode,4u#,.2x_height#,desc_depth#);
adjust_fit(if monospace: 2u#,2u# else: 0,0 fi);
if serifs: pickup tiny.nib;
 pos1(diacr,0); lft x1l=hround(.5w-.5diacr); y1=h+oo;
 right_tail(1,2,3,4,diacr,hround(x1+3.25u),.9,.5,.6);
else: pickup fine.nib;
 pos1(vair,0); lft x1l=hround(.5w-.5vair); y1=h+oo;
 right_tail(1,2,3,4,vair,hround(x1+3.25u),.85,.5,.5); fi
penlabels(1,2,3,4); endchar;

cmchar "Palatalization hook (long)";
beginchar(incr ipacode,4u#,.2x_height#,desc_depth#);
adjust_fit(if monospace: 2u#,2u# else: 0,0 fi);
if serifs: pickup tiny.nib;
 pos1(diacr,0); lft x1l=hround(.5w-.5diacr); y1=h+oo;
 left_tail(1,2,3,4,diacr,hround(x1-3.25u));
else: pickup fine.nib;
 pos1(vair,0); lft x1l=hround(.5w-.5vair); y1=h+oo;
 left_tail(1,2,3,4,vair,hround(x1-3.25u)); fi
penlabels(1,2,3,4); endchar;

cmchar "Palatalization hook (a variety)";
beginchar(incr ipacode,5u#,.2x_height#,desc_depth#);
adjust_fit(if monospace: 1.5u#,1.5u# else: 0,0 fi);
if serifs: pickup tiny.nib;
 pos1(diacr,0); lft x1l=hround(.5w-.5diacr+.5u); y1=h+oo;
 pos5(diacr,-90); pos6(diacr,-180); bot y5r=0; y6=.1x_height;
 x6=0; x5=.5[x1,x6];
 filldraw stroke z1e..z5e..z6e;
 left_tail(1,2,3,4,diacr,hround(x1-3.25u));
else: pickup fine.nib;
 pos1(vair,0); lft x1l=hround(.5w-.5vair+.5u); y1=h+oo;
 pos5(vair,-90); pos6(vair,-135); bot y5r=0; y6=.1x_height;
 x6=0; x5=.5[x1,x6];
 filldraw stroke z1e..z5e..z6e;
 left_tail(1,2,3,4,vair,hround(x1-3.25u)); fi
penlabels(1,2,3,4,5,6); endchar;

cmchar "Superscript rectangle";
beginchar(incr ipacode,5u#+vair#,asc_height#,0);
adjust_fit(if monospace: 1u#,1u# else: 0,0 fi);
if serifs: pickup diacritic.nib;
 lft x1=lft x2=hround u; x3=x4=w-x1;
 top y1=top y3=vround(h-oo); bot y2=bot y4=vround x_height;
 draw z1--z2--z4--z3--cycle;
else: pickup crisp.nib;
 pos1(vair,0); pos2(vair,0); pos3(vair,0); pos4(vair,0);
 lft x1l=lft x2l=hround u; x3=x4=w-x1;
 top y1=top y3=vround(h-oo); bot y2=bot y4=vround x_height;
 filldraw stroke z1e--z2e; filldraw stroke z3e--z4e;
 pos1'(vair,90); pos2'(vair,90); pos3'(vair,90); pos4'(vair,90);
 lft x1'=lft x3'=hround u; x2'=x4'=w-x1;
 top y1'r=top y2'r=vround(h-oo); bot y3'l=bot y4'l=vround x_height;
 filldraw stroke z1'e--z2'e; filldraw stroke z3'e--z4'e; fi
penlabels(1,2,3,4); endchar;

cmchar "Superscript left arrow";
beginchar(incr ipacode,8u#,asc_height#,0);
adjust_fit(0,0); pickup crisp.nib;
pos1(rule_thickness,90); pos2(rule_thickness,90);
pos3(rule_thickness,0); pos4(rule_thickness,0);
y0=y1=y2; bot y4=.15[x_height,asc_height];
x1+.5rule_thickness=hround(w-.5u); lft x0=hround .5u;
y3-y0=y0-y4=if monospace:.24 else:.18 fi asc_height+eps;
x3=x4=x0+if monospace:3u else:2.5u fi+eps;
pos5(rule_thickness,angle(z4-z0)); z5l=z0;
pos6(rule_thickness,angle(z3-z0)); z6l=z0;
z9=.2[.5[z3,z4],z0];
numeric t; path p; p=z4r{z9-z4}..z6r;
t=xpart(p intersectiontimes((0,y2l)--(w,y2l))); x2=xpart point t of p;
filldraw z0..{z4-z9}z4l--subpath (0,t) of\\(z4r{z9-z4}..z6r)
 --z2l---z1l..z1r---z2r--subpath (t,0) of\\(z3r{z9-z3}..z5r)
 --z3l{z9-z3}..z0 & cycle;  % arrowhead and stem
penlabels(0,1,2,3,4,5,6,9); endchar;

% Sources: Principles (1949:17), PSG (1996:231).
% Is this symbol a horizontal small capital I? I don't know.
cmchar "Retracting sign (a variety)";
beginchar(incr ipacode,8u#,x_height#,0);
adjust_fit(0,0);
numeric v_thickness;
v_thickness=if monospace: vair; else: .5[vair,flare]; fi
pickup fine.nib; pos1(v_thickness,90); pos2(v_thickness,90);
lft x1=lft x3l=lft x4l=hround u;
rt x2=rt x5r=rt x6r=hround(w-u);
top y1r=top y2r=vround(.5h+.5v_thickness);
filldraw stroke z1e--z2e;
if serifs: 
 pos3(stem,0); pos4(stem,0); pos5(stem,0); pos6(stem,0);
 top y3=top y5=top y2r+v_thickness; bot y4=bot y6=bot y2l-v_thickness;
 filldraw stroke z3e--z4e; filldraw stroke z5e--z6e; 
 x1'=x4r+.2(x2-x1); y1'=y1; pos1'(v_thickness, 90);
 filldraw z4r{up}..{right}z1'l--z1'r{left}..{up}z3r--cycle;
 x2'=x6l-.2(x2-x1); y2'=y2; pos2'(v_thickness, 90);
 filldraw z5l{down}..{left}z2'r--z2'l{right}..{down}z6l--cycle; fi
penlabels(1,1',2,2',3,4,5,6); endchar;

cmchar "Down full arrow";
beginchar(incr ipacode,CT(9u#,10u#),asc_height#,0);
adjust_fit(0,0); pickup crisp.nib;
pos1(rule_thickness,0); pos2(rule_thickness,0);
pos3(rule_thickness,90); pos4(rule_thickness,90);
lft x1l=hround(.5w-.5rule_thickness); y1+.5rule_thickness=h;
x0=x1=x2; bot y0=-d; x0-x3=x4-x0=if monospace:3u else:3u fi+eps;
y3=y4=y0+if monospace:.24 else:.27 fi asc_height+eps;
pos5(rule_thickness,angle(z4-z0)); z5l=z0;
pos6(rule_thickness,angle(z3-z0)); z6l=z0;
z9=.2[.5[z3,z4],z0];
numeric t; path p; p=z4r{z9-z4}..z6r;
t=xpart(p intersectiontimes((x2r,-d)--(x2r,h))); y2=ypart point t of p;
filldraw z0..{z4-z9}z4l--subpath (0,t) of\\(z4r{z9-z4}..z6r)
 --z2r---z1r..z1l---z2l--subpath (t,0) of\\(z3r{z9-z3}..z5r)
 --z3l{z9-z3}..z0 & cycle;  % arrowhead and stem
penlabels(0,1,2,3,4,5,6,9); endchar;

cmchar "Up full arrow";
beginchar(incr ipacode,CT(9u#,10u#),asc_height#,0);
italcorr .76asc_height#*slant+.5crisp#-u#;
adjust_fit(0,0); pickup crisp.nib;
pos1(rule_thickness,0); pos2(rule_thickness,0);
pos3(rule_thickness,90); pos4(rule_thickness,90);
lft x1l=hround(.5w-.5rule_thickness); y1-.5rule_thickness=-d;
x0=x1=x2; top y0=h; x0-x3=x4-x0=if monospace:3u else:3u fi+eps;
y3=y4=y0-if monospace:.24 else:.27 fi asc_height-eps;
pos5(rule_thickness,angle(z4-z0)); z5l=z0;
pos6(rule_thickness,angle(z3-z0)); z6l=z0;
z9=.2[.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--subpath (t,0) of\\(z3l{z9-z3}..z5r)
 --z3r{z9-z3}..z0 & cycle;  % arrowhead and stem
penlabels(0,1,2,3,4,5,6,9); endchar;

cmchar "Subscript right arrow";
beginchar(incr ipacode,16u#,0,desc_depth#);
adjust_fit(0,0); pickup crisp.nib;
pos1(rule_thickness,90); pos2(rule_thickness,90);
pos3(rule_thickness,0); pos4(rule_thickness,0);
y0=y1=y2; x1-.5rule_thickness=hround .5u; rt x0=hround(w-.5u);
y3-y0=y0-y4=if monospace:.24 else:.18 fi asc_height+eps;
top y1r=vround -.67d;
x3=x4=x0-if monospace:3u else:2.5u fi-eps;
pos5(rule_thickness,angle(z4-z0)); z5l=z0;
pos6(rule_thickness,angle(z3-z0)); z6l=z0;
z9=.2[.5[z3,z4],z0];
numeric t; path p; p=z4l{z9-z4}..z6r;
t=xpart(p intersectiontimes((0,y2l)--(w,y2l))); x2=xpart point t of p;
filldraw z0..{z4-z9}z4r--subpath (0,t) of\\(z4l{z9-z4}..z6r)
 ---z1l..z1r---subpath (t,0) of\\(z3l{z9-z3}..z5r)
 --z3r{z9-z3}..z0 & cycle;  % arrowhead and stem
penlabels(0,1,2,3,4,5,6,9); endchar;

cmchar "Subscript double arrow";
beginchar(incr ipacode,10u#,0,desc_depth#);
adjust_fit(0,0); pickup crisp.nib;
pos1(rule_thickness,90); pos2(rule_thickness,90);
pos3(rule_thickness,0); pos4(rule_thickness,0);
y0=y1=y2; lft x0=hround .1u;
if monospace: x1+.5rule_thickness=hround(w-.1u) else: x1=.5w fi;
y3-y0=y0-y4=if monospace:.24 else:.18 fi asc_height+eps;
top y1r=top y11r=vround -.67d;
x3=x4=x0+if monospace:3u else:2.5u fi+eps;
pos5(rule_thickness,angle(z4-z0)); z5l=z0;
pos6(rule_thickness,angle(z3-z0)); z6l=z0;
z9=.2[.5[z3,z4],z0];
numeric t; path p; p=z4r{z9-z4}..z6r;
t=xpart(p intersectiontimes((0,y2l)--(w,y2l))); x2=xpart point t of p;
filldraw z0..{z4-z9}z4l--subpath (0,t) of\\(z4r{z9-z4}..z6r)
 ---z1l..z1r---subpath (t,0) of\\(z3r{z9-z3}..z5r)
 --z3l{z9-z3}..z0 & cycle;  % left arrowhead and stem
pos11(rule_thickness,90); pos12(rule_thickness,90);
pos13(rule_thickness,0); pos14(rule_thickness,0);
y10=y11=y12; rt x10=hround(w-.1u);
if monospace: x11-.5rule_thickness=hround .1u else: x11=.5w fi;
y13-y10=y10-y14=if monospace:.24 else:.18 fi asc_height+eps;
x13=x14=x10-if monospace:3u else:2.5u fi-eps;
pos15(rule_thickness,angle(z14-z10)); z15l=z10;
pos16(rule_thickness,angle(z13-z10)); z16l=z10;
z19=.2[.5[z13,z14],z10];
numeric t; path p; p=z14l{z19-z14}..z16r;
t=xpart(p intersectiontimes((0,y12l)--(w,y12l))); x12=xpart point t of p;
filldraw z10..{z14-z19}z14r--subpath (0,t) of\\(z14l{z19-z14}..z16r)
 ---z11l..z11r---subpath (t,0) of\\(z13l{z19-z13}..z15r)
 --z13r{z19-z13}..z10 & cycle;  % right arrowhead and stem
penlabels(0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,19); endchar;

ipacode:=31;

cmchar "Right-hook A";
beginchar(incr ipacode,CT(9u#,8.88u#),x_height#,desc_depth#);
if Times_Compat: bh#:=.6x_height#;
else: bh#:=min(bar_height#,1.14x_height#-bar_height#); fi
define_pixels(bh);
adjust_fit(0,serif_fit# if serifs: if hair#+.5stem#>1.5u#:-.25u# fi\\fi+1u#);
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,if Times_Compat:1.5u else:2.1u fi-.5flare);
 x3=.5w if Times_Compat:-.25u else:-.5u fi;
 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-side_gap+.5stem);
y4=if Times_Compat: .5 else: 1/3 fi[bh,h];
pos5(stem,0); x5=x4;
y5=if Times_Compat: max(.45bh,2vair) else: max(.55bh,2vair) fi;
filldraw stroke super_arc.e(3,4)&z4e..z5e;  % arc and stem
pos6(.3[thin_join,vair],90); x6=x4; bot y6=if Times_Compat: 1.1 fi bh;
pos7(hround(curve-2stem_corr),if Times_Compat: 200 else: 180 fi);
lft x7r=hround max(.5u,1.5u-.5curve);
if Times_Compat: y7=.3[top y8l,top y6r]; pos8(.6[vair,flare],240); x8l=.5w-1u;
else: y7=1/3[top y8l,top y6r]; pos8(vair,270); x8l=.5w-.75u; fi
pos9(thin_join,360); z9l=z5l; bot y8r=-oo;
(x,y8r)=whatever[z8l,z9l]; x8r:=max(x,x8-u);
{{interim superness:=more_super;
 filldraw stroke z9e{down}...z8e{left}...{up}z7e &
 if Times_Compat: z7e{up}...{(35,10)}z6e else:
 super_arc.e(7,6)fi}}; % bowl
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
  pickup tiny.nib; x14r=x12r; y14=y12; pos14(diacr,0);
  right_tail(14,15,16,17,diacr,hround(x14+3.25u),.9,.5,.6);
 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);
  if Times_Compat: y13l:=.05[y12l,y13l]; y13r:=y13l; fi
  filldraw stroke z5'e---z10e...z11e{right}...z12e---z13e; % hook
  pickup tiny.nib; x14=x13; y14=y13l; pos14(hair,0);
  right_tail(14,15,16,17,diacr,hround(x14+3.25u),.9,.5,.6); fi
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; % base of stem
 pickup fine.nib; %x14r=x5r; y14=y10; pos14(vair,0);
 right_tail(10,15,16,17,shaved_stem,hround(w-.5u+.5hair),.85,.5,.5); fi
penlabels(1,2,3,4,5,6,7,8,9,10,11,12,13,14); endchar;

cmchar "Inverted script A";
beginchar(incr ipacode,10u#+serif_fit#,x_height#,0);
italcorr x_height#*slant-serif_fit#+.5stem#-.5u#;
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-side_gap+.5stem'); bot y1=-oo;
numeric edge; edge=lft x2l;
pickup fine.nib; pos3(if hefty:thin_join else: hair fi,0);
pos4(vair,270); pos5(curve,180);
pos6(vair,90); penpos7(x3r-x3l,360);
lft x3l=1/3[lft x2,edge]; y3=h-1/8[bar_height,x_height];
x4l=.5(w-serif_fit)-.3u; bot y4r=-oo;
lft x5r=hround max(1.35u-.5curve,.6u); y5=.5x_height;
x6l=x4l-.2u; top y6r=h+oo;
x7=x3; y7=max(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{down}...pulled_arc.e(4,5)
 & pulled_arc.e(5,6)...{down}z7e; % bowl
y0=ypart(((edge,0)--(edge,h))intersectionpoint(z3l{down}...{left}z4l));
pickup tiny.nib; top y2=h+if serifs:min(oo,serif_drop) else: 0 fi;
filldraw stroke z0'e--z0e--z2e;  % stem
pickup crisp.nib;
pos8(hround(hair-stem_corr),0); pos7'(stem',0);
z7'=z0'; x8r=x7'r; bot y8=-oo;
filldraw stroke z7'e--z8e;
if serifs: inverted_sloped_serif.r(2,0,b,1/3,jut,serif_drop); fi % lower serif
penlabels(0,1,2,3,4,5,6,7,8); endchar;

cmchar "A-O Ligature";
beginchar(incr ipacode,CT(13u#,14.44u#),x_height#,0);
italcorr .5[bar_height#,x_height#]*slant+.5min(curve#-1.5u#,0);
adjust_fit(0,0);
numeric left_curve,right_curve;
if monospace: right_curve=left_curve=fudged.stem;
else: left_curve=max(tiny.breadth,hround(curve-2stem_corr));
 right_curve=max(tiny.breadth,hround(curve-if serifs:6 else:8 fi\\stem_corr));fi
pickup tiny.nib; pos11(right_curve,0);
pos12(vair,90); pos13(mfudged.stem,180);
y11=.5h; top y12r=h+vround 1.5oo; y10l=bot y11;
rt x11r=hround min(w-.5u,w-u+.5right_curve);
lft x13r=hround (.5w-.5mfudged.stem); x12=.5[x13,x11];
y13=.5[y12,y14]; bot y14r=-oo; x14=x12; pos14(vair,270);
filldraw stroke pulled_arc.e(12,13) & pulled_arc.e(13,14) &
 pulled_arc.e(14,11) & pulled_arc.e(11,12);
y11'r=y10r=y10l+.6[thin_join,vair]; y11'l=y10l; x11'l=x11'r=x11; x10l=x10r=x13;
pickup fine.nib; top y3r=h+vround 1.5oo;
if serifs: pos1(flare,180); pos2(mfudged.hair,180);
 pos3(vair,90);  lft x1r=hround max(u,2.1u-.5flare); x3=4u;
 y1=min(bar_height+.5flare+2vair+2,.9[bar_height,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=4.3u; top y1r=vround .82[bar_height,top y3r];
 filldraw stroke term.e(3,1,left,.9,4); fi  % left terminal
pos4(mfudged.stem,0); x4=x13; y4=1/3[bar_height,h];
pos5(mfudged.stem,0); x5=x4; y5=min(y4,y13);
filldraw stroke super_arc.e(3,4)&z4e--z5e;  % arc and stem
pos6(.6[thin_join,vair],90); x6=x4; bot y6=if Times_Compat: .9 fi bar_height;
pos7(left_curve,180);
lft x7r=hround max(.5u,1.5u-.5left_curve); y7=1/3[top y8l,top y6r];
pos8(vair,270); x8l=3.75u; bot y8r=-oo;
pos9(.5[vair,fudged.stem],360); x9=x5; y9=.55bar_height;
(x',y8r)=whatever[z8l,z9l]; x8r:=max(x',x8-u);
{{interim superness:=more_super;
 filldraw stroke z9e{down}...z8e{left}...{up}z7e&super_arc.e(7,6)}}; % bowl
if y9<y5: filldraw stroke z5e{down}..{down}z9e; fi  % link (usually hidden)
penlabels(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); endchar;

cmchar "Left-hook four";
beginchar(incr ipacode,CT(9u#,10u#),fig_height#,desc_depth#);
italcorr fig_height#*slant-.5u#;
adjust_fit(0,0);
numeric light_stem, light_stem', diag_stem, alpha, cut; cut=.75notch_cut;
light_stem=hround .4[fudged.stem,fudged.cap_stem];
light_stem'=hround max(tiny.breadth,light_stem-2stem_corr);
diag_stem=max(tiny.breadth,.4[vair,fudged.hair]);
pickup crisp.nib; pos5(cap_bar,90); pos6(cap_bar,90);
lft x5=hround .5u; rt x6=hround(w-.5u);
top y5r=vround(if serifs: 5/18[slab,h-light_stem]+1
 else:.35(h-light_stem) fi+.5cap_bar);
z4l=top lft z5r; y2=y2'=y5=y6; x1r=x2r=hround(w-3u+.5light_stem);
penpos1(light_stem',0); penpos2(light_stem',0); y1=y3=h+apex_o+apex_oo;
x3r+apex_corr=x1r; alpha=diag_ratio(1,diag_stem,y3-y4l,x3r-x4l);
penpos3(alpha*diag_stem,0); penpos4(alpha*diag_stem,0);
x0=x1l; z0=whatever[z3r,z4r];
x5'=x5; z5''=z5'+penoffset z4-z3 of currentpen=whatever[z4l,z3l];
fill diag_end(2r,1r,1,.5,3l,4l)---z5''...lft z5'
 ---lft z5l -- (x4r,y5l) -- z4r
 if y0<h-cut:{z3r-z4r}...{up}(x1l-1,h-cut)
  --(x1l,h-cut) else: -- z0 fi
 --z2l--z2r--cycle;  % diagonal and upper stem
filldraw stroke z5e--z6e;  % bar
pickup tiny.nib; pos7(light_stem,0); rt x7r=x1r; bot y7=0;
pos2'(light_stem,0); x2'=x7;
filldraw stroke z2'e--z7e;  % lower stem
left_tail(7,8,9,10,light_stem,hround(lft x7-3.75u));
penlabels(0,1,2,3,4,5,6,7,8,9,10); endchar;

cmchar "Stretched C (original form)";
beginchar(incr ipacode,CT(8u#,8.88u#),x_height#,desc_depth#);
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=-d-oo;
pos3(curve,180); lft x3r=hround max(.6u,1.35u-.5curve); y3=.5h-.5d;
if serifs: pos1(hair,0); pos0(flare,0);
 if Times_Compat:
  y1=min(bar_height+.4flare+1.8vair'+2,.8[bar_height,h]-.5flare);
 else:
  y1=min(bar_height+.5flare+2vair'+2,.9[bar_height,h]-.5flare); fi
 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-d),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);
 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-d); 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,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 "Curly-tail stretched C";
beginchar(incr ipacode,CT(9u#,10u#),asc_height#,desc_depth#);
italcorr asc_height#*slant-1u#;
adjust_fit(0,0);
pickup fine.nib; interim superness:=more_super;
pos2(.6[vair,flare],90); pos5(.6[vair,flare],270);
x2=x5=.5w; top y2r=vround(h+1.5oo); bot y5r=-d-oo;
pos3(stem,180); pos4(stem,180);
lft x3r=lft x4r=hround1.2u; y3=.75h; y4=0;
pos1(stem,0); rt x1r=hround(w-1.1u); top y1=vround .75h;
pos6(stem,0); rt x6r=hround(w-1u); y6=.6[-d,y7];
pos7(.6[vair,flare],90); x7l=.2[x5,x6]; y7=.25h+.5stem-d;
pos8(stem,160); lft x8r=0; bot y8=-d-oo;
filldraw stroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & z3e--z4e & pulled_arc.e(4,5) & pulled_arc.e(5,6);
filldraw stroke z6e{up}...z7e{left}...{dir250}z8e;
penlabels(0,1,2,3,4,5,6,7,8); endchar;

cmchar "Curly-tail stretched C (original form)";
beginchar(incr ipacode,CT(8u#,8.88u#),x_height#,desc_depth#);
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=-d-oo;
pos3(curve,180); lft x3r=hround max(.6u,1.35u-.5curve); y3=.5h-.5d;
if serifs: pos1(hair,0); pos0(flare,0);
 if Times_Compat:
  y1=min(bar_height+.4flare+1.8vair'+2,.8[bar_height,h]-.5flare);
 else:
  y1=min(bar_height+.5flare+2vair'+2,.9[bar_height,h]-.5flare); fi
 rt x1r=hround(w-.7u); bulb(2,1,0);  % bulb
 pos5(hair,0); rt x5r=hround(.9w); y5=.35bar_height-d+.25hair;
 (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..{up}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],0); x5r=hround(w-.5u);
 y5=.37bar_height-d+.25hair;
 filldraw stroke pulled_super_arc.e(2,3)(.7superpull)
  & pulled_super_arc.e(3,4)(.5superpull) & z4e{right}...{up}z5e; fi
pos6(vair,90); x6l=.3[x4,x5]; y6=.6bar_height+.5vair-d;
pos8(hair,160); x8=u; bot y8=-d-oo;
filldraw stroke z5e{up}...z6e{left}...{dir250}z8e;
penlabels(0,1,2,3,4,5,6,8); endchar;

% This shape is found in PSG (1996:38).
cmchar "Front-hook D";
beginchar(incr ipacode,10u#+serif_fit#,asc_height#,0);
italcorr asc_height#*slant-serif_fit#+.5stem#-2u#;
adjust_fit(3.25u#,serif_fit#);
d_stroke(true,true,0);
if serifs: pickup tiny.nib; else: pickup fine.nib; fi
top y8r=.95x_height; x8=2.7u;
front_hook(8,9,10,11,1.1stem,50,-2.75u,.4x_height,.05,1/2,.5);
penlabels(0,1,2,3,4,5,6,7,8,9,10,11); endchar;

% This shape is the original shape introduced by Daniel Jones.
cmchar "Front-hook D (Original)";
beginchar(incr ipacode,10u#+serif_fit#,asc_height#,0);
italcorr asc_height#*slant-serif_fit#+.5stem#-2u#;
adjust_fit(2u#,serif_fit#);
d_stroke(true,true,0);
if serifs: pickup tiny.nib;
  pos8(.5[vair,hair],50); pos9(vair,90); pos10(vair,180); pos11(flare,180);
  top y8r=.95x_height; x8=2.7u;
  top y9r=1.1x_height; x9=.5u;
  y10=.9x_height; x10r=-1.5u;
  filldraw stroke z8e..{left}z9e; bulb(9,10,11);%arc and bulb
else: pickup fine.nib;
  pos8(.5[vair,hair],50); pos9(vair,90); pos10(vair,100);
  top y8r=.95x_height; x8=2.7u;
  top y9r=1.1x_height; x9=.5u;
  y10=.9x_height; x10r=-1.5u;
  filldraw stroke z8e..z9e{left}..z10e; fi
penlabels(0,1,2,3,4,5,6,7,8,9,10,11); endchar;

cmchar "D-B ligature";
beginchar(incr ipacode,CT(15u#,15.56u#),asc_height#,0);
italcorr .5x_height#*slant+min(.5curve#-u#,-.25u#);
adjust_fit(0,0);
numeric w_org; w_org=w; w:=10u if Times_Compat: +.28u fi;
d_stroke(true,false,.1h); w:=w_org;
pickup tiny.nib; pos11(stem',0); pos12(stem,0);
pos10'(stem',0); pos10(stem,0); z10l=z10'l; x10'=x11; x10=x12;
x11l=x1l; top y11=h;
numeric edge; edge=rt x12r;
pickup fine.nib; pos13(if hefty:thin_join else: hair fi,180);
pos14(vair,90); pos15(curve,0); pos16(vair,-90); penpos17(x13l-x13r,-180);
rt x13l=max(rt x13l-(lft x13r-tiny.lft x12l),1/3[rt x12,edge]);
y13=1/8[bar_height,x_height];
x14l=w-5u+serif_fit+.5u; top y14r=x_height+oo;
rt x15r=hround min(w-1.35u+.5curve,w-.6u); y15=.5x_height;
x16l=x14l-.2u; bot y16r=-oo;
x17=x13; y17=min(y13,y16+y14-y13+.6vair);
numeric X, X';
(X,y14r)=whatever[z13l,z14l]; x14r:=min(X,.5[x14,x15r]);
(X',y16r)=whatever[z17l,z16l]; x16r:=min(X',.5[x16,x15r]);
filldraw stroke z13e{up}...pulled_arc.e(14,15)&pulled_arc.e(15,16)
  ...{up}z17e; % bowl
y10=ypart(((edge,h)--(edge,0))intersectionpoint(z13l{up}...{right}z14l));
y12=ypart(((edge,h)--(edge,0))intersectionpoint(z16l{left}...{up}z17l));
pickup tiny.nib; filldraw stroke z10'e--z10e--z12e;  % stem
pickup crisp.nib; pos18(hair,0); pos17'(stem,0);
z17'=z12; x18l=x17'l; bot y18=0;
filldraw stroke z17'e--z18e;  % point
penlabels(0,1,2,3,4,5,6,7,10,11,12,13,14,15,16,17,18); endchar;

cmchar "Right-hook E";
beginchar(incr ipacode,CT(7.25u#+max(.75u#,.5curve#),8.88u#),
 x_height#,desc_depth#);
italcorr .5[bar_height#,x_height#]*slant+.5min(curve#-1.5u#,0)-1u#;
adjust_fit(if monospace: .25u#,.5u# else: 0,1u# 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:=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,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
if serifs: pickup tiny.nib; z6=z5;
 pos6(diacr,0); right_tail(6,7,8,9,diacr,hround(x6+3.25u),.9,.5,.6);
else: pickup fine.nib; x6r=x5r; y6=y5r;
 pos6(vair,0); right_tail(6,7,8,9,vair,hround(x6+3.25u),.85,.5,.5); fi
penlabels(0,1,2,3,4,5,6,7,8,9); endchar;

cmchar "Right-hook epsilon";
beginchar(incr ipacode,CT(8.5u#,8.88u#),x_height#,desc_depth#);
italcorr x_height#*slant-1.5u#;
adjust_fit(0,1u#);
epsilon_stroke(false,3.5u);
if serifs: numeric bulb_diam;
 bulb_diam=max(flare-.75(cap_stem-stem),stem);
 pos0(bulb_diam,0); pos1(hair,0);
 rt x0r=hround (w-u); y0=min(.9h-.5bulb_diam,.75h+.5bulb_diam);
 bulb(2,1,0);  % upper bulb
 pos9(bot_thickness,angle(2u,-h));
else: pos1(hair,70); rt x1r = w-1u; top y1r = .9h;
 filldraw stroke term.e(2,1,right,1,4);
 pos9(hair,-70); fi
rt x9r=hround (w-.75u); top y9=vround .25h-o;
y9r:=good.y y9r-eps; x9l:=good.x x9l;
filldraw stroke term.e(8,9,right,1,4);  % lower terminal
if serifs: pickup tiny.nib; x11l=x9l; y11=y9;
 pos11(diacr,0); right_tail(11,12,13,14,diacr,hround(x11+3.25u),.9,.5,.6);
else: pickup fine.nib; x11r=x9r; y11=y9r;
 pos11(vair,0); right_tail(11,12,13,14,vair,hround(x11+3.25u),.85,.5,.5); fi
penlabels(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14); endchar;

% based on greekl.mf.
cmchar "Greek gamma";
beginchar(incr ipacode,10u#,x_height#,desc_depth#);
italcorr x_height#*slant-.5u#;
adjust_fit(0,0); pickup fine.nib;
pos1(hair,180); pos2(vstem+dw,90);
pos4(stem,0); pos5(vair,-90); pos6(stem,-180); pos7(stem,-180);
bot y1=.5772156649h; top y2r=h+oo; y4=y6=-.5d;
bot y5r=-d-o; top y7=h;
lft x1r=hround(.5u-.5hair); x2=2.5u; rt x4r=hround(w-4.2u); x5=.5[x4,x6];
rt x4r-lft x6r=hround stem+eps; rt x7l=hround(w-u);
if x4l<x6l: x4l:=x6l:=x5; fi
pos3(hair,angle(z4-z2)+90); x3=superness[x2,x4]; y3=superness[y4,y2];
filldraw stroke z1e{up}...z2e{right}...z3e{z4-z2}
 ...z4e{down}...{left}z5e; % arc
filldraw stroke z5e{left}...z6e{up}..{2(x7-x6),y7-y6}z7e;  % stem
penlabels(1,2,3,4,5,6,7); endchar;

cmchar "Front-tail gamma";
beginchar(incr ipacode,10u#,x_height#,desc_depth#);
italcorr x_height#*slant-.5u#;
adjust_fit(0,0); pickup fine.nib;
pos1(hair,180); pos2(vstem+dw,90); pos5(stem,0); pos5'(stem,-180);
pos4(stem,0); pos6(stem,-180); pos7(stem,-180);
bot y1=.5772156649h; top y2r=h+oo; y4=y6=-.5d; top y7=h;
lft x1r=hround(.5u-.5hair); x2=2.5u; rt x4r=hround(w-3.8u);
x4=x6; rt x7l=hround(w-u); x5=x5'=x4; y5=y5'=0;
pos3(hair,angle(z4-z2)+90); x3=superness[x2,x4]; y3=superness[y4,y2];
filldraw stroke z1e{up}...z2e{right}...z3e{z4-z2}
 ...{down}z5e; % arc
filldraw stroke z5'e{up}..{2(x7-x6),y7-y6}z7e;  % stem
left_tail(5,8,9,10,stem,hround(2u-.5hair));
penlabels(1,2,3,4,5,6,7); endchar;

cmchar "Back-tail gamma";
beginchar(incr ipacode,10u#,x_height#,desc_depth#);
italcorr x_height#*slant-.5u#;
adjust_fit(0,0); pickup fine.nib;
pos1(hair,180); pos2(vstem+dw,90); pos5(stem,0); pos5'(stem,-180);
pos4(stem,0); pos6(stem,-180); pos7(stem,-180);
bot y1=.5772156649h; top y2r=h+oo; y4=y6=-.5d; top y7=h;
lft x1r=hround(.5u-.5hair); x2=2.5u; rt x4r=hround(w-4.2u);
x4=x6; rt x7l=hround(w-u); x5=x5'=x4; y5=y5'=0;
pos3(hair,angle(z4-z2)+90); x3=superness[x2,x4]; y3=superness[y4,y2];
filldraw stroke z1e{up}...z2e{right}...z3e{z4-z2}
 ...{down}z5e; % arc
filldraw stroke z5'e{up}..{2(x7-x6),y7-y6}z7e;  % stem
right_tail(5,8,9,10,stem,hround(w-u),.88,.5,1/3);
penlabels(1,2,3,4,5,6,7); endchar;

cmchar "Right-tail hooktop H";
beginchar(incr ipacode,10u#,asc_height#,desc_depth#);
italcorr .7[x_height#,asc_height#]*slant-serif_fit#+.5stem#-u#;
adjust_fit(serif_fit#+stem_shift#,-stem_shift#);
pickup tiny.nib; pos1(stem,0); pos2(stem,0);
pos1'(stem',0); pos2'(stem',0); pos3(stem,0);
lft x1l=hround(side_gap-.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: 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); fi % lower left serif
hooktop(1,9,10,11,stem',rt x3r,h,.8,.55,.2);
if serifs: right_tail(4,5,6,7,stem,hround(w+1u),.88,.5,1/3);
else: right_tail(4,5,6,7,stem,hround(w+1u),.833,.5,1/3); fi
penlabels(1,2,3,4,5,6,7,9,10,11); endchar;

cmchar "Heng";
beginchar(incr ipacode,10u#,asc_height#,desc_depth#);
italcorr .5[bar_height#,x_height#]*slant+.5stem#-1.25u#;
adjust_fit(serif_fit#+stem_shift#,-stem_shift#-.5u#);
pickup tiny.nib; pos1(stem,0); pos2(stem,0);
pos1'(stem',0); pos2'(stem',0); pos3(stem,0);
lft x1l=hround(side_gap-.5stem); x1l=x1'l=x2l=x2'l; x3=w-x1;
top y1=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: 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); fi % lower left serif
left_tail(4,5,6,7,stem,rt x2r);
penlabels(1,2,3,4,5,6,7); endchar;

% Moved from tipasym2.mf (2001/11/23 fkr)
cmchar "Left-hooktop I";
beginchar(incr ipacode,CT(6u#,6.66u#),x_height#,0);
italcorr x_height#*slant-2u#;
adjust_fit(0 if monospace:+1u# fi,serif_fit# if monospace:+1u# fi);
pickup tiny.nib; pos3(stem,0); x2=x3; bot y3=0;
x0=.75u; lft x2l = hround(.5w+.5u-.5stem); hook_in(0,1,2);
filldraw stroke z2e--z3e;
dish_serif(3,2,a,1/3,jut,b,1/3,jut);
penlabels(0,1,2,3); endchar;

% The shape of the upper serif differs from the normal Curly-tail J.
cmchar "Curly-tail J (a variety found in 1996 IPA)";
numeric dot_diam#; dot_diam#=max(dot_size#,cap_curve#);
beginchar(incr ipacode,CT(5.5u#,6.66u#),
 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:+1.5u# fi +.5u#,
 -2stem_shift# if monospace:+1u# fi +.3u#);
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
pos3(dot_diam,0); pos4(dot_diam,90);
x3r=x1r; 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: dish_serif(1,2,a,1/3,jut,b,1/3,jut);  % upper serif
 pickup tiny.nib; pos5(vair,-90); pos6(hair,-180);
 pos7(vair,-270); pos8(vair,-270);
 x5=.5[x2,x6r]; bot y5r=-d-oo; y6=-.6d;
 if monospace: lft x6r=0 else: x6r=-.3u fi;
 (x,y5r)=whatever[z5l,z2l]; x5r:=max(x,.5[x6r,x5]);
 y7r=y8r=0h; x7=x2l-.5u; x8=w-.5u;
 filldraw stroke z2e{down}...z5e{left}...z6e{up}...z7e{right}---z8e;
else: pickup fine.nib; pos2'(stem',0); z2'=z2;
 pos6(.2[vair,stem'],-90); pos7(vair,-180);
 pos8(vair,-270); pos9(vair,-270);
 lft x7r=hround -.75u; y7=-.5d;
 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;
 bot y8l = bot y9l = vround(-.5vair); x8 = .5[x7,x2]; x9 = w;
 filldraw stroke z2'e..{down}z5e & super_arc.e(5,6)
  & z6e{left}..z7e...{right}z8e--z9e; fi  % arc and terminal
penlabels(1,2,3,4,5,6,7,8); endchar;

% Bar postion differs from the normal Hooktop Barred Dotless J.
cmchar "Hooktop barred dotless J (a variety)";
beginchar(incr ipacode,CT(6u#,6.66u#),.9asc_height#,desc_depth#);
italcorr h#*slant+1u#;
adjust_fit(if monospace: 1.5u#,1.5u# else: 0,0 fi);
pickup if serifs: tiny.nib; else: fine.nib; fi
pos1(stem',0); pos2(stem',0); x1=x2=.5w;
top y1=x_height if serifs: +min(oo,serif_drop) fi; bot y2=0;
filldraw stroke z1e--z2e;  % stem
left_tail(2,5,6,7,stem',hround-.75u);
hooktop(1,8,9,10,stem',hround(w+.75u),h,.84,.5,.4);
pickup crisp.nib; bot y3l=bot y4l=0; lft x3=x2-2.5u; x4=w-x3;
pos3(bar,90); pos4(bar,90);
filldraw stroke z3e--z4e;  % bar
penlabels(1,2,3,4,5,6,7,8,9,10); endchar;

cmchar "H-M ligature";
beginchar(incr ipacode,CT(15u#,15.56u#),asc_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(side_gap-.5stem); x1l=x1'l=x2l=x2'l; % stem, sic
lft x3l=hround(.5w-.5mfudged.stem); x5-x3=x3-x1;
if not monospace: r:=hround(x5+x1)+r-w; fi  % change width for better fit
top y1=h; 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
penlabels(1,2,3,4,5,6); endchar;

% This shape is found in PSG(1996:119).
cmchar "Front-bar N";
beginchar(incr ipacode,10u#,x_height#,0);
italcorr .5[bar_height#,x_height#]*slant-serif_fit#+.5stem#-2u#;
adjust_fit(2u#+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(side_gap-.5stem); x1l=x1'l=x2l=x2'l; x3=w-x1;
top y1=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: 
 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
pickup crisp.nib;
pos5(.8[vair,stem],90);pos6(hair,180);
top y5r=h; x5=x1; lft x6r=hround -1.5u; y6=good.y(y5l-beak/2.4)-eps;
arm(5,6,b,beak_darkness, -.8beak_jut);
penlabels(1,2,3,4,5,6); endchar;

% Moved from tipasym2.mf (2001/11/23 fkr)
cmchar "Right leg N";
beginchar(incr ipacode,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#-.5u#);
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(side_gap-.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
pos5(stem,0); x5=x3; bot y5=-d;
filldraw stroke z4e--z5e;
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(5,3,e,1/3,inner_jut,f,1/3,jut); fi % lower right serif
penlabels(1,2,3,4); endchar;

% PSG (1996:130). \textbf{(I'm sorry; the codes below are a makeshift.)}
cmchar "Female sign";
beginchar(incr ipacode,CT(9u#,10u#),x_height#,desc_depth#);
italcorr .7x_height#*slant;
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
penpos1(rule_thickness,90); penpos3(rule_thickness,-90);
penpos2(rule_thickness,180); penpos4(rule_thickness,0);
x2r=hround .8u; x4r=w-x2r; x1=x3=.5w;
y1r=h+o; y3r=.05h; y2=y4=.5[y3,y1];
penstroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & pulled_arc.e(3,4) & pulled_arc.e(4,1) & cycle;  % bowl
penpos5(rule_thickness,0); penpos6(rule_thickness,0);
y5=y3; y6=-d-o; x5=x6=.5w; penstroke z5e--z6e;
penpos7(rule_thickness,90); penpos8(rule_thickness,90);
y7=y8=.5[y6,y3]; x7=hround 1.5u; x8=w-x7; penstroke z7e--z8e;
penlabels(1,2,3,4,5,6,7,8); endchar;

% PSG (1996:131). \textbf{(I'm sorry; the codes below are a makeshift.)}
cmchar "Uncrossed female sign";
beginchar(incr ipacode,CT(9u#,10u#),x_height#,desc_depth#);
italcorr .7x_height#*slant;
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
penpos1(rule_thickness,90); penpos3(rule_thickness,-90);
penpos2(rule_thickness,180); penpos4(rule_thickness,0);
x2r=hround .8u; x4r=w-x2r; x1=x3=.5w;
y1r=h+o; y3r=.05h; y2=y4=.5[y3,y1];
penstroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & pulled_arc.e(3,4) & pulled_arc.e(4,1) & cycle;  % bowl
penpos5(rule_thickness,0); penpos6(rule_thickness,0);
y5=y3; y6=-d-o; x5=x6=.5w; penstroke z5e--z6e;
penlabels(1,2,3,4,5,6); endchar;

% Moved from tipasym2.mf (2001/11/23 fkr)
cmchar "Bull's eye (an old version)";
beginchar(incr ipacode,asc_height#+2(u#+o#),asc_height#,0); autorounded;
adjust_fit(if monospace:-1u#,-1u# else: 0,0 fi); pickup light_rule.nib;
lft x6=hround u; x2=w-x6; top y8=h+o; bot y4=-d-o;
circle_points; draw_circle;  % circle
fill fullcircle scaled(dot_size+eps) shifted(.5[z4,z8]);  % dot
labels(1,2,3,4,5,6,7,8); endchar;

cmchar "Right-hook open O";
beginchar(incr ipacode,CT(8u#,8.88u#),x_height#,desc_depth#);
italcorr x_height#*slant-.5u#;
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
numeric BH; BH=if Times_Compat:.5613h else: bar_height fi;
pickup fine.nib; pos2(vair',-90); pos4(vair',90);
x2=x4=.5(w-u); bot y2r=vround(-1.5oo); top y4r=h+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=max(h-BH-.5flare-2vair'-2,h-.9[BH,h]+.5flare);
 lft x1r=hround(.7u); bulb(2,1,0);  % bulb
 pos5(hair,-180); lft x5r=hround(.5u);
 y5=min(h-good.y(.5BH-.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],-100);
 lft x1r=hround(.6u); bot y1r=h-vround .82[BH,top y4r];
 filldraw stroke term.e(2,1,left,.8,4);  % upper terminal
 pos5(.6[vair',flare],95); lft x5r=hround .5u;
 y5r=good.y(h+y5r-1/3BH-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
if serifs: pickup tiny.nib; x6l=x0r; y6=y0;
 pos6(diacr,0); right_tail(6,7,8,9,diacr,hround(x6+3.25u),.9,.5,.6);
else: pickup fine.nib; x6l=x1r; y6=y1r;
 pos6(vair,0); right_tail(6,7,8,9,vair,hround(x6+3.25u),.85,.5,.5); fi
penlabels(0,1,2,3,4,5,6,7,8,9); endchar;

cmchar "Inverted omega";
beginchar(incr ipacode,CT(11u#,12u#),x_height#,0); % 2003/03/16
italcorr .6x_height#*slant;
adjust_fit(0,0); pickup fine.nib;
pos2(curve,0); rt x2r=hround(w-.5u); y2=y8=.55h;
y4=y6=vround.4h; y1r=-oo; x1=x5=.5w; pos1(vair,270);
pos3(vair,90); pos4(hair,180); pos5(vair,270);
pos6(hair,0); pos7(vair,90); pos8(curve,180);
top y3r=top y7r=h+oo; bot y5r=vround(.9[0,y4]-.5vair);
x3=.5[x2,x4]; x7=.5[x6,x8]; lft x8r=hround .5u;
x5=.5[x4,x6]; rt x6r-lft x4r=min(stem,2hair)+2eps;
if x4l>x6l: x4l:=x6l:=x5; fi
pos9(vair,290);pos10(vair,250);
y9r=y10r=0; x9=w-x10=x2+1/2(x1-x2);
filldraw stroke z9e{dir30}...z2e{up}...z3e{left}
 ...{down}z4e...{right}z5e;  % left arc
filldraw stroke z5e{right}...z6e{up}...z7e{left}
 ...{down}z8e...z10e{dir330};
penlabels(1,2,3,4,5,6,7,8,9,10); endchar;

cmchar "Left-hook P";
beginchar(incr ipacode,10u#+serif_fit#,x_height#,desc_depth#);
italcorr .5x_height#*slant+min(.5curve#-.85u#,-.1u#);
adjust_fit(serif_fit#+.5u#,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(side_gap-.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=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=0;
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
left_tail(2,9,10,11,stem,hround(-.75u));
penlabels(0,1,2,3,4,5,6,7,8,9,10,11); endchar;

cmchar "Q-P ligature";
beginchar(incr ipacode,CT(15u#,15.56u#),x_height#,desc_depth#);
italcorr .5x_height#*slant+min(.5curve#-.85u#,-.1u#);
adjust_fit(0,0);
numeric w_org; w_org=w; w:=10u if Times_Compat: +.28u 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-side_gap+.5stem');
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),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=-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[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,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
w:=w_org;
pickup tiny.nib; pos11(stem',0); pos12(stem,0);
pos10'(stem',0); pos10(stem,0); z10l=z10'l; x10'=x11; x10=x12;
x11l=x1l; top y11=h if serifs: +min(oo,serif_drop) fi;
numeric edge; edge=rt x12r;
pickup fine.nib; pos13(if hefty:thin_join else: hair fi,180);
pos14(vair',90); pos15(curve,0); pos16(vair,-90); penpos17(x13l-x13r,-180);
rt x13l=max(rt x13l-(lft x13r-tiny.lft x12l), 1/3[rt x12,edge]);
y13=1/8[bar_height,x_height];
x14l=w-5u+serif_fit+.5u; top y14r=x_height+oo;
rt x15r=hround min(w-1.35u+.5curve,w-.6u); y15=.5x_height;
x16l=x14l-.2u; bot y16r=-oo;
x17=x13; y17=min(y13,y16+y14-y13+.6vair);
numeric X, X';
(X,y14r)=whatever[z13l,z14l]; x14r:=min(X,.5[x15r,x14]);
(X',y16r)=whatever[z17l,z16l]; x16r:=min(X',.5[x15r,x16]);
filldraw stroke z13e{up}...{right}z14e&super_arc.e(14,15)
 &super_arc.e(15,16)&z16e{left}...{up}z17e;  % bowl
penlabels(0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18); endchar;

cmchar "Reversed esh with top loop";
beginchar(incr ipacode,CT(5u#,5.56u#),asc_height#,desc_depth#);
italcorr asc_height#*slant-1u#;
adjust_fit(.5hair#+.25u# if monospace:+1u# fi,.5u# if monospace:+1.5u# fi);
pickup tiny.nib; pos1(stem',0); pos2(stem',0);
lft x1l=hround(.5w-.5stem'); x2=x1; y2=0; h-y1=d;
filldraw stroke z1e--z2e; % stem
if serifs: right_tail(2,3,4,5,stem',hround(w+1u),.88,.5,1/3);
else: right_tail(2,3,4,5,stem',hround(w+1u),.833,.5,1/3); fi
if serifs: pickup tiny.nib;
 pos1.a(stem',0); z1=z1.a;
 x6=x1.a; top y6=1/3[y1.a,h]; pos6(stem',0);
 pos7(vair,90); pos8(hair,180); pos9(vair,270); pos10(hair,360);
 x7=x9=.5[x6,x8r]; top y7r=h+oo; y9r=.4[x_height,h]-vair;
 y8=y10=.5[y9r,y7r]; lft x8r=hround-.5u; x10r=x1;
 filldraw stroke z1.a e--z6e{up}...z7e{left}...z8e{down}...
  {right}z9e...{up}z10e; % arc and loop
else: pickup fine.nib;
 pos1.a(stem',0); z1=z1.a;
 x6=x1.a; top y6=1/3[y1.a,h]; pos6(stem',0);
 pos7(vair,90); pos8(.5[vair,flare],180); pos9(vair,270);
 pos10(.5[vair,flare],315);
 x7=x9=.5[x6r,x8r]; top y7r=h+o; y9r=.4[x_height,h]-vair;
 lft x8r=hround(-.5u-.5vair); y8=y10=.5[y9r,y7r]; x10l=x1l;
 filldraw stroke z1.a e--z6e & super_arc.e(6,7)
  & z7e{left}...z8e{down}...{right}z9e...{up}z10e; fi
penlabels(1,2,3,4,5,6,7,8,9,10); endchar;

% This shape is found in PSG (1996:176).
cmchar "Front-hook T";
beginchar(incr ipacode,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(3u#,if serifs: 0 else: -.5u# fi);
numeric shaved_stem; shaved_stem=hround(stem if hefty:-\\2stem_corr fi);
pickup fine.nib; pos2(shaved_stem,180);pos3(shaved_stem,180);
lft x2r=lft x3r=hround(side_gap-.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;
if hefty: pos7(bar,90);
 filldraw stroke z7e--z8e;  % crossbar
 pickup tiny.nib; pos1(hround(shaved_stem-stem_corr),0);
 rt x1r=fine.rt x2l; 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 x2l; top y1=h;
 filldraw z1l{down}...{left}z7r--z7l--z8l
  --z8r--(x1r,y8r)--z1r--cycle; fi  % upper terminal and crossbar
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[x3l,x5l];
 (x,y4r)=whatever[z4l,z5l]; x4r:=max(x,.5[x3r,x4]);
 filldraw stroke z2e..super_arc.e(3,4)...{up}z5e;  % stem and hook
 pickup crisp.nib; pos6(hair,0); pos5'(hair,0);
 x6=x5=x5'; top y6=max(vround .75bar_height,top y5); y5=y5';
 if Times_Compat: y6l:=.2[y5l,y6l]; y6r:=y6l; fi
 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[x3l,x5l]; x4r:=1/3[x3r,x5r]; y3l:=y3l+.2vair;
 filldraw stroke z2e..super_arc.e(3,4);  % stem and hook
 path p; p=stroke z4e{right}..tension .9 and atleast 1..z5e;  % terminal
 if (xpart(z5l-precontrol 1 of p)<0) or (xpart(z5r-postcontrol 2 of p)<0):
  filldraw stroke z4e{right}...{up}z5e;
 else: filldraw p; fi fi;
y10=y7; x10=x2r;
front_hook(10,11,12,13,bar,90,-2.5u,.55x_height,.05,1/2,.5);
penlabels(1,2,3,4,5,6,7,8,10,11,12,13); endchar;

cmchar "Curly-tail turned T";
beginchar(incr ipacode,6u#+max(u#,.5stem#),x_height#,desc_depth#);
italcorr .7x_height#*slant -.5u#;
adjust_fit(if serifs: 0 else: -.5u# fi,0 if monospace:+1u# fi);
numeric shaved_stem,td; shaved_stem=hround(stem if hefty:-\\2stem_corr fi);
td=min(asc_height,if hefty:9/7 else:10/7 fi\\ x_height)-x_height;
td:=vround .7td;
pickup fine.nib; pos2(shaved_stem,0);pos3(shaved_stem,0);
rt x2r=rt x3r=hround(w-(2.5u-.5shaved_stem));
y2=y8; y3=min(h-.5bar_height,h-2vair);
pickup crisp.nib; pos8(bar,270);
lft x8=hround 1.3u; bot y8r=0; rt x7=hround(w-1/3u); y7l=y8l;
if hefty: pos7(bar,270);
 filldraw stroke z7e--z8e;  % crossbar
 pickup tiny.nib; pos1(hround(shaved_stem-stem_corr),180);
 lft x1r=fine.lft x2l; bot y1=-td;
 penpos2'(x1l-x1r,180); x2'=x1; y2'=y2;
 filldraw stroke z1e--z2'e;  % upper terminal
else: pos7(vair,270); pos1(hair,180);
 lft x1r=fine.lft x2l; bot y1=-td;
 filldraw z1l{up}...{right}z7r--z7l--z8l
  --z8r--(x1r,y8r)--z1r--cycle; fi  % upper terminal and crossbar
pickup fine.nib; interim superness:=more_super;
pos4(vair',90); top y4r=h+oo; lft x5r=hround u;
if serifs: pos5(hair,180); y5=y3; x4l=.5[x3l,x5l];
 (x,y4r)=whatever[z4l,z5l]; x4r:=min(x,.5[x3r,x4]);
 filldraw stroke z2e..super_arc.e(3,4)...{down}z5e;  % stem and hook
 pickup crisp.nib; pos6(hair,180); pos5'(hair,180);
 x6=x5=x5'; bot y6=min(vround (h-.75bar_height),bot y5); y5=y5';
 if Times_Compat: y6l:=.2[y5l,y6l]; y6r:=y6l; fi
 filldraw stroke z5'e--z6e;  % terminal
else: pos5(vair,105); bot y5l=vround .2[bot y4l,h-bar_height];
 x5l:=good.x x5l; x4l=1/3[x3l,x5l]; x4r:=1/3[x3r,x5r]; y3l:=y3l-.2vair;
 filldraw stroke z2e..super_arc.e(3,4);  % stem and hook
 path p; p=stroke z4e{left}..tension .9 and atleast 1..z5e;  % terminal
 if (xpart(z5l-precontrol 1 of p)>=0) or (xpart(z5r-postcontrol 2 of p)>=0):
  filldraw stroke z4e{left}...{down}z5e;
 else: filldraw p; fi fi;
if serifs: pos10(vair,90); pos11(hair,10); pos12(vair,-100); pos13(hair,190);
else: pos10(vair,90); pos11(.6hair,10); pos12(vair,-100); pos13(vair,240); fi
bot y10l=-d-o; x10=.4[x11,x1]; lft x11l=hround 1u; y11=-.7d;
z12=(x1,-.4d); lft x13r=hround(w-1u); y13=-d-o;
filldraw stroke z1e..tension .9 and atleast 1..{left}z10e...z11e
 ...z12e...{down}z13e;
penlabels(1,2,3,4,5,6,7,8,10,11,12,13); endchar;

cmchar "Turned two";
beginchar(incr ipacode,CT(9u#,10u#),x_height#,fig_height#-x_height#);
italcorr x_height#*slant-.5serif_fit#-.3u#;
adjust_fit(0,0);
numeric arm_thickness, hair_vair; hair_vair=.25[vair,hair];
arm_thickness=Vround(if hefty:slab+2stem_corr else:.4[stem,cap_stem] fi);
pickup crisp.nib; pos7(arm_thickness,90); pos8(hair,180);
top y7r=h; rt x7=hround(w-.9u); lft x8r=hround .9u; y8=good.y(y7l-beak/2)-eps;
arm(7,8,a,.3beak_darkness,-beak_jut);  % arm and beak
pickup fine.nib; pos2(slab,270); pos3(.4[curve,cap_curve],180);
bot y2r=-d-o; x2=.5(w+.5u); lft x3r=hround .9u; y3-.5vair=h-.75(h+d);
if serifs: numeric bulb_diam; bulb_diam=hround(flare+2/3(cap_stem-stem));
 pos0(bulb_diam,360); pos1(cap_hair,360);
 rt x1r=hround(w-.9u); y1+.5bulb_diam=h-2/3(h+d);
 (x,y2l)=whatever[z1l,z2r]; x2l:=x; bulb(2,1,0);  % bulb and arc
else: x2l:=x2l+.25u; pos1(flare,angle(-9u,h)+180);
 rt x1r=hround(w-.75u); top y1l=vround (h-.7(h+d));
 y1r:=good.y y1r-eps; x1l:=good.x x1l;
 filldraw stroke term.e(2,1,right,.9,4); fi  % terminal and arc
pos4(.25[hair_vair,cap_stem],180);
pos5(hair_vair,180); pos6(hair_vair,180);
y5=h-arm_thickness; y4=.3[y5,y3]; bot y6=max(y5,h-slab,bot y7l);
rt x6l=crisp.rt x7; z4l=whatever[z6l,(x3l,top (h-.58(h+d)))];
z5l=whatever[z6l,z4l];
erase fill z4l--z6l--rt z6l--(rt x6l,y4l)--cycle;  % erase excess at left
filldraw stroke z2e{left}..tension atleast .9 and atleast 1
 ..z3e{up}.. z4e---z5e--z6e;  % stroke
penlabels(0,1,2,3,4,5,6,7,8); endchar;

cmchar "Bent-tail yogh";
beginchar(incr ipacode,CT(8u#,8.88u#),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=.4[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.8)-eps;
 arm(5,6,a',beak_darkness,-.4beak_jut);  % upper arm and beak
 pickup fine.nib;
 pos12(stem,angle(z2-z3)); z12l=z3l;
 pos7(curve,-20); pos8(curve,-20); pos9(vair,90); pos10(hair,135);
 rt x7r=hround(w-.75u); y7=.2[bot y12l,top y8l];
 x8=hround .3[.75u, w-.8u]; y8=-1/2d;
 x9=.5[x8l,x7r]; bot y9l=-d-oo;
 x10=x7r; y10=.7[y9,y8];
 filldraw stroke z12e{right}...z7e{down}.. tension 1.2 ..{down}z8e...
  {right}z9e...z10e;  % bowl and tail
penlabels(1,2,3,4,5,6,7,8,9,10,12); endchar;

cmchar "Turned three";
beginchar(incr ipacode,CT(9u#,10u#),x_height#,fig_height#-x_height#);
italcorr x_height#*slant-.5u#;
adjust_fit(0,0);
numeric top_thickness,mid_thickness,bot_thickness;
top_thickness=max(fine.breadth,vround(slab-2vair_corr));
mid_thickness=max(fine.breadth,vround 2/3vair);
bot_thickness=max(fine.breadth,vround(slab-vair_corr));
pickup fine.nib; pos2(top_thickness,270); bot y2r=-d-o;
pos3(max(fine.breadth,.6[curve,cap_curve]-stem_corr),180);
lft x3r=hround 1.25u;
pos4(vair,90); pos5(vair,90);
pos6(mid_thickness,270); x2=x6=x8=.5[w-1.5u,x7];
pos7(cap_curve,180); lft x7r=hround .75u; rt x5=max(hround(w-3u),rt x6)+eps;
pos8(bot_thickness,90); top y8r=h+o;
y3=.6[bot y4l,top y2l]; y7=.5[top y6l,bot y8l];
bot y5l=vround(h-.54(h+d)-.5vair); y5r=y6l;
x4=1/3[x5,x3l]; z4=z5-whatever*(15u,.1(h+d));
filldraw stroke pulled_super_arc.e(2,3)(.5superpull)
 & z3e{up}...z4e---z5e;  % upper bowl
filldraw z5r--z6l--z6r--z5l---cycle;  % middle tip
filldraw stroke pulled_super_arc.e(6,7)(.5superpull)
 & pulled_super_arc.e(7,8)(.5superpull);  % lower bowl
if serifs: numeric bulb_diam[];
 bulb_diam1=flare+.5(cap_stem-stem); bulb_diam2=flare+cap_stem-stem;
 pos0(bulb_diam1,360); pos1(hair,360);
 rt x0r=hround(w-1.25u);
 y0=max((h-.9(h+d))+.5bulb_diam1,(h-.75(h+d))-.5bulb_diam1);
 bulb(2,1,0);  % upper bulb
 pos10(bulb_diam2,0); pos9(cap_hair,0);
 rt x10r=hround(w-.75u);
 y10=min((h-.1(h+d))-.5bulb_diam2,(h-.3(h+d))+.5bulb_diam2);
 bulb(8,9,10);  % lower bulb
else: pos1(.5[vair,flare],angle(-8u,h)+180);
 rt x1r=hround(w-u); top y1l=vround(h-.75(h+d))-o;
 y1r:=good.y y1r-eps; x1l:=good.x x1l;
 pos9(bot_thickness,angle(-2u,-h)+180);
 rt x9r=hround(w-.75u); bot y9l=vround(h-.25(h+d))+o;
 y9r:=good.y y9r+eps; x9l:=good.x x9l;
 filldraw stroke term.e(2,1,right,1,4);  % upper terminal
 filldraw stroke term.e(8,9,right,1,4); fi  % lower terminal
penlabels(0,1,2,3,4,5,6,7,8,9,10); endchar;

% N.B. This symbols is not a descender.
cmchar "Curly-tail inverted glottal stop";
beginchar(incr ipacode,CT(9u#,10u#),asc_height#,0);
italcorr .5x_height#*slant;
adjust_fit(0,0);
pickup tiny.nib; pos2(vair,-90); pos3(curve,0);
pos4(vair,90); pos5(stem,0); pos6(stem,0);
x5=x6; x2=.5w; x4=x5l; rt x3r=hround(w-u);
lft x6l=hround(.42w-.5stem); top y6=h;
bot y2r=-oo; y3=.5[y2,y4]; y4r=.9x_height; y5=y4l;
{{interim superness:=more_super;
 filldraw stroke pulled_super_arc.e(2,3)(superpull)
  & z3e{up}...{(-10,-1)}z4e;
 filldraw stroke z5e--z6e\\}};  % arc and stem
pos1(stem-stem_corr, 180); lft x1r=hround u; y1=.5[y3,y2]; 
pos7(vair,-270); x7=.2[x2,x6]; y7=.3[y3,y2]; 
pos8(hair,0); rt x8r=hround(w-2u); bot y8=-.15x_height;
filldraw stroke z2e{left}...{up}z1e...z7e...{dir-80}z8e;
penlabels(0,1,2,3,4,5,6,7,8); endchar;

% Attested in PSG (1996:211) as a typesetter's error for a normal
% glottal stop. The error is said to appear in the second edition
% of Gimson (1970).
%
% Why do I have to make a symbol like this?  Sigh...
%
cmchar "Turned glottal stop (PSG 1996:211)";
beginchar(incr ipacode,CT(9u#,10u#),asc_height#,0);
italcorr .8asc_height#*slant-.5u#;
adjust_fit(0,0);
pickup tiny.nib; pos7(stem,0); top y7=h; x7=.53w;
pos2(vair,270); pos3(curve,180);
pos4(vair,90); pos5(stem,0); pos6(stem,180);
x2=x5=x6=x7; x4=x5r;
lft x3r=hround u; top y6=h-.3x_height;
bot y2r=-oo; y3=.5[y2,y4]; y4r=.5h; y5=y4l;
{{interim superness:=more_super;
 filldraw stroke pulled_super_arc.e(2,3)(superpull)
  & z3e{up}...{(10,1)}z4e;
 filldraw stroke z5e--z7e\\}};  % arc and stem
if serifs: pos1(hair,0); pos0(flare,0);
 rt x1r=hround(w-u); y1=.3[y3,y2]; 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],290);
 rt x1r=hround(w-u); bot y1r=vround .9[y6,top y2r];
 filldraw stroke term.e(2,1,right,1,4); fi  % terminal
penlabels(0,1,2,3,4,5,6,7); endchar;

cmchar "Pipe (a variety with no descender)";
beginchar(incr ipacode,CT(5u#,5.56u#),asc_height#,0);
italcorr asc_height#*slant+.5rule_thickness#-2u#;
adjust_fit(0,0);
numeric thickness; thickness=hround.4[hair,stem];
pickup tiny.nib; pos1(thickness,0); pos2(thickness,0);
lft x1l = lft x2l = hround(.5w-.5thickness);
top y1=h+o; bot y2=-d-o;
filldraw stroke z1e--z2e;
penlabels(1,2); endchar;

cmchar "Double pipe (a variety with no descender)";
beginchar(incr ipacode,CT(8u#,8.88u#),asc_height#,0);
italcorr asc_height#*slant+.5rule_thickness#-2u#;
adjust_fit(0,0);
numeric thickness; thickness=hround(.4[hair,stem]-2stem_corr);
pickup tiny.nib; pos1(thickness,0); pos2(thickness,0);
pos3(thickness,0); pos4(thickness,0);
x1=x2; x3=x4=w-x1; lft x1l = hround((w-3.2u-thickness)/2);
top y1=top y3=h+o; bot y2=bot y4=-d-o;
filldraw stroke z1e--z2e; filldraw stroke z3e--z4e;
penlabels(1,2,3,4); endchar;

cmchar "Double-barred pipe (a variety with no descender)";
beginchar(incr ipacode,10u#,asc_height#,0);
italcorr asc_height#*slant+.5rule_thickness#-1.5u#;
adjust_fit(0,0);
numeric thickness[]; thickness1=hround.4[hair,stem];
pickup tiny.nib; pos1(thickness1,0); pos2(thickness1,0);
lft x1l = lft x2l = hround(.5w-.5thickness1);
top y1=h+o; bot y2=-d-o;
filldraw stroke z1e--z2e;
thickness2=vround .3[vair,flare];
pos3(thickness2,90); pos4(thickness2,90);
pos5(thickness2,90); pos6(thickness2,90);
lft x3l = lft x5l = hround 1u;
rt x4l = rt x6l = hround(w-1u);
top y3r = top y4r = h-d-bot y5;
bot y5l = bot y6l = vround(1/3(h+d)-d-.5thickness2);
filldraw stroke z3e--z4e;
filldraw stroke z5e--z6e;
penlabels(1,2,3,4,5,6); endchar;

cmchar "L-Fish-hook R ligature";
numeric r_flare#; r_flare#=.75[if serifs: stem# else: vair# fi,flare#];
define_whole_blacker_pixels(r_flare);
beginchar(incr ipacode,CT(if serifs:max(7u#,5.5u#+r_flare#) else:6.5u# fi,6.66u#),
 asc_height#,0);
italcorr x_height#*slant if not serifs: +.25u# fi;
adjust_fit(serif_fit#,0);
pickup fine.nib; top y4r=x_height+oo;
if serifs: pos4(vair,90); pos5(hair,0); x4=.5[x6,.5w];
 rt x5r=hround(w-if Times_Compat: .25u else: .5u fi +.5);
 y5+.8r_flare=.9[bar_height,x_height]+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(side_gap-.5stem')+stem'; top y0'=bar_height+1.8u;
filldraw stroke z0'e{up}...{right}z4e;  % arc
pickup tiny.nib; pos1(stem',0); pos2(stem',0);
x1=x2=x0'; top y1=h; bot y2=0;
filldraw stroke z1e--z2e;  % stem
if serifs: sloped_serif.l(1,2,a,1/3,jut,serif_drop);  % upper serif
 dish_serif(2,1,b,1/3,jut,c,1/3,1.25jut); fi  % lower serif
penlabels(1,2,0',4,5,6); endchar;

ipacode:=79;

cmchar "A variety of thorn (1)";
beginchar(incr ipacode,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(side_gap-.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
penlabels(0,1,2,3,4,5,6,8); endchar;

cmchar "A variety of thorn (2)";
beginchar(incr ipacode,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(side_gap-.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=if serifs: -.7d; else: -d; fi 
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
 pickup tiny.nib; pos10(stem,0); pos11(vair,-90);
 z10=z2; lft x11l=.5u; y11l=-d-oo;
 varm(10,11,b,.8beak_darkness,-1.5beak_jut); fi
penlabels(0,1,2,3,4,5,6,8,10,11); endchar;

cmchar "A variety of thorn (3)";
beginchar(incr ipacode,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(side_gap-.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: dish_serif(1,2,a,1/3,jut,d,1/3,jut); % 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,8); endchar;

cmchar "A variety of thorn (4)";
beginchar(incr ipacode,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(side_gap-.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=0;
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
left_tail(2,9,10,11,stem,hround(-.75u));
penlabels(0,1,2,3,4,5,6,8,9,10,11); endchar;

cmchar "A variety of glottal stop (1)";
beginchar(incr ipacode,CT(9u#,10u#),asc_height#,0);
italcorr .8asc_height#*slant;
adjust_fit(0,0);
pickup tiny.nib; pos7(dot_size,0); pos8(dot_size,90);
lft x7l=hround(.5w-.25u-.5dot_size); bot y8l=0; z7=z8;
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(bot_width,0); pos6(bot_width,0);
x2=x4=x5=x6=x7; rt x3r=hround(w-u); bot y6=0;
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---z6e\\}};  % arc and stem
if serifs: pos1(hair,180); pos0(flare,180);
 lft x1r=hround u; y1=y3; bulb(2,1,0);  % bulb
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,8); endchar;

cmchar "A variety of glottal stop (2)";
beginchar(incr ipacode,CT(9u#,10u#),asc_height#,0);
italcorr .8asc_height#*slant-.5u#;
adjust_fit(0,0);
pickup tiny.nib; pos7(stem,0); bot y7=0; x7=.47w;
pos2(vair,90); pos3(curve,0);
pos4(vair,-90); pos5(stem,0); pos6(stem,0);
x2=x5=x6=x7; x4=x5l;
rt x3r=hround(w-u); y6=.67[y3,y7];
top y2r=h+oo; y3=.5[y2,y4]; y4r=.5y2; y5=y4l;
{{interim superness:=more_super;
 filldraw stroke pulled_super_arc.e(2,3)(superpull)
  & z3e{down}..{down}z6e--z7e\\}};  % arc and stem
if serifs: pos1(hair,180); pos0(flare,180);
 lft x1r=hround u; y1=.3[y3,y2]; bulb(2,1,0);  % bulb
 dish_serif(7,5,e,1/3,jut,f,1/3,jut); %serif
else: pickup fine.nib; pos2'(vair,90); z2'=z2;
 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 "A variety of glottal stop (3)";
beginchar(incr ipacode,CT(8u#,8.88u#),asc_height#,0);
italcorr .8asc_height#*slant-.5u#;
adjust_fit(0,0);
pickup tiny.nib;
numeric bot_width;
bot_width=if hefty:max(hround .8dot_size,fine.breadth) else: hair fi;
pos7(bot_width,0); bot y7=0; x7=.4w;
pos2(vair,90); pos3(curve,-60);
pos4(min(curve,3vair),-90); pos5(bot_width,0); pos6(bot_width,0);
x2=x5=x6=x7; x4=x5l;
rt x3r=hround(w-u); bot y6=.3x_height;
top y2r=h+oo; y3=.6[y2,y4]; y4r=.4y2; y5=y4r;
{{interim superness:=more_super;
 filldraw stroke pulled_super_arc.e(2,3)(superpull)
  ..z3e{down}..z4e;
 filldraw stroke z5e--z7e\\}};  % arc and stem
if serifs: pos1(hair,180); pos0(flare,180);
 lft x1r=hround 2u; y1=.8[y3,y2]; bulb(2,1,0);  % bulb
% dish_serif(7,5,e,1/3,jut,f,1/3,jut); %serif
else: pickup fine.nib; pos2'(vair,90); z2'=z2;
 pos1(vround 5/7[vair,flare],110);
 lft x1r=hround 1.5u; 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;

%%%%%%%% Smallcaps

ipacode:=oct"157";

smallcap_setup;

def sc_hair  = hair enddef;
def sc_stem  = stem enddef;
def sc_curve = curve enddef;
def sc_jut   = cap_jut enddef;
def sc_bar   = cap_bar enddef;
def sc_band  = cap_band enddef;

% romanu.mf -> tipasc.mf conversion:
% 
% x_height    -> .626x_height
% bar_height  -> .632bar_height
% cap_height  -> x_height
% comma_depth -> 44/70comma_depth
% cap_hair    -> sc_hair
% cap_stem    -> sc_stem
% cap_curve   -> sc_curve
% cap_ess     -> sc_ess
% cap_jut     -> sc_jut
% cap_bar     -> sc_bar
% cap_band    -> sc_band

cmchar "Inverted small capital A";
beginchar(incr ipacode,13u#,x_height#,0);
italcorr x_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric left_stem,right_stem,outer_jut,alpha;
right_stem=sc_stem-stem_corr;
left_stem=min(sc_hair if hefty: -3stem_corr fi,right_stem);
outer_jut=.8sc_jut; x1l=w-x4r=l+letter_fit+outer_jut+.5u; y1=y4=h;
x2-x1=x4-x3; x3r=x2r+apex_corr; y2=y3=-apex_o-apex_oo;
alpha=diag_ratio(2,left_stem,y2-y1,x4r-x1l-apex_corr);
penpos1(alpha*left_stem,0); penpos2(alpha*left_stem,0);
penpos3(alpha*right_stem,0); penpos4(alpha*right_stem,0);
z0=whatever[z1r,z2r]=whatever[z3l,z4l];
if y0>cap_notch_cut: y0:=cap_notch_cut;
 fill z0+.5right{up}...{z4-z3}diag_end(3l,4l,1,1,4r,3r)
  --diag_end(4r,3r,1,1,2l,1l)--diag_end(2l,1l,1,1,1r,2r){z2-z1}
  ...{down}z0+.5left--cycle; % left and right diagonals
else: fill z0--diag_end(0,4l,1,1,4r,3r)--diag_end(4r,3r,1,1,2l,1l)
  --diag_end(2l,1l,1,1,1r,0)--cycle; fi % left and right diagonals
penpos5(whatever,angle(z2-z1)); z5=whatever[z1,z2];
penpos6(whatever,angle(z3-z4)); z6=whatever[z3,z4]; y6=y5;
if hefty: y5l else: y5 fi =h-5/12(h-y0);
y5r-y5l=y6r-y6l=sc_band; penstroke z5e--z6e; % bar line
if serifs: numeric inner_jut; pickup tiny.nib;
 prime_points_inside(1,2); prime_points_inside(4,3);
 if rt x1'r+sc_jut+.5u+1<=lft x4'l-sc_jut: inner_jut=sc_jut;
 else: rt x1'r+inner_jut+.5u+1=lft x4'l-inner_jut; fi
 dish_serif(1',2,a,1/2,outer_jut,b,.6,inner_jut)(dark);  % left serif
 dish_serif(4',3,c,1/2,inner_jut,d,1/3,outer_jut); fi  % right serif
penlabels(0,1,2,3,4,5,6); endchar;

cmchar "Small capital A-O Ligature";
beginchar(incr ipacode,18u#,x_height#,0);
italcorr .7x_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,0);
numeric left_stem,mid_stem,outer_jut,alpha;
mid_stem=max(tiny.breadth,hround .9[mfudged.hair,mfudged.sc_stem]);
pickup tiny.nib; pos1(mid_stem,0); pos2(mid_stem,0);
lft x1l=lft x2l=hround(if monospace or hefty:.55 else:.5 fi\\w-.75u);
top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
pickup crisp.nib; pos3(slab,90); pos4(mfudged.hair,0);
top y3r=h; x3=x1; pos5(sc_bar,-90); x5=x1;
top y5l=vround(if hefty:.52 else:.48 fi\\[y2,y1]+.5sc_bar);
pos0(sc_bar,90); z0=z5;
pos8(slab if not serifs:+2stem_corr fi,-90);
bot y8r=0; x8=x2;
left_stem=if monospace:fudged.hair else: sc_hair fi if hefty: -3stem_corr fi;
outer_jut=.8sc_jut; x11l=l+letter_fit+outer_jut+.5u; y11=0;
x12=x1l-apex_corr-if monospace:2 fi\\u; y12=h;
alpha=diag_ratio(1,.5left_stem,y12-y11,x12-x11l);
penpos11(alpha*left_stem,0); penpos12(alpha*left_stem,0);
fill diag_end(12l,11l,1,1,11r,12r)
 --diag_end(11r,12r,1,1,12l,11l)--cycle; % diagonal
y10=h-slab; z10=whatever[z11,z12];
fill z10--(x1,y10)--(x1,h)--z12--cycle;  % link
penpos13(whatever,angle(z2-z1)); z13=whatever[z11,z12];
penpos14(sc_band,90); x14=x0; y13l=y14l; y13r=y14r;
if hefty: y14r=.4h; else: y14=y0; fi
penstroke z13e--z14e; % bar line
penpos21(vair,90); penpos23(vair,-90);
if monospace: penpos22(fudged.sc_stem,0);
 interim superness:=sqrt superness;  % make |"O"|, not |"0"|
else: penpos22(hround(sc_curve-stem_corr),0); fi
x21=x23=rt x1r+2u; y21r=h+o; y23r=-o; y22=.5h-vair_corr; x22r=hround(w-u);
rt x24=rt x25=tiny.rt x1r; y24=2/3h; y25=1/3h; y22l:=.52h;
penstroke super_arc.e(21,22) & super_arc.e(22,23);  % left half of bowl
fill z23r{left}..{left}(x2,0)--(x1,h){right}..{right}z21r
 --z21l{left}...{z24-z21l}(.82[x21l,x24],.82[y24,y21l])
 ...z24---z25...{z23l-z25}(.82[x23l,x25],.82[y25,y23l])
 ...{right}z23l--cycle;  % right half of bowl
if serifs: numeric inner_jut; pickup tiny.nib;
 prime_points_inside(11,12);
 if rt x11'r+sc_jut+.5u+1<=lft x2l-.75sc_jut: inner_jut=sc_jut;
 else: rt x11'r+inner_jut+.5u+1=lft x2l-.75inner_jut; fi
 dish_serif(11',12,i,1/2,outer_jut,j,.6,inner_jut)(dark);  % lower left serif
 serif(1,2,a,1/3,-(sc_jut+x1l-x12));  % upper serif
 serif(2,1,c,1/3,-.75inner_jut); fi  % lower middle serif
penlabels(0,1,2,3,5,8,10,11,12,13,14,21,22,23,24,25); endchar;

cmchar "Small capital Greek delta";
beginchar(incr ipacode,15u#,x_height#,0);
adjust_fit(0,0);
numeric left_stem,alpha;
left_stem=sc_hair if hefty: -3stem_corr fi;
x1l=w-x4r=.75u; y1=y4=0;
x2-x1=x4-x3; x3r=x2r+apex_corr; y2=y3=h+apex_o+apex_oo;
alpha=diag_ratio(2,left_stem,y2-y1,x4r-x1l-apex_corr);
penpos1(alpha*left_stem,0); penpos2(alpha*left_stem,0);
penpos3(alpha*sc_stem,0); penpos4(alpha*sc_stem,0);
fill diag_end(2l,1l,1,1,4r,3r)--diag_end(4r,3r,1,1,2l,1l)--cycle;  % triangle
z0=whatever[z1r,z2r]=whatever[z3l,z4l];
y5=y6=cap_vstem; z5=whatever[z1r,z2r]; z6=whatever[z3l,z4l];
if y0<h-cap_notch_cut: y0:=h-cap_notch_cut;
 unfill z0+.5right{down}...{z4-z3}z6--z5{z2-z1}
  ...{up}z0+.5left--cycle; % counter
else: unfill z0--z5--z6--cycle; fi  % counter
penlabels(0,1,2,3,4,5,6); endchar;

cmchar "Small capital F";
beginchar(incr ipacode,11.5u#-width_adj#,x_height#,0);
italcorr x_height#*slant-beak_jut#-.25u#;
adjust_fit(cap_serif_fit#,0);
h:=vround(h-stem_corr);
pickup tiny.nib; pos1(sc_stem,0); pos2(sc_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5sc_stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
pickup crisp.nib; pos3(slab,90); pos4(hair,0);
top y3r=h; x3=x1; rt x4r=hround(w-.75u); y4=good.y(y3l-beak)-eps;
arm(3,4,e,beak_darkness,beak_jut);  % upper arm and beak
pos5(sc_bar,-90); pos6(hair,0);
top y5l=vround(.5[y2,y1]+.5sc_bar); x5=x1;
pos0(sc_bar,90); pos7(hair,0);
z0=z5; x6=x7; y6-y5l=y0l-y7;
if serifs: rt x6r=hround(w-4u+.5hair); y6=good.y(y5l+.6beak)+eps;
 rt x9r=hround(w-.5u);
else: rt x6r=hround(w-1.5u); y6=y5l+eps; rt x9r=hround(w-.75u); fi
arm(5,6,f,beak_darkness,0); arm(0,7,g,beak_darkness,0);  % middle arm and serif
if serifs: nodish_serif(1,2,a,1/3,sc_jut,b,1/3,.5sc_jut);  % upper serif
 dish_serif(2,1,c,1/3,sc_jut,d,1/3,1.25sc_jut); fi  % lower serif
math_fit(0,ic#-2.5u#); penlabels(0,1,2,3,4,5,6,7,8,9); endchar;

cmchar "Small capital K";
beginchar(incr ipacode,13.5u#,x_height#,0);
italcorr x_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric right_jut,stem[],alpha[];
if serifs: right_jut=.6sc_jut;
else: right_jut=.4tiny; fi
pickup tiny.nib; pos1(fudged.sc_stem,0); pos2(fudged.sc_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5fudged.sc_stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
stem2=max(tiny.breadth,fudged.sc_stem-3stem_corr);
stem1=max(tiny.breadth,fudged.hair if hefty:-3stem_corr fi);
top y3=h; rt x3r=hround(r-letter_fit-u-right_jut);
bot y6=0; rt x6r=hround(r-letter_fit-.75u-right_jut);
x4=x1; y4=1/3h;
alpha1=diag_ratio(1,.5(stem1-tiny),y3-y4,x3r-x4);
penpos3(alpha1*(stem1-tiny),0); penpos4(whatever,-90);
alpha2=diag_ratio(1,.5(stem2-tiny),y1-y6,x6r-x1);
penpos6(alpha2*(stem2-tiny),0);
forsuffixes $=l,r: y3'$=h; y6'$=0; z4$=z3'$+whatever*(z3-z4);
 z5$=z6'$+whatever*(z1-z6)=whatever[z3,z4]; endfor
z5=.5[z5l,z5r];
z3'r=z3r+penoffset z3-z4 of currentpen+whatever*(z3-z4);
% we have also z3'l=z3l+penoffset z4-z3 of currentpen+whatever*(z3-z4);
z6'r=z6r+penoffset z1-z6 of currentpen+whatever*(z1-z6);
z6'l=z6l+penoffset z6-z1 of currentpen+whatever*(z1-z6);
fill z4r--diag_end(4r,3'r,1,.5,3'l,4l)--z4l--cycle;  % upper diagonal
fill z5l--diag_end(5l,6'l,.5,1,6'r,5r)--z5r--cycle;  % lower diagonal
if serifs: numeric inner_jut;
 if rt x2r+sc_jut+.5u+1<=lft x6l-sc_jut: inner_jut=sc_jut;
 else: rt x2r+sc_jut+.5u+1=lft x6l-inner_jut; fi
 dish_serif(1,2,a,1/3,sc_jut,b,1/3,sc_jut); % upper stem serif
 dish_serif(2,1,c,1/3,sc_jut,d,1/3,sc_jut);  % lower stem serif
 dish_serif(3,4,e,2/3,1.2sc_jut,f,1/2,right_jut)(dark); % upper diagonal serif
 dish_serif(6,5,g,1/2,inner_jut,h,1/3,right_jut)(dark);fi% lower diagonal serif
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6); endchar;

cmchar "Turned small capital K";
beginchar(incr ipacode,13.5u#,x_height#,0);
italcorr x_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric right_jut,stem[],alpha[];
if serifs: right_jut=.6sc_jut;
else: right_jut=.4tiny; fi
pickup tiny.nib; pos1(fudged.sc_stem,0); pos2(fudged.sc_stem,0);
rt x1r=rt x2r=hround max(w-2u,w-(3u-.5fudged.sc_stem)); bot y1=0; top y2=h;
filldraw stroke z1e--z2e; % stem
stem2=max(tiny.breadth,fudged.sc_stem-3stem_corr);
stem1=max(tiny.breadth,fudged.hair if hefty:-3stem_corr fi);
bot y3=0; lft x3l=hround(l+letter_fit+u+right_jut);
top y6=h; lft x6l=hround(l+letter_fit+.75u+right_jut);
x4=x1; y4=2/3h;
alpha1=diag_ratio(1,.5(stem1-tiny),y4-y3,x4-x3l);
penpos3(alpha1*(stem1-tiny),0); penpos4(whatever,-90);
alpha2=diag_ratio(1,.5(stem2-tiny),y6-y1,x1-x6l);
penpos6(alpha2*(stem2-tiny),0);
forsuffixes $=l,r: y3'$=0; y6'$=h; z4$=z3'$+whatever*(z3-z4);
 z5$=z6'$+whatever*(z1-z6)=whatever[z3,z4]; endfor
z5=.5[z5r,z5l];
z3'l=z3l+penoffset z3-z4 of currentpen+whatever*(z3-z4);
% we have also z3'l=z3l+penoffset z4-z3 of currentpen+whatever*(z3-z4);
z6'l=z6l+penoffset z1-z6 of currentpen+whatever*(z1-z6);
z6'r=z6r+penoffset z6-z1 of currentpen+whatever*(z1-z6);
fill z4l--diag_end(4l,3'l,1,.5,3'r,4r)--z4r--cycle;  % upper diagonal
fill z5r--diag_end(5r,6'r,.5,1,6'l,5l)--z5l--cycle;  % lower diagonal
if serifs: numeric inner_jut;
 if lft x2l-sc_jut-.5u+1>=rt x6r+sc_jut: inner_jut=sc_jut;
 else: lft x2l-sc_jut-.5u-1=rt x6r+inner_jut; fi
 dish_serif(1,2,a,1/3,sc_jut,b,1/3,sc_jut); % upper stem serif
 dish_serif(2,1,c,1/3,sc_jut,d,1/3,sc_jut);  % lower stem serif
 dish_serif(3,4,e,1/2,right_jut,f,2/3,1.2sc_jut)(dark); % upper diagonal serif
 dish_serif(6,5,g,1/3,right_jut,h,1/2,inner_jut)(dark);fi% lower diagonal serif
math_fit(0,.5ic#); penlabels(1,2,3,3',4,5,6,6'); endchar;

cmchar "Reversed small capital L";
beginchar(incr ipacode,11u#-width_adj#,x_height#,0);
adjust_fit(0, cap_serif_fit#);
italcorr x_height#*slant-1u#;
pickup tiny.nib; pos1(sc_stem,0); pos2(sc_stem,0);
rt x1r=rt x2r=hround min(w-2u,w-(3u-.5sc_stem)); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
pickup crisp.nib; pos3(slab,-90); pos4(hair,180);
bot y3r=0; x3=x2; y4=y3l+beak+eps; lft x4r=hround .75u;
arm(3,4,e,1.2beak_darkness,-beak_jut);  % lower arm and beak
if serifs: dish_serif(1,2,b,1/3,1.25sc_jut,a,1/3,sc_jut);  % upper serif
 nodish_serif(2,1,d,1/3,.5sc_jut,c,1/3,sc_jut); fi  % lower serif
math_fit(0,u#); penlabels(1,2,3,4); endchar;

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

cmchar "Small capital P";
beginchar(incr ipacode,12u#,x_height#,0);
italcorr .75x_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,0);
pickup tiny.nib; penpos1(sc_stem'-tiny,0); penpos2(sc_stem-tiny,0);
pos0(sc_stem',0); pos0'(sc_stem,0);
lft x1l=hround max(2u,3u-.5sc_stem'); top y1=h; bot y2=0;
x1l=x2l=x0l=x0'l; y0=y0'=y7;
penpos3(sc_band,90); penpos4(sc_band,90);
penpos5(sc_curve if hefty:-3stem_corr fi,0);
penpos6(.5[vair,sc_band],-90); penpos7(.5[vair,sc_band],-90);
z3r=top z1; y4=y3; y5=.5[y4l,y6l]; y6=y7;
x7=x2; y7l=vround .5h; x4=x6=.5w+.75u; x5r=hround(w-u);
x4l:=x6l:=x4-.25sc_curve;
filldraw stroke z1e--z0e--z0'e--z2e; % stem
fill stroke z3e..pulled_arc.e(4,5) & pulled_arc.e(5,6)..z7e;  % lobe
if serifs: nodish_serif(1,0,a,1/3,sc_jut,b,1/3,.5sc_jut);  % upper serif
 dish_serif(2,0',c,1/3,sc_jut,d,1/3,sc_jut); fi  % lower serif
math_fit(0,ic#-2.5u#); penlabels(0,1,2,3,4,5,6,7); endchar;

cmchar "Small capital Q";
beginchar(incr ipacode,14u#-width_adj#,x_height#,44/70comma_depth#);
italcorr .7x_height#*slant-.5u#;
adjust_fit(0,0);
numeric light_curve; light_curve=sc_curve-hround stem_corr;
penpos1(vair',90); penpos3(vair',-90);
penpos2(light_curve,180); penpos4(light_curve,0);
if monospace: x2r=hround 1.5u;
 interim superness:=sqrt superness;  % make |"Q"| like |"O"|
else: x2r=hround u; fi
x4r=w-x2r; x1=x3=.5w; y1r=h+o; y2=y4=.5h-vair_corr; y3r=-o;
penstroke pulled_super_arc.e(1,2)(.5superpull)
 & pulled_super_arc.e(2,3)(.5superpull)
 & pulled_super_arc.e(3,4)(.5superpull)
 & pulled_super_arc.e(4,1)(.5superpull) & cycle;  % bowl
pickup tiny.nib;
if hefty: penpos5(1.2(.5[sc_bar,light_curve]),0); penpos6(1.2light_curve,0);
 x5=.5w; x6r=hround(w-1.5u);
 y5=vround .28h; y6=-d;
 fill diag_end(6r,5r,.25,1,5l,6l)--diag_end(5l,6l,.5,1,6r,5r)--cycle;  % tail
else: pos3'(vair,270); pos5(vair,180); pos6(vair,90);
 pos7(sc_curve,85); penpos8(eps,180);
 z3'=z3; x6=x3; top y6r=vround(.2h+.5vair);
 lft x5r=hround(.5w-1.25u-.5vair); y5=.5[y3,y6];
 bot y7l=-d; x7l=2/3[x6,x8]; y8=0; rt x8=hround(x4r+.1u);
 filldraw stroke z3'e{left}...z5e{up}...z6e{right}
  ..z7e{right}...z8e{up}; fi % tail
math_fit(-.3x_height#*slant-.5u#,ic#); penlabels(1,2,3,4,5,6,7); endchar;

cmchar "Reversed small capital R";
beginchar(incr ipacode,if serifs: 12u#+.5max(2u#,sc_curve#)
 else:12.5u#-.5width_adj# fi,x_height#,0);
italcorr x_height#*slant-1u#;
adjust_fit(0, cap_serif_fit#);
pickup tiny.nib; pos1(sc_stem',0); pos2(sc_stem',0);
rt x1r=rt x2r=hround min(w-2u,w-(3u-.5sc_stem')); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
penpos3(sc_band,90); penpos4(sc_band,90);
penpos5(sc_curve if hefty:-3stem_corr fi,180);
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 2.25u;
else: x4=.5w-.5u; x5r=hround u; fi
x4l:=x6l:=x4+.125sc_curve;
fill stroke z3e..pulled_arc.e(4,5) & pulled_arc.e(5,6)..z7e;  % lobe
if serifs: pos6'(vair,-90); pos0(sc_stem,0);
 pos8(sc_curve,0); pos9(vair,-90); pos10(hair,180);
 z6'=z6; rt x0r=rt x8r=hround(x5+2/3u+.5sc_curve);
 y8=1/3[y2,y7]; y0=3/5[y2,y7]; x9=.5[x8l,x10r];
 bot y9r=-o; lft x10r=hround .05u; y10=1/4[y2,y7];
 filldraw stroke z6'e{left}..z0e---z8e....z9e{left}..z10e{up};  % tail
 nodish_serif(1,2,a,1/3,.5sc_jut,b,1/3,sc_jut);  % upper serif
 dish_serif(2,1,c,1/3,sc_jut,d,1/3,sc_jut);  % lower serif
else: penpos8(sc_stem-2stem_corr,180); penpos9(sc_stem,180);
 x8=x6-.5u; y8=y6; x9r=hround .5u; y9=0;
 fill z8l--diag_end(8l,9l,.5,1,9r,8r)--z8r--cycle; fi  % tail
math_fit(0,.75ic#); penlabels(0,1,2,3,4,5,6,7,8,9,10); endchar;

cmchar "Turned small capital U";
beginchar(incr ipacode,13u#+.5width_adj#,x_height#,0);
italcorr .75x_height#*slant-cap_serif_fit#+sc_jut#-2.5u#+min(.5sc_stem#,u#);
if monospace: adjust_fit(cap_serif_fit#-.5u#,cap_serif_fit#-.5u#)
else: adjust_fit(cap_serif_fit#,cap_serif_fit#) fi;
pickup tiny.nib; pos1(sc_stem,0); pos2(sc_stem,0);
pos2'(sc_stem,0); z2'=z2;
pos3(sc_band,90); pos4(sc_hair,180); pos5(sc_hair,180);
x1=x2; x3=.5[x1,x5]; x4=x5; x5r=w-x1r;
bot y1=bot y5=0; y2=y4=2/3h; top y3r=h+o;
rt x1r=hround min(w-2u,w-(3u-.5sc_stem));
filldraw stroke z1e--z2e; % left stem
filldraw stroke pulled_arc.e(2',3)
 & pulled_arc.e(3,4)&z4e--z5e; % arc and right stem
if serifs: dish_serif(1,2,a,1/3,sc_jut,b,1/3,sc_jut); % left serif
 dish_serif(5,4,c,1/2,sc_jut,d,1/2,sc_jut)(dark); fi  % right serif
math_fit(-cap_serif_fit#-.3x_height#*slant-min(x_height#*slant,u#),
 max(.5ic#-.5u#,0)); penlabels(1,2,3,4,5); endchar;

restore_normal_setup;

%%% back to normal.

endinput

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% This accent is now realized as macro.
cmchar "Macron Acute accent";
numeric macron_breadth#; macron_breadth#=.2[vair#,stem#];
beginchar(oct"040",9u#,asc_height#,0);
italcorr h#*slant-.75u#;
adjust_fit(0,0);
numeric macron_breadth; macron_breadth:=Vround .2[vair,stem];
pickup if serifs: crisp.nib else: fine.nib fi;
pos1(macron_breadth,90); pos2(macron_breadth,90);
top y1r=top y2r=vround(.3[x_height,asc_height]+macron_breadth)+o;
lft x1=w-rt x2=hround 1.25u;
filldraw stroke z1e--z2e;  % bar
if serifs: pickup crisp.nib; x3+.5stem=hround(w-2u); x4=2/3[x3,w-x3];
 y3=h+o+eps; pos4(hair,0); y4r=y1l;
 numeric theta; theta=angle(z4-z3)+90;
 pos3(stem,theta);
 filldraw circ_stroke z3e--z4e;  % diagonal
else: pickup fine.nib; pos3(stem,0); pos4(vair,0);
 rt x3r=hround(w-2u); lft x4l=hround(.5w-.75u-.5vair);
 top y3=h+o; y4r=y1l;
 filldraw stroke z3e--z4e; fi  % diagonal
penlabels(1,2,3,4); endchar;

% end of file.
