% tipasc.mf: TIPA small capital phonetic symbols
% 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.
%

% 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

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;

cmchar "Small capital Y";
beginchar("Y",13u#,x_height#,0);
italcorr x_height#*slant+.45u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric left_stem,right_stem,outer_jut,dy,alpha;
left_stem=sc_stem-stem_corr;
right_stem=min(sc_hair if hefty:-2stem_corr fi,left_stem);
outer_jut=.75sc_jut; x1l=w-x4r=l+letter_fit+outer_jut+.05u;
x2l=x5l=hround(.5w-.5left_stem); x3r=x5r; y1=y4=h; y2=y3=y5=.4h;
dy=y1-y2; alpha=((x2l-x1l)++dy)/dy;
penpos1(alpha*left_stem,0); penpos2(alpha*left_stem,0);
penpos3(alpha*right_stem,0); penpos4(alpha*right_stem,0);
penpos5(left_stem,0); penpos6(left_stem,0); x5=x6; y6=0;
z0=whatever[z1r,z2r]=whatever[z3l,z4l];
if y0>y2+cap_notch_cut: y0:=y2+cap_notch_cut;
  fill z0+.5right{up}...{z4-z3}diag_end(3l,4l,1,1,4r,3r)--z5r
    --diag_end(5r,6r,1,1,6l,5l)--z5l--diag_end(2l,1l,1,1,1r,2r){z2-z1}
    ...{down}z0+.5left--cycle; % diagonals and stem
else: fill z0--diag_end(0,4l,1,1,4r,3r)--z5r
    --diag_end(5r,6r,1,1,6l,5l)--z5l
    --diag_end(2l,1l,1,1,1r,0)--cycle; fi  % diagonals and stem
if serifs: numeric inner_jut; pickup tiny.nib;
 prime_points_inside(1,2); prime_points_inside(4,3); prime_points_inside(6,5);
 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/3,outer_jut,b,1/2,inner_jut);  % upper left serif
 dish_serif(4',3,c,.6,inner_jut,d,1/2,outer_jut)(dark);  % upper right serif
 dish_serif(6',5,e,1/3,sc_jut,f,1/3,sc_jut); fi  % lower serif
math_fit(.5u#-x_height#*slant,ic#-4u#);
penlabels(0,1,2,3,4,5,6); endchar;

cmchar "Small capital I";
beginchar("I",max(6u#,4u#+sc_stem#),x_height#,0);
italcorr x_height#*slant-.25u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
pickup tiny.nib; pos1(sc_stem,0); pos2(sc_stem,0);
lft x1l=lft x2l=hround(.5w-.5sc_stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
if serifs: dish_serif(1,2,a,1/3,1.05sc_jut,b,1/3,1.05sc_jut);  % upper serif
 dish_serif(2,1,c,1/3,1.05sc_jut,d,1/3,1.05sc_jut);  fi % lower serif
math_fit(0,.5ic#); penlabels(1,2); endchar;

cmchar "Inverted small capital R";
beginchar("K",if serifs: 12u#+.5max(2u#,sc_curve#)
 else:12.5u#-.5width_adj# fi,x_height#,0);
italcorr .75x_height#*slant+ if serifs: .25 else: 1 fi\\ u#;
adjust_fit(cap_serif_fit#,0);
pickup tiny.nib; pos1(sc_stem',0); pos2(sc_stem',0);
lft x1l=lft x2l=hround max(2u,3u-.5sc_stem'); bot y1=0; top y2=h;
filldraw stroke z2e--z1e; % stem
penpos3(sc_band,-90); penpos4(sc_band,-90);
penpos5(sc_curve if hefty:-3stem_corr fi,0);
penpos6(vair,90); penpos7(vair,90);
z3r=bot z1; y4=y3; y5=.5[y4l,y6l]; y6=y7;
x7=x2; y7l=vround(.5h-.5vair); x4=x6;
if serifs: x4=.5w-.5u; x5r=hround(w-2.25u);
else: x4=.5w+.5u; x5r=hround(w-u); fi
x4l:=x6l:=x4-.125sc_curve;
fill stroke z7e..pulled_arc.e(6,5) & pulled_arc.e(5,4)..z3e;  % lobe
if serifs: pos6'(vair,90); pos0(sc_stem,180);
 pos8(sc_curve,180); pos9(vair,90); pos10(hair,0);
 z6'=z6; lft x0r=lft x8r=hround(x5-2/3u-.5sc_curve);
 y8=1/3[y2,y7]; y0=3/5[y2,y7]; x9=.5[x8l,x10r];
 top y9r=h+o; rt x10r=hround(w-.05u); y10=1/4[y2,y7];
 filldraw stroke z6'e{right}..z0e---z8e....z9e{right}..z10e{down};  % tail
 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,sc_jut);  % lower serif
else: penpos8(sc_stem-2stem_corr,0); penpos9(sc_stem,0);
 x8=x6+.5u; y8=y6; x9r=hround(w-.5u); y9=h;
 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 "Small capital A";
beginchar(oct"300",13u#,x_height#,0);
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=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*right_stem,0); penpos4(alpha*right_stem,0);
z0=whatever[z1r,z2r]=whatever[z3l,z4l];
if y0<h-cap_notch_cut: y0:=h-cap_notch_cut;
 fill z0+.5right{down}...{z4-z3}diag_end(3l,4l,1,1,4r,3r)
  --diag_end(4r,3r,1,1,2l,1l)--diag_end(2l,1l,1,1,1r,2r){z2-z1}
  ...{up}z0+.5left--cycle; % left and right diagonals
else: fill z0--diag_end(0,4l,1,1,4r,3r)--diag_end(4r,3r,1,1,2l,1l)
  --diag_end(2l,1l,1,1,1r,0)--cycle; fi % left and right diagonals
penpos5(whatever,angle(z2-z1)); z5=whatever[z1,z2];
penpos6(whatever,angle(z3-z4)); z6=whatever[z3,z4]; y6=y5;
if hefty: y5r else: y5 fi =5/12y0;
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 B";
beginchar(oct"340",12.5u#,x_height#,0);
italcorr .75x_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,0);
numeric left_stem,right_curve,middle_weight;
left_stem=sc_stem-hround 2stem_corr; middle_weight=.6vair+.5;
pickup tiny.nib; pos1(left_stem,0); pos2(left_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5left_stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
penpos3(sc_band,90); penpos4(sc_band,90);
penpos6(middle_weight,-90); penpos7(middle_weight,-90);
penpos8(middle_weight,90); penpos9(middle_weight,90);
penpos5(right_curve-stem_corr,0); penpos10(right_curve,0);
penpos11(sc_band,-90); penpos12(sc_band,-90);
z3r=top z1; y4=y3; y5=.5[y4,y6]; y6=y7; y7l-y8l=vair;
z12r=bot z2; y11=y12; y10=.5[y11,y9]; y8=y9; .5[y7l,y8l]=.52h;
x4=x6; x9=x11=x4+.5u; x7=x8=x1; x9l:=x4+.25u;
x5r=hround(w-1.5u); x10r=hround(w-u);
if serifs: right_curve=sc_curve-stem_corr; x4=.5[x1,w-1.5u];
else: right_curve=sc_curve-3stem_corr; x4=.5[x1,w-2.5u];
 x4l:=x4l-.5u; x9l:=x9l-.5u; fi
x6l:=x6l-.5u; x11l:=x11l-.5u;
fill stroke z3e..super_arc.e(4,5) & super_arc.e(5,6)..z7e;  % upper lobe
fill stroke z8e..super_arc.e(9,10) & super_arc.e(10,11)..z12e;  % lower lobe
if serifs: nodish_serif(1,2,a,1/3,sc_jut,b,1/3,.5sc_jut);  % upper serif
 nodish_serif(2,1,c,1/3,sc_jut,d,1/3,.5sc_jut); fi  % lower serif
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6,7,8,9,10,11,12); endchar;

cmchar "Small capital O-E ligature";
beginchar(oct"327",18u#,x_height#,0);
italcorr x_height#*slant-beak_jut#-.5u#;
adjust_fit(cap_serif_fit#,0);
numeric light_stem;
light_stem=max(tiny.breadth,hround .8[mfudged.hair,mfudged.sc_stem]);
pickup tiny.nib; pos1(light_stem,0); pos2(light_stem,0);
lft x1l=lft x2l=hround .5w; 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; rt x4r=hround(w-u); y4=good.y(y3l-.8beak)-eps;
arm(3,4,e,beak_darkness,beak_jut);  % upper arm and beak
pos5(sc_bar,-90); pos6(mfudged.hair,0);
top y5l=vround(.52[y2,y1]+.5sc_bar); x5=x1;
pos0(sc_bar,90); pos7(mfudged.hair,0);
z0=z5; x6=x7; y6-y5l=y0l-y7;
if serifs and not(monospace and hefty): rt x6r=hround(w-3.4u+.5mfudged.hair);
 y6=good.y(y5l+.5beak)+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
pos8(slab if not serifs:+2stem_corr fi,-90);
pos9(mfudged.hair,0); bot y8r=0; x8=x2; y9=good.y(y8l+.9beak)+eps;
arm(8,9,h,beak_darkness,1.5beak_jut);  % lower arm and beak
penpos11(vair,90); penpos13(vair,-90);
if monospace: penpos12(fudged.sc_stem,180);
 interim superness:=sqrt superness;  % make |"O"|, not |"0"|
else: penpos12(hround(sc_curve-stem_corr),180); fi
x11=x13=.5w-2u; y11r=h+o; y13r=-o; y12=.5h-vair_corr; x12r=hround u;
x14=x15=.5w; y14=2/3h; y15=1/3h; y12l:=.52h;
penstroke super_arc.e(11,12) & super_arc.e(12,13);  % left half of bowl
fill z13r{right}..{right}(x2,0)--(x1,h){left}..{left}z11r
 --z11l{right}...{z14-z11l}(.82[x11l,x14],.82[y14,y11l])
 ...z14---z15...{z13l-z15}(.82[x13l,x15],.82[y15,y13l])
 ...{left}z13l--cycle;  % right half of bowl
if serifs: serif(1,2,a,1/3,.5sc_jut);  % upper serif
 serif(2,1,b,1/3,.5sc_jut); fi  % lower serif
penlabels(0,1,2,3,4,5,6,7,8,9,11,12,13,14,15); endchar;

cmchar "Small capital G";
if serifs: beginchar(oct"345",14u#,x_height#,0);
 italcorr x_height#*slant-1.5u#-.5cap_serif_fit#;
 adjust_fit(0,.5cap_serif_fit#);
 pickup tiny.nib; pos0(sc_stem,0); pos7(sc_stem,0);
 rt x0r=hround(w-2u); y0=good.y(.1[.632bar_height,.626x_height]+1); x7=x0;
 pickup fine.nib;
 if hefty: bot y7=0; pos5(sc_stem,0); x5=x0; top y5=tiny.top y0;
 else: pos5(sc_hair,0); pos8(sc_stem,0);
  y7=.316bar_height; z5l=z8l; z8=z7; x9=x8r; bot y9=0;
  filldraw z8l{down}..{4(x9-x8),y9-y8}z9--z8r--cycle; fi % spur
 pos1(sc_hair,0); pos2(sc_band,90);
 pos3(sc_curve,180); pos4(sc_band,270);
 rt x1r=hround(w-2u); lft x3r=hround u; x2=x4=.55[x3,x1];
 top y2r=h+o; bot y4r=-o; y3=.5[y2,y4];
 bot y1=min(vround max(.6h,.626x_height-.5vair),bot y2l-eps);
 (x2l',y2l)=whatever[z2r,z1l]; x2l:=min(x2l',x2l+.5u);
 (x4l',y4l)=whatever[z4r,z5l]; x4l:=min(x4l',x4l+.5u);
 filldraw stroke z1e{x2-x1,10(y2-y1)}
  ...pulled_arc.e(2,3) & pulled_arc.e(3,4)...z5e{up}; % arc
 pos6(.3[fine.breadth,sc_hair],0); x6r=x1r; top y6=h+o;
 x1r-x1'=2sc_curve-fine; y1'=y1;
 path upper_arc; upper_arc=z1{x2-x1,10(y2-y1)}..z2{left};
 numeric t; t=xpart(upper_arc intersectiontimes (z6l--z1'));
 filldraw z1r--z6r--z6l--subpath(t,0) of upper_arc--cycle; % barb
 pickup tiny.nib; filldraw stroke z0e--z7e;  % stem
 dish_serif(0,7,a,1/3,max(sc_jut,2.25u),b,1/3,1.25u);  % serif
 math_fit(-.3x_height#*slant-.5u#,ic#);
else: beginchar(oct"345",12u#,x_height#,0);
 italcorr x_height#*slant-.5u#;
 adjust_fit(0,0);
 pickup fine.nib; pos1(1.2flare,80); pos2(slab,90);
 pos3(sc_curve,180); pos4(slab,270); pos5(flare,270);
 rt x1r=hround(w-1.35u); x2=x4=.5w+u;
 lft x3r=hround max(u,2u-.5sc_curve); rt x5l=hround(w-1.2u);
 top y1r=vround .93h+o; top y2r=h+o; y3=.5h;
 bot y4r=-o; bot y5r=vround .07h-o;
 filldraw stroke rterm.e(2,1,right,.9,4)&super_arc.e(2,3)
  & super_arc.e(3,4) & term.e(4,5,right,1,4); % arc and terminals
 pos0(stem,0); pos7(stem,0);
 z7r=z5r; x0=x7; top y0=1+vround .35[.632bar_height,.626x_height];
 filldraw stroke z0e--z7e;  % stem
 pos8(sc_bar,90); pos9(sc_bar,90);
 z0r=z9r; y8=y9; lft x8=hround x4;
 filldraw stroke z8e--z9e;  % bar
 math_fit(-.3x_height#*slant-.5u#,.5ic#); fi
penlabels(0,1,1',2,3,4,5,6,7,8,9); endchar;

cmchar "Small capital N";
beginchar(oct"360",13u#+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 thin_stem; thin_stem=hround(fudged.hair+stem_corr);
pickup tiny.nib; pos1(thin_stem,0); pos2(thin_stem,0);
pos3(thin_stem,0); pos4(thin_stem,0);
pickup tiny.nib; top y1=top y3=h; bot y2=bot y4=0;
x1=x2; x3=x4; x1l=w-x3r;
rt x3r=hround min(w-2u,w-3u+.5fudged.sc_stem);
filldraw stroke z1e--z2e; % left stem
filldraw stroke z3e--z4e; % right stem
if hefty: penpos5(fudged.sc_stem,0); penpos6(fudged.sc_stem,0);
 x5l=x1; x6r=x4; y5=h; y6=0;
 numeric upper_notch,lower_notch;
 upper_notch=h-cap_notch_cut; lower_notch=cap_notch_cut;
 x1'=rt x1r; z1'=whatever[z5l,z6l]; x4'=lft x4l; z4'=whatever[z5r,z6r];
 fill z5l..
  if y1'<upper_notch: {right}(x1'+1,upper_notch){down}... fi
  {z6-z5}diag_in(5l,6l,1,6r)--z6r..
  if y4'>lower_notch: {left}(x4'-1,lower_notch){up}... fi
  {z5-z6}diag_in(6r,5r,1,5l)--cycle;  % diagonal
else: penpos5(whatever,0); penpos6(whatever,90);
 z5l=z1l; z6l=z4l;
 z7=z6l+(max(eps,sc_stem-3stem_corr-tiny),0) rotated (angle(z5l-z6l)-90);
 z5r=z7+whatever*(z5l-z6l); z6r=z7+whatever*(z5l-z6l);
 filldraw stroke z5e..z6e; fi  % diagonal
if serifs: if hefty: serif(1,2,a,1/3,-sc_jut); % upper left serif
 else: serif(5,6,a,1/3,-sc_jut); fi  % upper left serif
 dish_serif(2,1,b,1/2,sc_jut,c,1/2,sc_jut)(dark); % lower left serif
 dish_serif(3,4,e,1/2,sc_jut,f,1/2,sc_jut)(dark); fi  % upper right serif
math_fit(0,max(.5ic#-.5u#,0)); penlabels(1,1',2,3,4,4',5,6,7); endchar;

cmchar "Small capital R";
beginchar(oct"366",if serifs: 12u#+.5max(2u#,sc_curve#)
 else:12.5u#-.5width_adj# fi,x_height#,0);
italcorr .75x_height#*slant- if serifs: 1.75 else: .5 fi\\ u#;
adjust_fit(cap_serif_fit#,0);
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
penpos3(sc_band,90); penpos4(sc_band,90);
penpos5(sc_curve if hefty:-3stem_corr fi,0);
penpos6(vair,-90); penpos7(vair,-90);
z3r=top z1; y4=y3; y5=.5[y4l,y6l]; y6=y7;
x7=x2; y7l=vround(.5h+.5vair); x4=x6;
if serifs: x4=.5w-.5u; x5r=hround(w-2.25u);
else: x4=.5w+.5u; x5r=hround(w-u); fi
x4l:=x6l:=x4-.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,180);
 pos8(sc_curve,180); pos9(vair,-90); pos10(hair,0);
 z6'=z6; lft x0r=lft x8r=hround(x5-2/3u-.5sc_curve);
 y8=1/3[y2,y7]; y0=3/5[y2,y7]; x9=.5[x8l,x10r];
 bot y9r=-o; rt x10r=hround(w-.05u); y10=1/4[y2,y7];
 filldraw stroke z6'e{right}..z0e---z8e....z9e{right}..z10e{up};  % tail
 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,sc_jut);  % lower serif
else: penpos8(sc_stem-2stem_corr,0); penpos9(sc_stem,0);
 x8=x6+.5u; y8=y6; x9r=hround(w-.5u); y9=0;
 fill z8l--diag_end(8l,9l,.5,1,9r,8r)--z8r--cycle; fi  % tail
math_fit(0,.75ic#); penlabels(0,1,2,3,4,5,6,7,8,9,10); endchar;

cmchar "Hooktop small capital G";
if serifs: beginchar(oct"311",14u#,x_height#,0);
 italcorr .9asc_height#*slant-.5cap_serif_fit#+2u#;
 adjust_fit(0,.5cap_serif_fit#+.5u#);
 pickup tiny.nib; pos0(sc_stem,0); pos7(sc_stem,0);
 rt x0r=hround(w-2u); y0=good.y(.1[.632bar_height,.626x_height]+1); x7=x0;
 pickup fine.nib;
 if hefty: bot y7=0; pos5(sc_stem,0); x5=x0; top y5=tiny.top y0;
 else: pos5(sc_hair,0); pos8(sc_stem,0);
  y7=.316bar_height; z5l=z8l; z8=z7; x9=x8r; bot y9=0;
  filldraw z8l{down}..{4(x9-x8),y9-y8}z9--z8r--cycle; fi % spur
 pos1(sc_hair,0); pos2(sc_band,90);
 pos3(sc_curve,180); pos4(sc_band,270);
 rt x1r=hround(w-2u); lft x3r=hround u; x2=x4=.55[x3,x1];
 top y2r=h+o; bot y4r=-o; y3=.5[y2,y4];
 bot y1=min(vround max(.6h,.626x_height-.5vair),bot y2l-eps);
 (x2l',y2l)=whatever[z2r,z1l]; x2l:=min(x2l',x2l+.5u);
 (x4l',y4l)=whatever[z4r,z5l]; x4l:=min(x4l',x4l+.5u);
 filldraw stroke z1e{x2-x1,10(y2-y1)}
  ...pulled_arc.e(2,3) & pulled_arc.e(3,4)...z5e{up}; % arc
 pos6(.3[fine.breadth,sc_hair],0); x6r=x1r; top y6=h+o;
 x1r-x1'=2sc_curve-fine; y1'=y1;
 path upper_arc; upper_arc=z1{x2-x1,10(y2-y1)}..z2{left};
 numeric t; t=xpart(upper_arc intersectiontimes (z6l--z1'));
 filldraw z1r--z6r--z6l--subpath(t,0) of upper_arc--cycle; % barb
 pickup tiny.nib; filldraw stroke z0e--z7e;  % stem
 dish_serif(0,7,a,1/3,max(sc_jut,2.25u),b,1/3,1.25u);  % serif
 math_fit(-.3x_height#*slant-.5u#,ic#);
 pos10(hair,0); y10=y1; rt x10r=rt x1r;
 hooktop(10,11,12,13,hair,hround(w+2.5u),.9asc_height+.5vair,.9,.55,.6);
else: beginchar(oct"311",12u#,x_height#,0);
 italcorr x_height#*slant-.5u#+2u#;
 adjust_fit(0,.5u#);
 pickup fine.nib; pos1(1.2flare,30); pos2(slab,90);
 pos3(sc_curve,180); pos4(slab,270); pos5(flare,270);
 rt x1r=hround(w-1.2u); x2=x4=.5w+u;
 lft x3r=hround max(u,2u-.5sc_curve); rt x5l=hround(w-1.2u);
 top y1r=vround .83h+o; top y2r=h+o; y3=.5h;
 bot y4r=-o; bot y5r=vround .07h-o;
 filldraw stroke rterm.e(2,1,right,.9,4)&super_arc.e(2,3)
  & super_arc.e(3,4) & term.e(4,5,right,1,4); % arc and terminals
 pos0(stem,0); pos7(stem,0);
 z7r=z5r; x0=x7; top y0=1+vround .35[.632bar_height,.626x_height];
 filldraw stroke z0e--z7e;  % stem
 pos8(sc_bar,90); pos9(sc_bar,90);
 z0r=z9r; y8=y9; lft x8=hround x4;
 filldraw stroke z8e--z9e;  % bar
 math_fit(-.3x_height#*slant-.5u#,.5ic#);
 pos10(vair,0); y10=y1r; rt x10r=rt x1r;
 hooktop(10,11,12,13,vair,hround(w+2.5u),.9asc_height+.5vair,.9,.5,.5); fi
penlabels(0,1,1',2,3,4,5,6,7,8,9,10,11,12,13); endchar;

cmchar "Small capital H";
beginchar(oct"313",13u#+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#);
pickup tiny.nib; pos1(sc_stem,0); pos2(sc_stem,0);
pos3(sc_stem,0); pos4(sc_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5sc_stem); x3=x4=w-x1;
top y1=top y3=h; bot y2=bot y4=0;
filldraw stroke z1e--z2e; % left stem
filldraw stroke z3e--z4e; % right stem
penpos5(sc_bar,90); penpos6(sc_bar,90);
x5=x1; x6=x3; y5=y6=.52h;
fill stroke z5e--z6e;  % bar
if serifs: numeric inner_jut;
 if rt x1r+sc_jut+.5u+1<=lft x3l-sc_jut: inner_jut=sc_jut;
 else: rt x1r+inner_jut+.5u+1=lft x3l-inner_jut; fi
 dish_serif(1,2,a,1/3,sc_jut,b,1/3,inner_jut);  % upper left serif
 dish_serif(2,1,c,1/3,sc_jut,d,1/3,inner_jut); % lower left serif
 dish_serif(3,4,e,1/3,inner_jut,f,1/3,sc_jut);  % upper left serif
 dish_serif(4,3,g,1/3,inner_jut,h,1/3,sc_jut); fi  % lower left serif
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6); endchar;

cmchar "Small capital L";
beginchar(oct"317",11u#-width_adj#,x_height#,0);
adjust_fit(cap_serif_fit#,0);
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);
bot y3r=0; x3=x2; y4=y3l+beak+eps; rt x4r=hround(w-.75u);
arm(3,4,e,1.2beak_darkness,beak_jut);  % lower arm and beak
if serifs: dish_serif(1,2,a,1/3,sc_jut,b,1/3,1.25sc_jut);  % upper serif
 nodish_serif(2,1,c,1/3,sc_jut,d,1/3,.5sc_jut); fi  % lower serif
math_fit(0,u#); penlabels(1,2,3,4); endchar;

cmchar "Small capital U";
beginchar(oct"332",13u#+.5width_adj#,x_height#,0);
italcorr x_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,180); z2'=z2;
pos3(sc_band,-90);
pos4(sc_hair,0); pos5(sc_hair,0);
x1=x2; x3=.5[x1,x5]; x4=x5; x1l=w-x5r;
top y1=top y5=h; y2=y4=1/3h; bot y3r=-o;
lft x1l=hround max(2u,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;

cmchar "Small capital E";
beginchar(oct"244",12u#-width_adj#,x_height#,0);
italcorr x_height#*slant-beak_jut#-.5u#;
adjust_fit(cap_serif_fit#,0);
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-u); y4=good.y(y3l-.8beak)-eps;
arm(3,4,e,beak_darkness,beak_jut);  % upper arm and beak
pos5(sc_bar,-90); pos6(hair,0);
top y5l=vround(.52[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-4.4u+.5hair); y6=good.y(y5l+.5beak)+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
pos8(slab if not serifs:+2stem_corr fi,-90); pos9(hair,0);
bot y8r=0; x8=x2; y9=good.y(y8l+.9beak)+eps;
arm(8,9,h,beak_darkness,1.5beak_jut);  % lower arm and beak
if serifs: nodish_serif(1,2,a,1/3,sc_jut,b,1/3,.5sc_jut);  % upper serif
 nodish_serif(2,1,c,1/3,sc_jut,d,1/3,.5sc_jut); fi  % lower serif
math_fit(0,.5ic#); penlabels(0,1,2,3,4,5,6,7,8,9); endchar;

cmchar "Small capital J";
beginchar(oct"250",9u#,x_height#,0);
italcorr x_height#*slant-cap_serif_fit#
 +.75sc_jut#-2.5u#+min(.5sc_stem#,u#);
adjust_fit(0,cap_serif_fit#);
pickup tiny.nib; pos1(sc_stem',0); pos2(sc_stem',0);
top y1=h; rt x1r=hround(w-2u); x2=x1; y2=.21h;
if serifs: pos3(vair,-90); pos4(sc_hair,-180);
 pos5(flare+(sc_stem-stem),-180);
 bot y3r=-o; x3=.5[x4,x2]; y5=1/6h; rt x5l=hround 2.75u; z5r=z4r;
 filldraw stroke z1e--z2e&super_arc.e(2,3);  % stem and arc
 dish_serif(1,2,a,1/3,1.3sc_jut,b,1/3,.75sc_jut);  % serif
 pickup tiny.nib; bulb(3,4,5);  % bulb
else: filldraw stroke z1e--z2e;  % stem
 pickup fine.nib; pos3(sc_stem',0); z3=z2;
 pos4(flare,angle(6.5u,-h)); pos5(1.1flare,-100);
 bot y4r=-o; x4r=.5[x5r,x3r]; lft x5r=hround.75u; bot y5r=vround.06h-o;
 filldraw stroke z3e{down}....term.e(4,5,left,1,4); fi % arc and terminal
math_fit(0,.5ic#-.5u#); penlabels(1,2,3,4,5); endchar;

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

% end of tipasc.mf