% tipadiac.mf: TIPA accents and diacritics
% 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.
%

numeric ipacode;
ipacode := -1;

cmchar "Grave accent";
beginchar(incr ipacode,9u#,min(asc_height#,2x_height#),0);
adjust_fit(0,0);
if serifs: pickup crisp.nib; x1-.5stem=hround 2u; x2=2/3[x1,w-x1];
 y1+.5stem=h+eps; y2=max(2/3[h,x_height],x_height+o+hair);
 numeric theta; theta=angle(z2-z1)+90;
 pos1(stem,theta); pos2(hair,theta);
 filldraw circ_stroke z1e--z2e;  % diagonal
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 lft x1l=hround 1.5u; rt x2r=hround(.5w+.25u+.5vair);
 top y1=h; bot y2=vround 2/3[h,x_height];
 filldraw stroke z1e--z2e; fi  % diagonal
penlabels(1,2); endchar;

cmchar "Acute accent";
beginchar(incr ipacode,9u#,min(asc_height#,2x_height#),0);
italcorr h#*slant-if serifs: 1.5 fi u#;
adjust_fit(0,0);
if serifs: pickup crisp.nib; x1+.5stem=hround(w-2u); x2=2/3[x1,w-x1];
 y1+.5stem=h+eps; y2=max(2/3[h,x_height],x_height+o+hair);
 numeric theta; theta=angle(z2-z1)+90;
 pos1(stem,theta); pos2(hair,theta);
 filldraw circ_stroke z1e--z2e;  % diagonal
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 rt x1r=hround(w-1.5u); lft x2l=hround(.5w-.25u-.5vair);
 top y1=h; bot y2=vround 2/3[h,x_height];
 filldraw stroke z1e--z2e; fi  % diagonal
penlabels(1,2); endchar;

cmchar "Circumflex (hat) accent";
beginchar(incr ipacode,9u#,min(asc_height#,2x_height#),0);
if serifs: italcorr .5[x_height#,h#]*slant+.5hair#-1.75u#;
 adjust_fit(0,0);
 pickup crisp.nib; pos2(CT(.5,.6)[vair,curve],90); top y2r=h; x2=.5w;
 x1=w-x3=good.x 2.25u; y1=y3=.5[x_height,y2];
 pos1(hair,angle(z2-z1)+90); pos3(hair,angle(z3-z2)+90);
 filldraw stroke z1e--z2e--z3e;  % diagonals
else: italcorr 2/3[x_height#,h#]*slant-.5stem#+.5vair#-.75u#;
 adjust_fit(0,0);
 pickup fine.nib; pos1(vair,0); pos3(vair,0); x1=w-x3;
 pos2(stem,0); top y2=h; x2=.5w; bot y1=bot y3=vround 2/3[h,x_height]-eps;
 lft x1l=hround(rt x2r-3.25u-.5vair); % same slope as in the acute accent
 z0=whatever[z1r,z2r]=whatever[z2l,z3l];
 y4l=y4r=y2; x4l=good.x .2[x2l,x2]; x4r=w-x4l;
 filldraw z4l--z1l--z1r--z0--z3l--z3r--z4r--cycle; fi  % diagonals
penlabels(0,1,2,3,4); endchar;

cmchar "Tilde (squiggle) accent";
beginchar(incr ipacode,9u#,min(asc_height#,10/7x_height#+.5dot_size#),0);
italcorr h#*slant-u#;
adjust_fit(0,0);
if serifs: numeric theta; theta=angle(1/6(6u-vair),1/4(h-x_height));
 pickup crisp.nib; numeric mid_width; mid_width=.4[vair,stem];
 pos1(vair,theta+90); pos2(vair,theta+90);
 pos3(vair,theta+90); pos4(vair,theta+90);
 z2-z1=z4-z3=(mid_width-crisp)*dir theta;
 lft x1r=w-rt x4l=hround 1.5u; top y4r=h;
 bot y1l=vround(bot y1l+min(2/3[x_height,h],y3l-.25vair)-top y1r);
 pair delta; ypart delta=3(y3l-y1l); delta=whatever*dir theta;
 filldraw z1l..controls(z1l+delta)and(z3l-delta)..z3l..z4l
  --z4r..controls(z4r-delta)and(z2r+delta)..z2r..z1r--cycle;  % stroke
else: pickup fine.nib; pos1(vair,180); pos2(vair,90);
 pos3(.5[vair,slab],90); pos4(vair,90); pos5(vair,180);
 lft x1r=w-rt x5l=hround 1.5u; x2-x1=x3-x2=x4-x3=x5-x4;
 bot y1=bot y4l=vround(.75[x_height,h]-vair);
 top y2r=top y5=h; y3=.5[y2,y4];
 filldraw stroke z1e{up}...z2e{right}..z3e..{right}z4e...{up}z5e; fi % stroke
penlabels(1,2,3,4,5); endchar;

cmchar "Umlaut (double dot) accent";
numeric dot_diam#,dot_diam;
dot_diam#=max(dot_size#,cap_curve#);
beginchar(incr ipacode,9u#,min(asc_height#,10/7x_height#+.5dot_diam#),0);
dot_diam=max(tiny.breadth,hround(max(dot_size,cap_curve)-2stem_corr));
italcorr h#*slant+.5dot_diam#-2.25u#;
adjust_fit(0,0);
pickup tiny.nib; pos1(dot_diam,0); pos2(dot_diam,90);
x1=x2=2.75u; top y2r=h+1;
if bot y2l<x_height+o+slab: y2l:=min(y2r-eps,x_height+o+slab+.5tiny); fi
y1=.5[y2l,y2r]; dot(1,2);  % left dot
pos3(dot_diam,0); penpos4(y2r-y2l,90); y3=y4=y1; x3=x4=w-x1;
dot(3,4);  % right dot
penlabels(1,2,3,4); endchar;

cmchar "Double acute (Long Hungarian umlaut) accent";
beginchar(incr ipacode,9u#,min(asc_height#,2x_height#),0);
italcorr h#*slant-u#;
adjust_fit(0,0);
x3-x1=x4-x2=hround 3u; y3=y1; y4=y2;
if serifs: pickup crisp.nib; x3+.5stem=hround(w-1.5u); x2=2.5u;
 y1+.5stem=h; y2=max(2/3[h,x_height],x_height+o+hair);
 numeric theta; theta=angle(z2-z1)+90;
 pos1(stem,theta); pos2(hair,theta);
 pos3(stem,theta); pos4(hair,theta);
 filldraw circ_stroke z1e--z2e;  % left diagonal
 filldraw circ_stroke z3e--z4e;  % right diagonal
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 pos3(stem,0); pos4(vair,0);
 rt x3r=hround(w-1.5u); lft x4l=hround(.5w+u-.5vair);
 top y1=h; bot y2=vround 2/3[h,x_height];
 filldraw stroke z1e--z2e;  % left diagonal
 filldraw stroke z3e--z4e; fi  % right diagonal
penlabels(1,2,3,4); endchar;

cmchar "Scandinavian circle accent";
beginchar(incr ipacode,13u#+4/3(asc_height#-x_height#)*slant,asc_height#,0);
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric circ_hair,circ_vair;
circ_hair=hround min(hair,u+.5); circ_vair=vround min(vair,(h-x_height)/6+.5);
penpos1(circ_vair,90); penpos3(circ_vair,-90);
penpos2(circ_hair,180); penpos4(circ_hair,0);
x2r=hround(.5w-1.5u-.5circ_hair);
x4r=w-x2r; x1=x3=.5w; y1r=h+apex_o; y2=y4=.5[y1,y3];
y3r=vround(1/3[x_height,h]+apex_o);
penstroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & pulled_arc.e(3,4) & pulled_arc.e(4,1) & cycle;  % bowl
penlabels(1,2,3,4); endchar;

cmchar "Hachek (check) accent";
beginchar(incr ipacode,9u#,CT(.75,.9)[x_height#,min(asc_height#,2x_height#)],0);
h':=vround min(asc_height,2x_height); % height of circumflex being inverted
if serifs: italcorr h#*slant+.5hair#-1.75u#;
 adjust_fit(0,0);
 pickup crisp.nib; pos2'(CT(.5,.6)[vair,curve],90); top y2'r=h;
 pos2(.5[vair,curve],90); x2=.5w;
 x1=w-x3=good.x 2.25u; top y1=top y3=h; y1-y2=.5(y2'-x_height);
 pos1(hair,angle(z2-z1)+90); pos3(hair,angle(z3-z2)+90);
 filldraw stroke z1e--z2e--z3e;  % diagonals
else: italcorr h#*slant-.5stem#+.5vair#-.75u#;
 adjust_fit(0,0);
 pickup fine.nib; pos1(vair,0); pos3(vair,0); x1=w-x3;
 pos2(stem,0); bot y2=vround(1/12[x_height,h']+o); x2=.5w;
 top y1=top y3=h+o; lft x1l=hround(rt x2r-3.25u-.5vair);
 z0=whatever[z1r,z2r]=whatever[z2l,z3l];
 y4l=y4r=y2; x4l=good.x .2[x2l,x2]; x4r=w-x4l;
 filldraw z4l--z1l--z1r--z0--z3l--z3r--z4r--cycle; fi  % diagonals
penlabels(0,1,2,3,4); endchar;

cmchar "Breve accent";
beginchar(incr ipacode,9u#,min(asc_height#,2x_height#),0);
italcorr h#*slant+.5vair#-1.5u#;
adjust_fit(0,0);
pickup crisp.nib; pos1(vair,-180); pos3(vair,0);
top y1=top y3=h; lft x1r=w-rt x3r=hround(2u-.5vair);
numeric mid_thickness; mid_thickness=vround 1/3[vair,stem];
pos2(mid_thickness,-90); x2=.5w;
bot y2r=vround max(x_height+o+tiny,1/3[x_height,h]+o-.5mid_thickness);
filldraw stroke z1e{down}...z2e{right}...{up}z3e;  % stroke
penlabels(1,2,3); endchar;

cmchar "Macron (bar) accent";
numeric macron_breadth#; macron_breadth#=.2[vair#,stem#];
beginchar(incr ipacode,9u#,.4[x_height#,asc_height#]+macron_breadth#,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=h+o; lft x1=w-rt x2=hround 1.25u;
filldraw stroke z1e--z2e;  % bar
penlabels(1,2); endchar;

cmchar "Dot accent";
numeric dot_diam#; dot_diam#=max(dot_size#,cap_curve#);
beginchar(incr ipacode,5u#,min(asc_height#,10/7x_height#+.5dot_diam#),0);
define_whole_blacker_pixels(dot_diam);
italcorr h#*slant+.5dot_diam#-2u#;
adjust_fit(0,0);
pickup tiny.nib; pos1(dot_diam,0); pos2(dot_diam,90);
x1=x2=.5w; top y2r=h+1;
if bot y2l<x_height+o+slab: y2l:=min(y2r-eps,x_height+o+slab+.5tiny); fi
y1=.5[y2l,y2r]; dot(1,2);  % dot
penlabels(1,2); endchar;

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

cmchar "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,-60); pos4(vair,135);
if serifs: pos2(stem,10);pos3(max(.7stem,hair),80);
else: pos2(vair,10);pos3(vair,80); fi
x1-u=x4-2u=.5w; y1=0; y2l=y4r=-3/5d; bot y3l=-d-oo;
x3r=.7[x4r,x2r]; x2l=u;
if serifs: filldraw circ_stroke z1e{(-3,-1)}...{down}z2e...
  {right}z3e...{(1,1)}z4e;
else: filldraw stroke z1e{(-3,-1)}...{down}z2e...{right}z3e...{(1,1)}z4e; fi
penlabels(1,2,3,4); endchar;

cmchar "Double Grave Accent";
beginchar(incr ipacode,9u#,min(asc_height#,2x_height#),0);
italcorr h#*slant-u#;
adjust_fit(0,0);
x3-x1=x4-x2=hround 3u; y3=y1; y4=y2;
if serifs: pickup crisp.nib; x1-.5stem=hround(1.5u); x4=w-2.5u;
 y1+.5stem=h; y2=max(2/3[h,x_height],x_height+o+hair);
 numeric theta; theta=angle(z2-z1)+90;
 pos1(stem,theta); pos2(hair,theta);
 pos3(stem,theta); pos4(hair,theta);
 filldraw circ_stroke z1e--z2e;  % left diagonal
 filldraw circ_stroke z3e--z4e;  % right diagonal
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 pos3(stem,0); pos4(vair,0);
 lft x1l=hround(1.5u); rt x2r=hround(.5w-u+.5vair);
 top y1=h; bot y2=vround 2/3[h,x_height];
 filldraw stroke z1e--z2e;  % left diagonal
 filldraw stroke z3e--z4e; fi  % right diagonal
penlabels(1,2,3,4); endchar;

cmchar "Grave Accent (under)";
beginchar(incr ipacode,9u#,asc_height#,0);
adjust_fit(0,0);
if serifs: pickup crisp.nib; x1+.5stem=hround(w-2u); x2=2/3[x1,w-x1];
 y2+.5stem=h+eps; y1=max(2/3[h,x_height],x_height+o+hair);
 numeric theta; theta=angle(z2-z1)+90;
 pos1(stem,theta); pos2(hair,theta);
 filldraw circ_stroke z1e--z2e;  % diagonal
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 rt x1r=hround(w-1.5u); lft x2l=hround(.5w-.25u-.5vair);
 top y2=h; bot y1=vround 2/3[h,x_height];
 filldraw stroke z1e--z2e; fi  % diagonal
penlabels(1,2); endchar;

cmchar "Acute Accent (under)";
beginchar(incr ipacode,9u#,asc_height#,0);
adjust_fit(0,0);
if serifs: pickup crisp.nib; x1-.5stem=hround 2u; x2=2/3[x1,w-x1];
 y2+.5stem=h+eps; y1=max(2/3[h,x_height],x_height+o+hair);
 numeric theta; theta=angle(z2-z1)+90;
 pos1(stem,theta); pos2(hair,theta);
 filldraw circ_stroke z1e--z2e;  % diagonal
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 lft x1l=hround 1.5u; rt x2r=hround(.5w+.25u+.5vair);
 top y2=h; bot y1=vround 2/3[h,x_height];
 filldraw stroke z1e--z2e; fi  % diagonal
penlabels(1,2); endchar;

cmchar "Subscript Arch";
beginchar(incr ipacode,9u#,min(asc_height#,2x_height#),0);
italcorr h#*slant+.5vair#-1.5u#;
adjust_fit(0,0);
pickup crisp.nib; pos1(vair,-180); pos3(vair,0);
numeric mid_thickness; mid_thickness=vround 1/3[vair,stem];
pos2(mid_thickness,90); x2=.5w;
bot y1=bot y3=vround max(x_height+tiny,1/3[x_height,h]-.5mid_thickness);
top y2r=h-o; lft x1r=w-rt x3r=hround(2u-.5vair);
filldraw stroke z1e{up}...z2e{right}...{down}z3e;  % stroke
penlabels(1,2,3); endchar;

def subtop = -hround(4/7desc_depth) enddef;

cmchar "Subscript Bridge";
beginchar(incr ipacode,9u#,0,1.36desc_depth#+.5vair#);
adjust_fit(0,0);
if serifs: pickup diacritic.nib;
 lft x1=lft x2=hround(.5w-2.5u); x3=x4=w-x1;
 top y1=top y3=subtop; bot y2=-d; y2=y4;
 draw z2--z1--z3--z4;
else: pickup crisp.nib;
 pos1(vair,0); pos2(vair,0); pos2'(vair,90);
 pos3(vair,0); pos3'(vair,90); pos4(vair,0);
 lft x1l=lft x2l=hround(.5w-2.5u-.5vair); x3=x4=w-x1; x2l=x2'; x3r=x3';
 top y2'r=subtop; bot y1=bot y4=-d; y2=y3=y2'r=y3'r;
 filldraw stroke z1e--z2e;
 filldraw stroke z3e--z4e;
 filldraw stroke z2'e--z3'e; fi
penlabels(1,2,3,4); endchar;

cmchar "Inverted Subscript Bridge";
beginchar(incr ipacode,9u#,0,1.36desc_depth#+.5vair#);
adjust_fit(0,0);
if serifs: pickup diacritic.nib;
 lft x1=lft x2=hround(.5w-2.5u); x3=x4=w-x1;
 top y1=top y3=subtop; bot y2=-d; y2=y4;
 draw z1--z2--z4--z3;
else: pickup crisp.nib;
 pos1(vair,0); pos2(vair,0); pos2'(vair,90);
 pos3(vair,0); pos3'(vair,90); pos4(vair,0);
 lft x1l=lft x2l=hround(.5w-2.5u-.5vair); x3=x4=w-x1; x2l=x2'; x3r=x3';
 top y1=top y4=subtop; bot y2'l=-d; y2=y3=y2'l=y3'l;
 filldraw stroke z1e--z2e;
 filldraw stroke z3e--z4e;
 filldraw stroke z2'e--z3'e; fi
penlabels(1,2,3,4); endchar;

cmchar "Subscript Square";
beginchar(incr ipacode,9u#,0,1.36desc_depth#+vair#);
adjust_fit(0,0);
if serifs: pickup diacritic.nib;
 lft x1=lft x2=hround(.5w-2.5u); x3=x4=w-x1;
 top y1=top y3=subtop; bot y2=-d; y2=y4;
 draw z1--z2--z4--z3--z1;
else: pickup crisp.nib;
 pos1(vair,0); pos1'(vair,90); pos2(vair,0); pos2'(vair,90);
 pos3(vair,0); pos3'(vair,90); pos4(vair,0); pos4'(vair,90);
 lft x1l=lft x2l=hround(.5w-2.5u-.5vair); x3=x4=w-x1;
 x2l=x1'=x2'; x3r=x3'=x4';
 top y1'r=subtop; bot y2'l=-d; y2=y3=y2'l=y3'l; y1=y1'r=y4=y4'r;
 filldraw stroke z1e--z2e;
 filldraw stroke z3e--z4e;
 filldraw stroke z1'e--z4'e;
 filldraw stroke z2'e--z3'e; fi
penlabels(1,2,3,4); endchar;

cmchar "Subscript Right Half-ring";
beginchar(incr ipacode,6u#,.5x_height#+vair#,0);
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
autorounded;
if serifs: pickup diacritic.nib;
 rt x2=hround(w-1.75u)+eps; x1=x3=w-x2;
 bot y3=-d; y2=.5[y1,y3]; top y1=h;
 draw z1{right}...z2{down}...z3{left};
else: pickup crisp.nib;
 pos1(vair,90); pos2(vair,0); pos3(vair,-90);
 rt x2r=hround(w-2u+.5vair)+eps; lft x1=lft x3=hround(w-rt x2r+.3vair);
 bot y3r=-d; y2=.5[y1,y3]; top y1r=h;
 filldraw stroke z1e{right}...z2e{down}...z3e{left}; fi
penlabels(1,2,3); endchar;

cmchar "Subscript Left Half-ring";
beginchar(incr ipacode,6u#,.5x_height#+vair#,0);
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
autorounded;
if serifs: pickup diacritic.nib;
 lft x2=hround 1.75u-eps; x1=x3=w-x2;
 bot y3=-d; y2=.5[y1,y3]; top y1=h;
 draw z1{left}...z2{down}...z3{right};
else: pickup crisp.nib;
 pos1(vair,-90); pos2(vair,0); pos3(vair,90);
 lft x2l=hround(2u-.5vair)-eps; rt x1=rt x3=hround(w-lft x2l-.3vair);
 bot y3l=-d; y2=.5[y1,y3]; top y1l=h;
 filldraw stroke z1e{left}...z2e{down}...z3e{right}; fi
penlabels(1,2,3); endchar;

cmchar "Subscript W";
beginchar(incr ipacode,9u#,0,1.4desc_depth#+.5vair#);
adjust_fit(0,0);
if serifs: pickup fine.nib;
 numeric hbreadth; hbreadth=max(diacritic,hair);
 pos2(vair,-210); pos3(hbreadth,-90); pos4(vair,10);
 pos6(vair,170); pos7(hbreadth,270); pos8(vair,30);
 lft x2r=hround 1.5u; top y2=top y8=subtop; y4=y6=y2-vair;
 bot y3r=bot y7r=-d;
 x3=.4[x2,x4]; x7=w-x3; x8=w-x2; x4=x6=good.x .5w;
 filldraw circ_stroke z2e{(-1,-2)}...z3e{right}...{(-1,5)}z4e;
 filldraw circ_stroke z8e{(1,-2)}...z7e{left}...{(1,5)}z6e;
else: pickup crisp.nib;
 pos2(vair,-210); pos3(vair,-90); pos4(vair,0);
 pos6(vair,180); pos7(vair,270); pos8(vair,30);
 lft x2r=hround(1.5u-.25vair); top y2=top y8=subtop; y4=y6=y2-vair;
 bot y3r=bot y7r=-d;
 x3=.4[x2,x4]; x7=w-x3; x8=w-x2; x4=x6=good.x .5w;
 filldraw circ_stroke z4e{down}...z3e{left}...{(1,2)}z2e;
 filldraw circ_stroke z6e{down}...z7e{right}...{(-1,2)}z8e; fi
penlabels(2,3,4,6,7,8); endchar;

cmchar "Seagull";
beginchar(incr ipacode,9u#,0,1.2desc_depth#+.5vair#);
adjust_fit(0,0);
if serifs: pickup fine.nib;
 numeric hbreadth; hbreadth=max(diacritic,hair);
 pos1(vair,160); pos2(hbreadth,90); pos3(vair,0);
 pos4(hbreadth,-90); pos5(vair,-160);
 x1=w-x5=1.2u; x3=.5w; x2=w-x4=.5[x1,x3];
 top y2r=top y4l=subtop+oo; bot y3=-d; bot y1=bot y5=.1[y3,y2];
 filldraw stroke z1e{(1,4)}...{right}z2e...{down}z3e;
 filldraw stroke z3e{up}...{right}z4e...{(1,-4)}z5e;
else: pickup crisp.nib;
 pos1(vair,150); pos2(vair,90); pos3(vair,0);
 pos4(vair,-90); pos5(vair,-150);
 x1=w-x5=1.2u; x3=.5w; x2=w-x4=.5[x1,x3];
 top y2r=top y4l=subtop+oo; bot y3=-d+.5vair;
 bot y1l=bot y5r=0[y3,y2]-.5vair;
 filldraw circ_stroke z3e{up}...{left}z2e...{(-1,-5)}z1e;
 filldraw circ_stroke z3e{up}...{right}z4e...{(1,-5)}z5e; fi
penlabels(1,2,3,4,5); endchar;

cmchar "Over-cross";
beginchar(incr ipacode,9u#,asc_height#,0);
adjust_fit(0,0);
if serifs: pickup diacritic.nib;
 lft x1=lft x2=hround(.5w-2.5u); x3=x4=w-x1;
 top y1=top y3=h-o; bot y2=bot y4=.2[x_height,h];
 draw z1--z4; draw z2--z3;
else: pickup crisp.nib;
 pos1(vair,65); pos2(vair,115); pos3(vair,115); pos4(vair,65);
 lft x1l=lft x2r=hround(.5w-2.5u-.25vair); x3=x4=w-x1;
 top y1r=top y3r=h-o; bot y2l=bot y4l=.2[x_height,h]-.6vair;
 filldraw stroke z1e--z4e; filldraw stroke z2e--z3e; fi
penlabels(1,2,3,4); endchar;

ipacode:=ipacode+2; % dotless i and j come here;

cmchar "Subscript Plus";
beginchar(incr ipacode,8u#,4vu#+vair#,0);
adjust_fit(0,0);
if serifs: pickup diacritic.nib;
 top y3=h; bot y4=0; x3=x4=good.x .5w;
 lft x1=hround(.5(w-(top y3-bot y4))); x2=w-x1; y1=y2=good.y .5[y3,y4];
 draw z1--z2; draw z3--z4;
else: pickup crisp.nib;
 pos1(vair,90); pos2(vair,90); pos3(vair,0); pos4(vair,0);
 top y3=h; bot y4=0;
 lft x3l=lft x4l=hround(.5w-.5vair);
 lft x1=hround(.5(w-(top y3-bot y4))); x2=w-x1;
 top y1r=top y2r=vround(.5[y3,y4]+.5vair);
 filldraw stroke z1e--z2e; filldraw stroke z3e--z4e; fi
penlabels(1,2,3,4); endchar;

cmchar "Raising Sign";
beginchar(incr ipacode,8u#,4vu#+vair#,0);
adjust_fit(0,0);
if serifs: pickup diacritic.nib;
 x1=w-x2; x3=x4=good.x(.5[x1,x2]); x2-x1=4u;
 y1=y2=y4; top y3=h; y4=good.y(y3-3vu);
 draw z1--z2; draw z3--z4;
else: pickup crisp.nib;
 pos1(vair,90); pos2(vair,90); pos3(vair,0); pos4(vair,0);
 x1=w-x2; lft x1=hround(2u-.25vair); lft x3l=lft x4l=hround(.5w-.5vair);
 y1l=y2l=y4; top y3=h; bot y4=vround(y3-3vu-.5vair);
 filldraw stroke z1e--z2e; filldraw stroke z3e--z4e; fi
penlabels(1,2,3,4); endchar;

cmchar "Lowering Sign";
beginchar(incr ipacode,8u#,4vu#+vair#,0);
adjust_fit(0,0);
if serifs: pickup diacritic.nib;
 x1=w-x2; x3=x4=good.x(.5[x1,x2]); x2-x1=4u;
 top y1=h; y1=y2=y3; y4=vround(y3-3vu);
 draw z1--z2; draw z3--z4;
else: pickup crisp.nib;
 pos1(vair,90); pos2(vair,90); pos3(vair,0); pos4(vair,0);
 x1=w-x2; lft x1=hround(2u-.25vair); lft x3l=lft x4l=hround(.5w-.5vair);
 y1r=y2r=y3; top y3=h; bot y4=vround(y3-3vu-.5vair);
 filldraw stroke z1e--z2e; filldraw stroke z3e--z4e; fi
penlabels(1,2,3,4); endchar;

cmchar "Advancing Sign";
beginchar(incr ipacode,8u#,4vu#+vair#,0);
adjust_fit(0,0);
if serifs: pickup diacritic.nib;
 x2=x3=x4=good.x(.5w+u); x1=good.x(x2-3u);
 top y3=h; bot y4=0; y1=y2=good.y(.5[y3,y4]);
 draw z1--z2; draw z3--z4;
else: pickup crisp.nib;
 pos1(vair,90); pos2(vair,90); pos3(vair,0); pos4(vair,0);
 lft x1=hround 2u; rt x2=rt x3r=rt x4r=hround(w-3u+.5vair);
 top y3=h; bot y4=vround(y3-4vu-.5vair);
 top y1r=top y2r=vround(.5[y3,y4]+.5vair);
 filldraw stroke z1e--z2e; filldraw stroke z3e--z4e; fi
penlabels(1,2,3,4); endchar;

cmchar "Retracting Sign";
beginchar(incr ipacode,8u#,4vu#+vair#,0);
adjust_fit(0,0);
if serifs: pickup diacritic.nib;
 x1=x3=x4=good.x(.5w-u); x2=good.x(x1+3u);
 top y3=h; bot y4=0; y1=y2=good.y(.5[y3,y4]);
 draw z1--z2; draw z3--z4;
else: pickup crisp.nib;
 pos1(vair,90); pos2(vair,90); pos3(vair,0); pos4(vair,0);
 rt x1=hround(w-2u); lft x2=lft x3l=lft x4l=hround(3u-.5vair);
 top y3=h; bot y4=vround(y3-4vu-.5vair);
 top y1r=top y2r=vround(.5[y3,y4]+.5vair);
 filldraw stroke z1e--z2e; filldraw stroke z3e--z4e; fi
penlabels(1,2,3,4); endchar;

cmchar "Vertical Stroke (Superior)";
beginchar(oct"042",4u#,asc_height#,0);
adjust_fit(0,0);
if serifs: pickup tiny.nib;
 pos1(diacr,0); pos2(diacr,0);
 lft x1l=lft x2l=hround(.5w-.5diacr);
 top y1=h; bot y2=vround(top y1-4vu);
 filldraw stroke z1e--z2e;
else: pickup crisp.nib;
 pos1(vair,0); pos2(vair,0);
 lft x1l=lft x2l=hround(.5w-.5vair);
 top y1=h; bot y2=vround(top y1-4vu);
 filldraw stroke z1e--z2e; fi
penlabels(1,2); endchar;

cmchar "Length Mark";
beginchar(oct"072",5u#,x_height#,0);
adjust_fit(if monospace: 1u#,1u# else: 0,0 fi);
pickup if serifs: tiny.nib; else: crisp.nib; fi
x1=w-x2; x3=.5[x1,x2]; rt x2-lft x1=3u;
top y1=top y2=h if serifs: +oo fi; top y1-bot y3=.387x_height;
filldraw z1--z2--z3--cycle;
x5=w-x6; x4=.5[x5,x6]; rt x6-lft x5=3u;
bot y5=bot y6=if serifs: -oo else: 0 fi; top y4-bot y5=.387x_height;
filldraw z4--z5--z6--cycle;
penlabels(1,2,3,4,5,6); endchar;

cmchar "Half-length Mark";
beginchar(oct"073",5u#,x_height#,0);
adjust_fit(if monospace: 1u#,1u# else: 0,0 fi);
pickup if serifs: tiny.nib; else: crisp.nib; fi
x1=w-x2; x3=.5[x1,x2]; rt x2-lft x1=3u;
top y1=top y2=h if serifs: +oo fi; top y1-bot y3=.387x_height;
filldraw z1--z2--z3--cycle;
penlabels(1,2,3); endchar;

cmchar "Bottom Tie Bar";
beginchar(oct"074",14u#,v_center(.35x_height#));
adjust_fit(0,0);
pickup fine.nib;
numeric light_stem; light_stem=Vround .5[vair,stem];
x1-.5hair=hround u; y1+.5hair=vround(h+.5hair); x3=w-x1; y3=y1;
pos2(light_stem,90); x2=.5w; y2l=good.y -d;
numeric theta; theta=angle((z2-z1)yscaled 3);
pos1(hair,90+theta); pos3(hair,90-theta);
filldraw z1l{dir theta}...z2l...{dir-theta}z3l
 ..z3r{-dir-theta}...z2r...{-dir theta}z1r..cycle;  % arc
penlabels(1,2,3); endchar;

cmchar "Top Tie Bar";
beginchar(oct"076",14u#,v_center(.35x_height#));
adjust_fit(0,0);
pickup fine.nib;
numeric light_stem; light_stem=Vround .5[vair,stem];
x1-.5hair=hround u; y1-.5hair=vround(-d-.5hair); x3=w-x1; y3=y1;
pos2(light_stem,90); x2=.5w; y2=good.y h;
numeric theta; theta=angle((z2-z1)yscaled 3);
pos1(hair,90+theta); pos3(hair,90-theta);
filldraw z1l{dir theta}...z2l...{dir-theta}z3l
 ..z3r{-dir-theta}...z2r...{-dir theta}z1r..cycle;  % arc
penlabels(1,2,3); endchar;

cmchar "Reversed Apostrophe";
beginchar(oct"134",5u#,asc_height#,0);
italcorr asc_height#*slant+.5dot_size#-2u#;
adjust_fit(0,0);
x1-.5dot_size=hround(.5w-.5dot_size); y1+.5dot_size=h;
if monospace: comMA(1,a,dot_size,.28u,vround 1.5comma_depth);  % large comma
else: comMA(1,a,dot_size,.25u,comma_depth); fi  % comma with increased jut
penlabels(1); endchar;

cmchar "Corner";
beginchar(oct"136",5.2u#,asc_height#,0);
adjust_fit(0,0);
if serifs: pickup diacritic.nib;
 lft x1=hround .2u; rt x2=rt x3=hround(w-1u); top y1=top y2=h-o;
 top y2-bot y3=vround 4vu;
 draw z1--z2--z3;
else: pickup crisp.nib;
 pos1(vair,90); pos2(vair,90); pos3(vair,0); pos4(vair,0);
 lft x1=hround .2u; rt x2=rt x3r=rt x4r=hround(w-1u);
 top y1r=top y2r=top y3=h-o; top y3-bot y4=vround 4vu;
 filldraw stroke z1e--z2e; filldraw stroke z3e--z4e; fi
penlabels(1,2,3,4); endchar;

cmchar "Open corner";
beginchar(oct"137",5.2u#,asc_height#,0);
adjust_fit(0,0);
if serifs: pickup diacritic.nib;
 rt x1=hround(w-.2u); lft x2=lft x3=hround 1u; top y1=top y2=h-o;
 top y2-bot y3=vround 4vu;
 draw z1--z2--z3;
else: pickup crisp.nib;
 pos1(vair,90); pos2(vair,90); pos3(vair,0); pos4(vair,0);
 rt x1=hround(w-.2u); lft x2=lft x3l=lft x4l=hround 1u;
 top y1r=top y2r=top y3=h-o; top y3-bot y4=vround 4vu;
 filldraw stroke z1e--z2e; filldraw stroke z3e--z4e; fi
penlabels(1,2,3,4); endchar;

cmchar "Right-hook (rhoticity)";
beginchar(oct"176",6u#,x_height#,0);
adjust_fit(0,if monospace: 2u# else: 0 fi);
if serifs: pickup tiny.nib;
 numeric hook_hair; hook_hair=max(vround .6stem, hair);
 pos3(hook_hair,0); pos4(hook_hair,0); pos5(vair,90); pos6(hair,180);
 x1=0; top y2=h; rt x6l=vround(w-.75u+.5hair);
 y1=min(.95x_height,y2-2hook_hair);
 x2=x4=.36[x1,x6]; x5=.5[x2,x6]; y4=.8[y5,y2]; z3=z2;
 y5l=bar_height; y6=.5[bar_height,h];
 pos1(hook_hair,angle(z2-z1)+90); pos2(hook_hair,angle(z2-z1)+90);
 filldraw circ_stroke z2e--z1e;
 filldraw circ_stroke z3e--z4e{down}..z5e{right}..{up}z6e;
else: pickup crisp.nib;
 pos3(thin_hair,0); pos4(thin_hair,0); pos5(vair,90); pos6(thin_hair,180);
 x1=0; top y2=h; rt x6l=vround(w-.75u+.5hair);
 y1=min(.95x_height,y2-2vair);
 x2=x4=.36[x1,x6]; x5=.5[x2,x6]; y4=.8[y5,y2]; z3=z2;
 y5l=bar_height; y6=.5[bar_height,h];
 pos1(vair,angle(z2-z1)+90); pos2(vair,angle(z2-z1)+90);
 filldraw circ_stroke z2e--z1e;
 filldraw circ_stroke z3e--z4e{down}..z5e{right}..{up}z6e; fi
penlabels(1,2,3,4,5,6); endchar;

cmchar "Vertical Stroke (Inferior)";
beginchar(oct"177",4u#,4vu#-desc_depth#,desc_depth#);
adjust_fit(if monospace: 2u#,2u# else: 0,0 fi);
if serifs: pickup tiny.nib;
 pos1(diacr,0); pos2(diacr,0);
 lft x1l=lft x2l=hround(.5w-.5diacr);
 bot y2=-d; top y1=h;
 filldraw stroke z1e--z2e;
else: pickup crisp.nib;
 pos1(vair,0); pos2(vair,0);
 lft x1l=lft x2l=hround(.5w-.5vair);
 bot y2=-d; top y1=h;
 filldraw stroke z1e--z2e; fi
penlabels(1,2); endchar;

cmchar "Hooktop";
beginchar(oct"043",4u#,.9asc_height#,0);
italcorr h#*slant+1.5u#;
adjust_fit(if monospace: 2u#,2u# else: 0,0 fi);
if serifs: pickup tiny.nib;
 pos1(diacr,0); pos2(diacr,0);
 lft x1l=lft x2l=hround(.5w-.5diacr); y1+.5flare=y2=x_height;
 filldraw stroke z1e--z2e;
 hooktop(2,3,4,5,diacr,hround(x1+3.25u),h+.5vair,.88,.5,1/3);
else: pickup fine.nib;
 pos1(vair,0); pos2(vair,0);
 lft x1l=lft x2l=hround(.5w-.5vair); y1+.5flare=y2=x_height;
 filldraw stroke z1e--z2e;
 hooktop(2,3,4,5,vair,hround(x1+3.25u),h+.5vair,5/6,.5,1/3); fi
penlabels(1,2,3,4,5); endchar;

cmchar "Right-tail";
beginchar(oct"044",4u#,0,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=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=oo;
 right_tail(1,2,3,4,vair,hround(x1+3.25u),.85,.5,.5); fi
penlabels(1,2,3,4,5); endchar;

cmchar "Palatalization Hook";
beginchar(oct"045",4u#,0,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=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=oo;
 left_tail(1,2,3,4,vair,hround(x1-3.25u)); fi
penlabels(1,2,3,4,5); endchar;

cmchar "Superimposed Tilde";
beginchar(oct"046",10u#,.5[asc_height#,body_height#],0);
big_tilde; endchar;

cmchar "Vertical Bar Accent";
beginchar(oct"234",9u#,min(asc_height#,2x_height#),0);
adjust_fit(0,0);
if serifs: pickup crisp.nib; x1=x2=.5w;
 top y1=h+o+eps; y2=max(2/3[h,x_height],x_height+o+hair);
 pos1(stem,0); pos2(hair,0);
 filldraw circ_stroke z1e--z2e;  % diagonal
else: pickup fine.nib; pos1(stem,0); pos2(vair,0); x1=x2=.5w;
 top y1=h+o; bot y2=vround 2/3[h,x_height];
 filldraw stroke z1e--z2e; fi  % diagonal
penlabels(1,2); endchar;

cmchar "Double Vertical Bar Accent";
beginchar(oct"235",9u#,min(asc_height#,2x_height#),0);
adjust_fit(0,0);
x1=x2; x3=x4; y3=y1; y4=y2;
if serifs: pickup crisp.nib; x1=hround(3.8u-.5stem); x3=w-x1;
 top y1=h+o+eps; y2=max(2/3[h,x_height],x_height+o+hair);
 numeric theta; theta=angle(z2-z1)+90;
 pos1(stem,theta); pos2(hair,theta);
 pos3(stem,theta); pos4(hair,theta);
 filldraw circ_stroke z1e--z2e;  % left diagonal
 filldraw circ_stroke z3e--z4e;  % right diagonal
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 pos3(stem,0); pos4(vair,0); x1=hround(3.8u-.5stem); x3=w-x1;
 top y1=h+o; bot y2=vround 2/3[h,x_height];
 filldraw stroke z1e--z2e;  % left diagonal
 filldraw stroke z3e--z4e; fi  % right diagonal
penlabels(1,2,3,4); endchar;

cmchar "Grave Dot Accent";
numeric dot_diam#; dot_diam#=max(dot_size#,cap_curve#);
beginchar(oct"236",9u#,min(asc_height#,2x_height#),0);
define_whole_blacker_pixels(dot_diam);
adjust_fit(0,0);
if serifs: pickup crisp.nib; x1-.5stem=hround 1.5u; x2=.45[x1,w-x1];
 y1+.5stem=h+eps; y2=max(2/3[h,x_height],x_height+o+hair);
 numeric theta; theta=angle(z2-z1)+90;
 pos1(stem,theta); pos2(hair,theta);
 filldraw circ_stroke z1e--z2e;  % diagonal
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 lft x1l=hround 1.5u; rt x2r=hround(.5w-.25u+.5vair);
 top y1=h; bot y2=vround 2/3[h,x_height];
 filldraw stroke z1e--z2e; fi  % diagonal
pickup tiny.nib; pos3(dot_diam,0); pos4(dot_diam,90);
x3=x4=.7w; y4=.45[bot y2,top y1];
y3=.5[y4l,y4r]; dot(3,4);  % dot
penlabels(1,2,3,4); endchar;

cmchar "Acute Dot Accent";
numeric dot_diam#; dot_diam#=max(dot_size#,cap_curve#);
beginchar(oct"237",9u#,min(asc_height#,2x_height#),0);
define_whole_blacker_pixels(dot_diam);
italcorr h#*slant-if serifs: 1 fi u#;
adjust_fit(0,0);
if serifs: pickup crisp.nib; x1+.5stem=hround(w-1.5u); x2=.45[x1,w-x1];
 y1+.5stem=h+eps; y2=max(2/3[h,x_height],x_height+o+hair);
 numeric theta; theta=angle(z2-z1)+90;
 pos1(stem,theta); pos2(hair,theta);
 filldraw circ_stroke z1e--z2e;  % diagonal
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 rt x1r=hround(w-1.5u); lft x2l=hround(.5w+.25u-.5vair);
 top y1=h; bot y2=vround 2/3[h,x_height];
 filldraw stroke z1e--z2e; fi  % diagonal
pickup tiny.nib; pos3(dot_diam,0); pos4(dot_diam,90);
x3=x4=.3w; y4=.45[bot y2,top y1];
y3=.5[y4l,y4r]; dot(3,4);  % dot
penlabels(1,2); endchar;

cmchar "Celtic palatalization mark";
beginchar(oct"040",6u#,asc_height#,0);
italcorr h#*slant;
adjust_fit(if monospace: 1u#,1u# else: 0,0 fi);
if serifs: pickup crisp.nib; x1+.5stem=hround(w-.5u);
 x2=hround 1u;
 y1+.5stem=h+eps; y2=.9x_height;
 numeric theta; theta=angle(z2-z1)+90;
 pos1(stem,theta); pos2(hair,theta);
 filldraw circ_stroke z1e--z2e;  % diagonal
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 rt x1r=hround(w-.5u); lft x2l=hround 1u;
 top y1=h; bot y2=vround .9x_height;
 filldraw stroke z1e--z2e; fi  % diagonal
penlabels(1,2); endchar;

cmchar "Leftward Pointer";
beginchar(oct"275",6u#,asc_height#,0);
adjust_fit(if monospace: 1u#,1u# else: 0,0 fi);
pickup diacritic.nib;
lft x2=hround .5u-eps; x1=x3=w-x2;
y1-y2=y2-y3; y2=.65[x_height,h]; y1=h;
draw z1--z2--z3;  % diagonals
labels(1,2,3); endchar;

cmchar "Rightward Pointer";
beginchar(oct"276",6u#,asc_height#,0);
adjust_fit(if monospace: 1u#,1u# else: 0,0 fi);
pickup diacritic.nib;
rt x2=hround(w-.5u)+eps; x1=x3=w-x2;
y1-y2=y2-y3; y2=.65[x_height,h]; y1=h;
draw z1--z2--z3;  % diagonals
labels(1,2,3); endchar;

% This symbol looks like a pipe but is used as the vertical line of tone bars.
cmchar "Tone bar";
beginchar(oct"277",CT(5u#,5.56u#),asc_height#,0);
italcorr asc_height#*slant+.5rule_thickness#-2u#;
adjust_fit(0,0);
if serifs: pickup rule.nib;
 x1=x2=good.x .5w; y1=h; y2=-d;
 draw z1--z2;  % stem
 labels(1,2);
else: pickup fine.nib;
 pos1(hair,0); pos2(hair,0);
 lft x1l = lft x2l = hround(.5w-.5hair);
 top y1=h+o; bot y2=-d-o;
 filldraw stroke z1e--z2e;
 penlabels(1,2); fi
endchar;


% end of tipadiac.mf
