% tipasym3.mf: TIPA phonetic symbols (3)
% 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
%
% This font is based on:
%   Computer Modern font series by D. E. Knuth and
%   TSIPA by KOBAYASHI Hajime, FUKUI Rei and SHIRAKAWA Shun.
%

cmchar "Hooktop C";
beginchar(oct"301",CT(8u#,8.8u#),x_height#,0);
italcorr .9asc_height#*slant + 1.5u#;
adjust_fit(if monospace: .5u#,1.5u# else: 0,1u# fi);
c_stroke(w);
if serifs: pos6(hair,0); y6=y1; rt x6r=rt x1r;
 hooktop(6,7,8,9,hair,hround(w+2.25u),.9asc_height+.5vair,.95,.55,.5);
else: pos6(vair,0); y6=y1r; rt x6r=rt x1r;
 hooktop(6,7,8,9,vair,hround(w+2.25u),.9asc_height+.5vair,.9,.5,.5); fi
penlabels(0,1,2,3,4,5,6,7,8,9); endchar;

cmchar "Stretched C";
beginchar(oct"302",CT(9u#,10u#),asc_height#,desc_depth#);
italcorr x_height#*slant-.2u#;
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); top y6=0;
filldraw stroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & z3e--z4e & pulled_arc.e(4,5) & pulled_arc.e(5,6);
penlabels(0,1,2,3,4,5,6); endchar;

cmchar "D-Yogh ligature";
beginchar(oct"303",CT(13u#,14.44u#),asc_height#,desc_depth#);
numeric d_w; d_w=if monospace: .48w else: .65w+.5stem+serif_fit fi;
italcorr asc_height#*slant-serif_fit#+.5stem#-1.75u#;
adjust_fit(0,.5serif_fit#);
pickup tiny.nib; pos21(stem',0); pos22(stem,0); % d
pos20'(stem',0); pos20(stem,0); z20r=z20'r; x20'=x21; x20=x22;
rt x21r=hround(d_w-2.5u+.5stem'); top y21=h;
numeric edge; edge=lft x22l;
pickup fine.nib; pos23(if hefty:thin_join else: hair fi,0);
pos24(vair,90); pos25(curve,180); pos26(vair,270); penpos27(x23r-x23l,360);
lft x23l=min(lft x23l-(rt x23r-tiny.rt x22r),1/3[lft x22,edge]);
y23=.616x_height;
x24l=.5(d_w-serif_fit)-.3u; top y24r=x_height+oo;
lft x25r=hround max(1.35u-.5curve,.6u); y25=.5x_height;
x26l=x24l-.2u; bot y26r=-oo;
x27=x23; y27=min(y23,y26+y24-y23+.6vair);
(x,y24r)=whatever[z23l,z24l]; x24r:=max(x,.5[x25r,x24]);
(x',y26r)=whatever[z27l,z26l]; x26r:=max(x',.5[x25r,x26]);
filldraw stroke z23e{up}...pulled_arc.e(24,25)
 & pulled_arc.e(25,26)...{up}z27e; % bowl
y20=ypart(((edge,h)--(edge,0))intersectionpoint(z23l{up}...{left}z24l));
pickup tiny.nib; bot y22=.33x_height;
filldraw stroke z21e--z20'e--z20e--z22e;  % stem
if serifs: sloped_serif.l(21,20',a,1/3,jut,serif_drop); fi % upper serif
h:=x_height; % yogh
yogh_stroke(x20l,.15,x20l-.5u,true,false);
if serifs: pickup tiny.nib; pos40(vair,0);
 x40=x40'=x22l; y40'=.2bar_height; y40=.5[y22,y40'];
 filldraw stroke z22e--z40e; % joint
 pickup fine.nib; pos40'(vair,180); pos12'(vair,180); z12'=z3;
 filldraw stroke z12'e{z3-z5}...{z40'-z22}z40'e; % joint
 penlabels(40',12');
else: pickup tiny.nib; pos40(stem/cosd30,30);
 x40=x22; y40=.3[0,y22];
 filldraw stroke z22e--z40e; fi % joint
penlabels(1,2,3,4,5,6,7,8,9,10,12,20,21,22,23,24,25,26,27,40); endchar;

cmchar "Right-hook schwa";
beginchar(oct"304",CT(11.5u#,12u#),x_height#,0);
italcorr .5[bar_height#,x_height#]*slant+.75u#;
adjust_fit(if monospace:.25u#,0u# else: 0,0 fi);
numeric ow,left_curve,diagbar;
ow=w; w:=if Times_Compat: 8.88u else: 8u fi -.25curve;
left_curve=curve if not serifs: -3stem_corr fi;
if left_curve<tiny.breadth: left_curve:=tiny.breadth; fi
diagbar=if serifs: if monospace: hair else: 1.2hair fi
 else: min(1.1hair,stem) fi;
pickup tiny.nib; pos1(diagbar,180);
pos2(vair,-90); pos3(left_curve,0);
y1=good.y (.33h); bot y2r=-vround 1.5oo; y0l=top y1;
lft x1r=hround min(.5u,1.5u-.5diagbar);
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-(.5bar_height-.9)),y4l-vair); x5r=x1r;
 (x,y4l)=whatever[z4r,z5]; x4l:=max(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,90);
 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],95); lft x5r=hround(.6u);
 y5r=good.y(h-(-y5r+1/3bar_height+y5)); y5l:=good.y y5l; x5l:=good.x x5l;
 filldraw stroke term.e(4',5,left,1,4); fi  % terminal
w:=ow; pickup tiny.nib;
if serifs: if monospace:
  pos10(diagbar,0); pos11(diagbar,0); pos11'(hair,0); pos12(hair,0);
 else: pos10(1.5hair,0); pos11(1.5hair,0); pos11'(1.5hair,0);
  pos12(1.5hair,0); fi
 pos13(vair,90); pos14(hair,180);
else: pos10(diagbar,0); pos11(diagbar,0); 
 pos11'(thin_hair,0); pos12(thin_hair,0);
 pos13(vair,90); pos14(thin_hair,180); fi
lft x10l=lft x1r; top y10l=top y1; top y11l=h+oo;
rt x11r=rt x12r=hround(x3+.5curve+2.25u-.25hair);
y11'=y11; x11'r=x11r;
x13=.5[x11,x14]; y12=y14=.33[y13,x_height];
bot y13l=.55h-.5vair; rt x14l=w;
filldraw stroke z10e--z11e; % diagonal crossbar
filldraw stroke z11'e--z12e{down}...{right}z13e...{up}z14e; % hook
penlabels(1,2,3,4,5,10,11,12,13,14); endchar;

cmchar "Closed epsilon";
beginchar(oct"305",CT(9u#,10u#),x_height#,0);
italcorr x_height#*slant-.5u#;
adjust_fit(0,0);
pickup fine.nib; pos5'(thin_hair,0);
rt x5'r=hround(w-.5u); top y5'l=vround(.45h+.5vair);
epsilon_stroke(false,4u);
filldraw stroke z8e{right}..{up}z5'e..{left}z2e;
penlabels(2,3,4,5,6,7,8,5'); endchar;

cmchar "Closed reversed epsilon";
beginchar(oct"306",CT(9u#,10u#),x_height#,0);
italcorr x_height#*slant-.5u#;
adjust_fit(0,0);
pickup fine.nib; pos5'(thin_hair,180);
lft x5'r=hround.5u; top y5'l=vround(.45h+.5vair);
epsilon_stroke(true,4u);
filldraw stroke z8e{left}..{up}z5'e..{right}z2e;
penlabels(2,3,4,5,6,7,8,5'); endchar;

cmchar "Right-hook reversed epsilon";
beginchar(oct"307",CT(11.5u#,12u#),x_height#,0);
italcorr .5[bar_height#,x_height#]*slant+.5u#;
adjust_fit(0,0);
ow:=w; w:=w-3u;
epsilon_stroke(true,3.5u);
w:=ow;
if serifs: numeric bulb_diam;
 bulb_diam=max(flare-.75(cap_stem-stem),stem);
 pos0(bulb_diam,180); pos1(hair,180);
 lft x0r=hround u; y0=min(.9h-.5bulb_diam,.75h+.5bulb_diam);
 bulb(2,1,0);  % upper bulb
 pos9(bot_thickness,angle(-2u,-h));
else: pos1(.47[vair',flare],100); lft x1r = 1u; top y1r = .9h;
 filldraw stroke term.e(2,1,left,1,4);
 pos9(.6[vair',flare],-100); fi
lft x9r=hround .75u; top y9=vround .25h-o;
y9r:=good.y y9r-eps; x9l:=good.x x9l;
filldraw stroke term.e(8,9,left,1,4);  % lower terminal
if serifs: if monospace: pos3'(hair,0); pos11(hair,0);pos12(hair,0);
 else: pos3'(1.5hair,0); pos11(1.5hair,0);pos12(1.5hair,0); fi
 pos13(vair,90); pos14(hair,180);
else: pos3'(.6hair,0); pos11(.6hair,0);pos12(.6hair,0);
 pos13(vair,90); pos14(.6hair,180); fi
z3'=z3; lft x11l=lft x12l=hround(x3+.5curve+1.5u); top y11l=h+oo;
x13=.5[x11,x14]; y12=y14=.3[y13,x_height];
bot y13l=.5h; x14=w;
filldraw stroke z3'e--z11e; % hook
filldraw stroke z11e--z12e{down}...{right}z13e...{up}z14e;
penlabels(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14); endchar;

cmchar "Baby gamma";
beginchar(oct"310",CT(if serifs: 9.5u# else:9u# fi,10u#),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,raise;
left_stem=fudged.stem-stem_corr;
right_stem=min(fudged.hair if hefty:-2stem_corr fi,left_stem);
outer_jut=.75jut; x1l=w-x4r=l+letter_fit+outer_jut+.25u; y1=y4=h;
raise=if serifs: .45h; else: .5h; fi
x2-x1=x4-x3; x2l+apex_corr=x3l; y2=y3=raise;
alpha=diag_ratio(2,right_stem,y1-y2,x4r-x1l-apex_corr);
penpos1(alpha*left_stem,0); penpos2(alpha*left_stem,0);
penpos3(alpha*right_stem,0); penpos4(alpha*right_stem,0);
z0=whatever[z1r,z2r]=whatever[z3l,z4l];
if y0>notch_cut+raise: y0:=notch_cut+raise;
  fill z0+.5right{up}...{z4-z3}diag_end(3l,4l,1,1,4r,3r)
    --diag_end(4r,3r,1,1,2l,1l)--diag_end(2l,1l,1,1,1r,2r){z2-z1}
    ...{down}z0+.5left--cycle; % left and right diagonals
else: fill z0--diag_end(0,4l,1,1,4r,3r)--diag_end(4r,3r,1,1,2l,1l)
    --diag_end(2l,1l,1,1,1r,0)--cycle; fi % left and right diagonals
if serifs: numeric inner_jut; pickup tiny.nib;
 prime_points_inside(1,2); prime_points_inside(4,3);
 if rt x1'r+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); fi  % right serif
pickup penrazor;
penpos5(alpha*left_stem,0); penpos7(vair,-90); penpos9(alpha*right_stem,180);
y5=y9=y0; z5=whatever[z1,z2]; z9=whatever[z4,z3];
y6=y8=.4[y7,y5] if not serifs:+.5vair fi;
z6=whatever[z1,z2]; z8=whatever[z4,z3];
bot y7r=-o; x7=.5w+.2(left_stem-right_stem);
numeric stem_jut[], y_shift, circle_gap;
circle_gap=(x6-.5left_stem)-(x8+.5right_stem);
stem_jut1=if circle_gap<.5u: .4 else: .1 fi left_stem;
stem_jut2=if circle_gap<.5u: .4 else: .1 fi right_stem;
y_shift=if (left_stem-1.2right_stem)>0: .1[y7,y5] else: 0 fi;
x6:=x6+stem_jut1; x8:=x8-stem_jut2; y8:=y8+y_shift;
penpos6(left_stem,0); penpos8(right_stem,180);
fill stroke z5e{z2-z1}..z6e..{left}z7e..z8e..{z4-z3}z9e; % bottom loop
if not serifs: % minor adjustments
 pos5'(alpha*left_stem,0);pos9'(alpha*right_stem,180);
 y5'=y9'=1.2[y0,y3]; z5'l=whatever[z1l,z2l]; z9'l=whatever[z4r,z3r];
 filldraw z5l--z5'l--z5'--z5--cycle;
 filldraw z9l--z9'l--z9'--z9--cycle; fi
penlabels(0,1,2,3,4,5,6,7,8,9); endchar;

cmchar "Hooktop heng";
beginchar(oct"312",10u#,asc_height#,desc_depth#);
italcorr .7[x_height#,asc_height#]*slant-serif_fit#+.5stem#-u#;
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=.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);
left_tail(4,5,6,7,stem,rt x2r);
penlabels(1,2,3,4,5,6,7,9,10,11); endchar;

cmchar "Iota";
beginchar(oct"314",CT(5u#,5.56u#),x_height#,0); l_width#:=4u#;
adjust_fit(if monospace:2u#,2u# else: u#,0 fi); pickup fine.nib;
pickup tiny.nib; pos1(stem,0); pos2'(stem,0); z2'=z2;
top y1=x_height if serifs: +min(oo,serif_drop) fi;
x2-.5stem=hround(1.5u-.5stem); x4=hround(w-1u+.25hair);
hook_out(2,3,4);  % closing hook
x1=x2; filldraw stroke z1e--z2e; % stem
if serifs: sloped_serif.l(1,2,a,1/3,jut,serif_drop); fi % serif
penlabels(1,2,3,4); endchar;

cmchar "Barred dotless J (an old version)";
beginchar(oct"315",CT(5.5u#,6.66u#),x_height#,desc_depth#);
italcorr x_height#*slant-serif_fit#+.5stem#-.5u#;
adjust_fit(serif_fit#+2stem_shift# if monospace:+1.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; bot y2=-1/3d;
filldraw stroke z1e--z2e;  % stem
if serifs: dish_serif(1,2,b,1/3,1.25jut,c,1/3,jut); % 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
hbar(8,9,lft x1l - hround(1.75u),rt x1r + hround(1.5u),.1x_height);
penlabels(1,2,5,6,7); endchar;

cmchar "Hooktop K";
beginchar(oct"316",CT(9.5u#,10u#),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(side_gap-.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
hooktop(1,7,8,9,stem1,rt x3r,h,.8,.55,.2);
penlabels(0,1,2,3,4,5,6,7,8,9,11); endchar;

cmchar "L-Yogh ligature";
beginchar(oct"320",10u#,asc_height#,desc_depth#);
italcorr x_height#*slant-.5serif_fit#-.3u#;
adjust_fit(serif_fit#+stem_shift#,.5serif_fit#);
pickup tiny.nib; pos21(stem',0); pos22(stem',0); % l
lft x21l=hround(side_gap-.5stem'); x21=x22; top y21=h; bot y22=0;
filldraw stroke z21e--z22e;  % stem
if serifs: sloped_serif.l(21,22,e,1/3,jut,serif_drop);  % upper serif
 dish_serif(22,21,f,1/3,jut,g,1/3,jut); fi  % lower serif
h:=x_height; % yogh
yogh_stroke(x21,.28,x21l+.25u,true,false);
penlabels(1,2,3,4,5,6,7,8,9,10,12,21,22); endchar;

cmchar "Closed omega";
beginchar(oct"321",CT(11u#,12u#),x_height#,0); % 2003/03/16
italcorr .7x_height#*slant;
adjust_fit(0,0); pickup fine.nib;
pos2(curve,-180); lft x2r=hround.5u; y2=y8=.45x_height;
y4=y6=vround.6h; y1r=h+oo; x1=.5w; pos1(vair,90);
pos3(vair,-90); pos4(hair,0); pos5(vair,90);
pos6(hair,180); pos7(vair,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};
penlabels(1,2,3,4,5,6,7,8); endchar;

cmchar "Hooktop P";
beginchar(oct"322",10u#+serif_fit#,asc_height#,desc_depth#);
italcorr .7[x_height#,asc_height#]*slant+min(.5curve#-u#,-.25u#);
adjust_fit(serif_fit#-.5u#,0);
pickup tiny.nib; pos1(stem',0); pos2(stem,0); pos2'(stem,0);
pos0'(stem',0); pos0(stem,0); z0l=z0'l; x0'=x1; x0=x2=x2'; bot y2'=-d;
lft x1l=hround(side_gap-.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--z2'e;  % 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(2',0,b,1/3,jut,c,1/3,jut); fi
hooktop(1,9,10,11,stem',rt x5r,h,.8,.55,.2);
penlabels(0,1,2,3,4,5,6,7,8,9,10,11,2'); endchar;

cmchar "Hooktop Q";
beginchar(oct"323",10u#+serif_fit#,.9asc_height#,desc_depth#);
italcorr .9asc_height#*slant+1.75u#;
adjust_fit(0,0);
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;
if serifs: dish_serif(2,0,b,1/3,jut,c,1/3,jut); fi  % lower serif
hooktop(1,9,10,11,stem',hround(w+1.5u),h,.9,.6,.5);
penlabels(0,1,2,3,4,5,6,7,8,9,10,11); endchar;

cmchar "Long-leg R";
numeric r_flare#; r_flare#=.75[if serifs: stem# else: vair# fi,flare#];
define_whole_blacker_pixels(r_flare);
beginchar(oct"324",CT(if serifs:max(7u#,5.5u#+r_flare#) else:6.5u# fi,6.66u#),
 x_height#,desc_depth#);
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(if Times_Compat: 1.6 else: 1.75 fi u,.25u+r_flare);
 rt x5r=hround(w-if Times_Compat: .1u else: .5u fi +.5);
 y5+.5r_flare=.9[bar_height,h]+oo;
 pos6(r_flare,0); bulb(4,5,6);  % bulb
else: pos4(r_flare,90); rt x4=hround(w-.25u); fi
pos3(thin_join,180); rt x3l=hround(side_gap-.5stem')+stem'; top y3=bar_height;
filldraw stroke z3e{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'=y3; x1l=x0l=x0'l=x2l;
lft x1l=hround(side_gap-.5stem'); bot y2=-d;
filldraw stroke z1e--z0'e--z0e--z2e;  % stem
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,1.25jut); fi  % lower serif
penlabels(1,2,3,4,5,6); endchar;

cmchar "Turned Long-leg R";
numeric r_flare#; r_flare#=.75[if serifs: stem# else: vair# fi,flare#];
define_whole_blacker_pixels(r_flare);
beginchar(oct"325",CT(if serifs:max(7u#,5.5u#+r_flare#) else:6.5u# fi,6.66u#),
 x_height#+desc_depth#,0);
italcorr (x_height#+desc_depth#)*slant if not serifs: -.5u# fi;
adjust_fit(0,serif_fit#);
pickup fine.nib; bot y4r=-oo;
if serifs: pos4(vair,-90); pos5(hair,-180);
 x4=max(if Times_Compat: 1.6 else: 1.75 fi u,.25u+r_flare);
 lft x5r=hround(if Times_Compat: .1u else: .5u fi -.5);
 y5-.5r_flare=x_height-.9[bar_height,x_height]-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=hround(w-side_gap+.5stem')-stem';
bot y3=x_height-bar_height;
filldraw stroke z3e{down}...{left}z4e;  % arc
pickup tiny.nib; pos0(stem',0); pos2(stem',0);
pos1(hround(stem-3stem_corr),0); top y2=h;
pos0'(hround(stem-3stem_corr),0); y0=y0'=y3; x1r=x0r=x0'r=x2r;
rt x1r=hround(w-side_gap+.5stem'); bot y1=-min(oo,serif_drop);
filldraw stroke z1e--z0'e--z0e--z2e;  % stem
if serifs: sloped_serif.r(1,0',a,1/3,jut,serif_drop);  % lower serif
 dish_serif(2,0,b,1/3,1.25jut,c,1/3,jut); fi  % upper serif
penlabels(1,2,3,4,5,6); endchar;

cmchar "Hooktop T";
beginchar(oct"326",CT(6u#+max(u#,.5stem#),5.56u#),
 if not monospace:.9 fi asc_height#,0);
italcorr x_height#*slant if serifs: -.25u# else: +.25u# fi;
adjust_fit(0,if serifs: .5u# else: 0u# 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- if Times_Compat: .4u else: 1.3u fi);
top y8r=x_height; lft x7=hround 1/3u; y7l=y8l;
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=.75h;
 penpos2'(x1r-x1l,0); x2'=x1; y2'=y2;
 filldraw stroke z1e--z2'e;  % upper terminal
hooktop(1,9,10,11,hround(shaved_stem-stem_corr),
 hround(w if Times_Compat:+.5u else: -.5u fi),h,.88,.5,.2);
pickup fine.nib; interim superness:=more_super;
pos4(vair',-90); bot y4r=-oo; rt x5r=hround(w- if Times_Compat: 0 fi u);
if serifs: pos5(hair,0); x4l=.5[x3l,x5l];
 y5= if Times_Compat: .5 else: 1 fi [0,y3];
 (x,y4r)=whatever[z4l,z5l]; x4r:=max(x,.5[x3r,x4]);
 filldraw stroke z2e..super_arc.e(3,4)...{up}z5e;  % stem and hook
 if Times_Compat: else:
  pickup crisp.nib; pos6(hair,0); pos5'(hair,0);
  x6=x5=x5'; top y6=max(vround .75bar_height,top y5); y5=y5';
  filldraw stroke z5'e--z6e; fi % 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;
penlabels(1,2,3,4,5,6,7,8,9,10,11); endchar;

cmchar "Turned T";
beginchar(oct"330",CT(6u#+max(u#,.5stem#),5.56u#),x_height#,
 min(asc_height#,if hefty:9/7 else:10/7 fi\\ x_height#)-x_height#);
italcorr .7x_height#*slant -.5u#;
adjust_fit(if serifs: 0 else: -.5u# fi,0);
numeric shaved_stem; shaved_stem=hround(stem if hefty:-\\2stem_corr fi);
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(if Times_Compat: .4u else: 1.3u fi);
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=-d;
 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=-d;
 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(if Times_Compat: 0 fi u);
if serifs: pos5(hair,180); x4l=.5[x3l,x5l];
 y5=if Times_Compat: .5 else: 1 fi [h,y3];
 (x,y4r)=whatever[z4l,z5l]; x4r:=min(x,.5[x3r,x4]);
 filldraw stroke z2e..super_arc.e(3,4)...{down}z5e;  % stem and hook
 if Times_Compat: else:
  pickup crisp.nib; pos6(hair,180); pos5'(hair,180);
  x6=x5=x5'; bot y6=min(vround (h-.75bar_height),bot y5); y5=y5';
  filldraw stroke z5'e--z6e; fi % 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;
penlabels(1,2,3,4,5,6,7,8); endchar;

cmchar "T-Esh ligature";
beginchar(oct"331",CT(9.5u#,10u#),asc_height#,desc_depth#);
italcorr asc_height#*slant+.5u#;
adjust_fit(0,if serifs: .5u# else: 0 fi);
numeric H,D; H:=vround 10/7x_height; D:=0; % t
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=hround6u; 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; x4l=.5[x3l,x5l];
lft x5l=hround x8; y5=if serifs: .35bar_height; else: .6bar_height; fi
pos5(if serifs: hair else: stem' fi,0);
(x,y4r)=whatever[z4l,z5l]; x4r:=max(x,.5[x3r,x4]);
filldraw stroke z2e..super_arc.e(3,4); % stem
filldraw stroke z4e{right}...{up}z5e;
pos11(stem',0); pos12(stem',0); % Esh
lft x11l=hround x8; x12=x11; y12=0; h-y11=d;
filldraw stroke z11e--z12e; % stem
left_tail(12,13,14,15,stem',hround(lft x11l-2.8u));
hooktop(11,16,17,18,stem',hround(rt x11r+2.8u),h,.9,.5,1/3);
penlabels(1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18); endchar;

cmchar "Inverted glottal stop";
beginchar(oct"333",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
if serifs: pos1(hair,180); pos0(flare,180);
 lft x1r=hround u; y1=.3[y3,y2]; bulb(2,1,0);  % bulb
else: pickup fine.nib; pos2'(vair,-90); z2'=z2;
 pos1(vround 5/7[vair,flare],-110);
 lft x1r=hround u; bot y1r=vround .1[bot y2r,y6];
 filldraw stroke term.e(2',1,left,1,4); fi  % terminal
penlabels(0,1,2,3,4,5,6); endchar;

cmchar "Barred glottal stop";
beginchar(oct"334",CT(9u#,10u#),asc_height#,0);
italcorr .7asc_height#*slant;
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); bot y6=.3x_height;
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}...{(-10,-1)}z4e;
 filldraw stroke z5e--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
hbar(8,9,lft x5l - hround(side_gap),rt x5r + hround(side_gap),.55x_height);
penlabels(0,1,2,3,4,5,6,7); endchar;

cmchar "Barred reversed glottal stop";
beginchar(oct"335",CT(9u#,10u#),asc_height#,0);
italcorr .7asc_height#*slant;
adjust_fit(0,0);
pickup tiny.nib; pos7(stem,0); bot y7=0; x7=.53w;
pos2(vair,90); pos3(curve,180);
pos4(vair,-90); pos5(stem,0); pos6(stem,0);
x2=x5=x6=x7; x4=x5r;
lft x3r=hround(u); bot y6=.3x_height;
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}...{(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: pickup fine.nib; pos2'(vair,90); z2'=z2;
 pos1(vround 5/7[vair,flare],70);
 rt x1r=hround (w-u); top y1r=vround .9[y6,top y2r];
 filldraw stroke term.e(2',1,right,1,4); fi  % terminal
hbar(8,9,lft x5l - hround(side_gap),rt x5r + hround(side_gap),.55x_height);
penlabels(0,1,2,3,4,5,6,7); endchar;

% end of tipasym2.mf
