% Based on the Computer Modern source file greekl.mf by D E Knuth.

% Edited by Ariel Barton to produce better sans serif symbols

% Date: 2013/03/22

% Character codes \0013--\0047 are generated.

cmchar "Lowercase Greek alpha";
beginchar(oct"013",11u#,x_height#,0);
italcorr max(1/3x_height#*slant+.5hair#+.5u#,x_height#*slant-.5u#);
adjust_fit(0,0); pickup fine.nib;
 pos1(vair,-90); pos2(curve,-180); pos3(vair,-270);
z4=(w-3.25u,9/16h); z5=(w-2.75u,.5[vair,y4]);
numeric theta; theta=angle(z4-z5)-90;
pos4(if hefty: stem else: stem' fi,theta); 
pos5(if hefty: stem else: stem' fi,theta);
pos6(vair,90); 
if serifs: 
  pos7(hair,180); pos0(hair,0);
  rt x0r=hround(w-u); 
  top y0=vround .8[bar_height,h]; 
else: 
  pos7(if hefty: vair else: hair fi,145);
  pos0(if hefty: vair else: hair fi,-15);
  rt x0r=hround(w-0.7u); 
  top y0l=vround .9[bar_height,h]; 
fi
x1=x3=.5w-u; lft x2r=hround(1.5u-.5curve);
x6=w-u; x7l=hround(w+.5hair-epsilon);
bot y1r=bot y6l=-oo;
y2=.5[y1,y3]; top y3r=h+oo; y7l=1/4bar_height;
filldraw stroke z0e{down}...pulled_arc.e(1,2) & pulled_arc.e(2,3)
 ...z4e---z5e...z6e{right}...if serifs: {up} fi z7e; % diagonal, bowl, and hook
math_fit(-.3x_height#*slant+.5curve#-u#,1/3x_height#*slant+.5hair#+.5u#);
penlabels(0,1,2,3,4,5,6,7); endchar;

cmchar "Lowercase Greek beta";
beginchar(oct"014",9.5u#,asc_height#,desc_depth#);
italcorr .5[x_height#,asc_height#]*slant-u#;
adjust_fit(0,0); pickup fine.nib;
pos0(hair,180); pos1(hair,180); pos2(vair,90);
pos3(.8[if hefty: vair else: hair fi,stem],0);
pos4(if hefty: 0.9 fi vair,-90); 
pos6(if hefty: 0.9 fi vair,-270); 
pos7(if hefty: 0.8[vair,stem] else: stem fi,-360); pos8(vair,-450); 
pos9(if hefty: vair else: hair fi,-540);
x0=x1; x1l=x9l; lft x0r=hround(1.5u-.5hair); 
if serifs: 
  pos5(hair,-180);
  x2=x4=x6=x8=.5w-.25u;
  rt x5l=hround(x4-u); 
  top y6r-bot y4r=vstem+eps;
  y5=.5[y4,y6];  
  top y6r=x_height;
else:
  pos5(vair,-90);
  pos5'(vair,-270);
  z5 = z5';
  x2=x8=.5w-.25u; 
  x5 = x1l;
  x4=x6=0.4[x5,x2];
  y6l = y5r;
  y5=.5[y4l,y6l];  
  top y5l=x_height;
fi
rt x3r=hround(w-1.75u); rt x7r=hround(w-u); 
if serifs:fi 
bot y0=-d; y1=x_height; top y2r=h+oo; y3=.5[y2,y4];
bot y8r=-oo; y7=y9=.55[y6,y8];
if serifs: if y6l<y4l: y6l:=y4l:=y5; fi fi
filldraw stroke z0e---z1e...pulled_arc.e(2,3) &
 if serifs: pulled_arc.e(3,4) ...{up}z5e 
 else: z3e{down}..z4e---z5e fi;  % stem and upper bowl
filldraw stroke 
 if serifs: z5e{up}...pulled_arc.e(6,7)
 else: z5'e---z6e..z7e{down} fi 
 & pulled_arc.e(7,8)...{up}z9e;  % lower bowl
math_fit(desc_depth#*slant+.5hair#-u#,.7x_height#*slant+.5curve#-1.5u#);
penlabels(0,1,2,3,4,5,6,7,8,9); endchar;

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

cmchar "Lowercase Greek delta";
beginchar(oct"016",8u#,asc_height#,0);
italcorr .9asc_height#*slant+.5hair#-1.5u#;
adjust_fit(0,0); pickup fine.nib;
x0=-u; y0=1.1h;
numeric light_flare; 
light_flare= if serifs: 2/3[vair,flare] else: vair fi;
if serifs: x1=w-2u-.5light_flare;
else:      x1=w-2u-.25light_flare; fi
y1=h-.5light_flare; 
numeric theta; theta=angle (z1-z0);
pos1(light_flare,theta-90); 
pos2(.2[vair,light_flare],-90); pos3(vair,theta);
x2=x3+u; y2=h;
x4=x6=.5w+.5u; top y8r=x_height+oo; z4=z8;
pos6(vair,-90); pos7(if hefty: 0.5[vair,stem] else: stem fi,-180); pos8(vair,-270);
pos4(stem,angle(z4-z0)+90); 
if serifs: pos5(stem,30);
else: pos5(stem,0); fi
z3=.5[.5[z1,z4],z0];
y5+.1x_height=y7=.5[y6,y8]; bot y6r=-oo;
lft x7r=hround(1.4u-.5stem); rt x5r=hround(w-u);
filldraw stroke z1e{z0-z1e}....z2e....z3e{(z0-z1)rotated 90}
 ...z4e{z4e-.8[z4,z0]}
 ....z5e{down}...pulled_arc.e(6,7) & pulled_arc.e(7,8);  % hook and bowl
if serifs: filldraw z1r{z1r-z0}...z1l{z0-z1l}--cycle; fi % bulb
math_fit(-.3x_height#*slant+.5curve#-u#,.7x_height#*slant-.5u#);
penlabels(0,1,2,3,4,5,6,7,8); endchar;

cmchar "Lowercase Greek epsilon";
beginchar(oct"017",8u#,x_height#,0);
italcorr x_height#*slant+.5hair#-2u#;
adjust_fit(0,0); pickup fine.nib;
if serifs:
pos0(bar,90); pos4(hair,300); 
x0=x1+u; x6=x0;  x3=.5[x0,x1];
top y0r=top y1r=h; 
else:
pos0(if hefty: vair else: hair fi,75); pos4(if hefty: vair else: hair fi,310); 
x6=x1+u; x3=.5[x6,x1]; x0=x6+bar/2; 
top y1r=h; 
y0 = 0.3[y1,y1l];
fi
pos1(bar,90); pos2(curve,180);
pos3(vair,270); pos6(bar,90); pos7(bar,90);
x1=.5w+.5u; lft x2r=hround(1.5u-.5curve);
x4r=good.x(w-u); x5=w+.5u; z7=z2l;
y2=y5=y6=bar_height; bot y3r=-oo;
path p; p=z3r{right}...{up}z5;
numeric t; t=ypart(((x4r,y3r)--(x4r,y5))intersectiontimes p);
y4r=ypart point t of p;
filldraw sans_circ_stroke z0e..pulled_arc.e(1,2) & pulled_arc.e(2,3)
 ...z4e{direction t of p};  % arc
filldraw sans_circ_stroke z6e--z7e;  % bar
math_fit(-.3x_height#*slant+.5curve#-u#,ic#);
penlabels(0,1,2,3,4,5,6,7); endchar;

cmchar "Lowercase Greek zeta";
beginchar(oct"020",9u#,asc_height#,desc_depth#);
italcorr .75[x_height#,asc_height#]*slant-1.5u#;
adjust_fit(0,0); pickup fine.nib;
top y0=h;
if serifs:
  pos0(hair,-360); pos1(vair,-270); pos2(hair,-180); pos3(vair,-90);
  pos8(vair,-135);
  top y3l=bot y1l+vstem+eps=vround(y0-.25(h-x_height)); 
  x1=x3=.5[x0,x2]; 
  y2=.5[y1,y3];
  lft x0l=hround 3.5u; 
else:
  pos0(vair,-360); pos1(0.8vair,-270); pos2(vair,-270); pos3(0.9vair,-90);
  pos8(vair,-125);
  pos2'(vair,-90);
  z2' = z2;
  x1=x3=.8[x0,x2]; 
  top y2r=vround(y0-.4(h-x_height)); 
  y2l=y3r; y2r=y1r;
  lft x0l=hround 3u; 
fi
numeric theta; theta=90-angle(25u,x_height); slope:=-x_height/25u;
pos6(stem,theta); pos7(vair,-90);
rt x2l=hround max(rt x0r,w-2u)+eps;
if serifs: if y1r>y3r: y1r:=y3r:=y2; fi fi
lft x4l=hround u; x4r-x4l=(hround .6[vair,stem])-fine;
x6+.5u=x7=w-2u; x8=.5w+.75u;
y6=-.1d; y8=-3/4d-oo; bot y7r=-d-oo;
ellipse_set(3l,4l,5l,6l); ellipse_set(3r,4r,5r,6r);
y4l:=.9[y6,y4l]; y4=y4r:=.9[y6,y4r];
if serifs:
  filldraw circ_stroke z0e{down}...z1e{right}...{up}z2e;  % opening hook
  filldraw circ_stroke z8e{x7-x8,2(y7-y8)}...z7e{right}
   ...z6e---z5e....{up}z4e
   ..tension 1 and atleast1.5..{right}z3e...{down}z2e;  % main stroke
else:
  filldraw stroke z0e{down}...z1e{right}--z2e;  % opening hook
  filldraw stroke z8e{x7-x8,2(y7-y8)}...z7e{right}
   ...z6e---z5e....{up}z4e
   ..tension 1 and atleast1.5..{right}z3e---z2'e;  % main stroke
fi
math_fit(-.2asc_height#*slant-.5u#,0);
penlabels(0,1,2,3,4,5,6,7,8); endchar;

cmchar "Lowercase Greek eta";
beginchar(oct"021",9u#,x_height#,desc_depth#);
italcorr .8x_height#*slant+.5stem#-u#;
adjust_fit(0,0); pickup fine.nib;
x0=0; x1l=x2l; pos2(stem,0); lft x2l=hround(2.5u-.5stem); 
if serifs: y2-.5stem=-oo;
else: y2 = 0; fi
hook_in(0,a,1);  % opening hook
filldraw sans_circ_stroke z2e--z1e;  % left stem
x4+.5stem=hround(w-1.5u+.5stem); ital_arch(2,3,4);  % arch
pos5(stem,0); x5=x4; 
if serifs: y5-.5stem=-d-o;
else: y5=-d; fi
filldraw sans_circ_stroke z5e--z4e;  % right stem
math_fit(-2/3x_height#*slant+.5hair#+.5u#,ic#-1/3x_height#*slant);
penlabels(0,a,1,2,3,4,5); endchar;

cmchar "Lowercase Greek theta";
beginchar(oct"022",8.25u#,asc_height#,0);
italcorr .7asc_height#*slant+.5curve#-u#;
adjust_fit(0,0); pickup fine.nib;
pos1(vair,90); pos2(curve,180); pos3(vair,270); pos4(curve,360);
x1=x3=.5w; lft x2r=hround(1.5u-.5curve); x4=w-x2;
top y1r=h+oo; y2=y4=.5[y1,y3]; bot y3r=-oo;
filldraw stroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & pulled_arc.e(3,4) & pulled_arc.e(4,1);  % bowl
pos2'(bar,90); pos4'(bar,90); z2'=z2l; z4'=z4l;
filldraw stroke z2'e--z4'e;  % bar
math_fit(-.3asc_height#*slant-u#+.5curve#,ic#-.5u#);
penlabels(1,2,3,4); endchar;

cmchar "Lowercase Greek iota";
beginchar(oct"023",5u#,x_height#,0);
italcorr 1/3x_height#*slant+.5hair#+.5u#;
adjust_fit(if monospace: u#,u# else: 0,0 fi); pickup fine.nib;
pos1(stem,0); lft x1l=hround(1.5u-.5stem);
if serifs: y1+.5stem=h+oo;
else: y1=h; fi
x2=x1-.25u; x4=w; hook_out(2,3,4)(skewed);  % closing hook
filldraw sans_circ_stroke z1e{down}...{-u,-x_height}z2e;  % stem
math_fit(0,ic#); penlabels(1,2,3,4); endchar;

cmchar "Lowercase Greek kappa";
beginchar(oct"024",9u#,x_height#,0);
italcorr 1/3x_height#*slant+.5hair#+.5u#;
adjust_fit(0,0); pickup fine.nib;
pos1(stem,0); pos2(stem,0); pos3(vair,90); 
if serifs: 
	pos4(vair,90);
	pos9(hair,180);
	x4+.5flare=hround(w-1.5u);
	y9=1/3x_height;
else:  
	pos4(hair,90); 
	pos9(vair,180);
	x4r=hround(w-1.6u);
	y9=1/5x_height;
fi
pos5(flare,90);
x1=x2=x3; lft x1l=hround(1.5u-.5stem); 
if serifs: 
  y1+.5stem=h+oo; y2-.5stem=-oo;
  filldraw z1l---z2l..z2r---z1r..cycle;  % stem
else: 
  y1=h; y2=0;
  filldraw stroke z1e--z2e; 
fi
y3=bar_height; top y4r=h;  z5r=z4r;
path p,q; p=z3l{right}..{right}z4l; q=z5r{right}..z5l{left}...cycle;
numeric t; t=ypart(p intersectiontimes q);
filldraw stroke z3e{right}..{right}z4e;  % upper diagonal
if serifs: filldraw subpath(0,t) of q--cycle; fi  % bulb
pos7(if hefty: 0.6[vair,stem] else: stem fi,0); pos8(vair,90); 
x9+.5hair=hround(w+.5hair-epsilon); 
lft x7l=hround(w-2.75u-.5stem); y7=1/2y3; x8=w-1.2u; bot y8l=-oo;
filldraw stroke z3e{right}...z7e{down}
 ...z8e{right}...{up}z9e;  % lower diagonal
math_fit(0,ic#); penlabels(1,2,3,4,5,7,8,9); endchar;

cmchar "Lowercase Greek lambda";
beginchar(oct"025",10.5u#,asc_height#,0);
adjust_fit(0,0); pickup fine.nib;
pos1(vair,90); lft x1=hround .1u; top y1r=h;
x2=x1+2u; y2=.7[x_height,h]; x3=w-2u; 
if serifs:
	bot y4=-oo;
	z4-(.25u,0)=whatever[z2,z3]; pos4(stem,0);
	y3=max(.07h,y4+eps);
	numeric theta; theta=angle(z2-z3)-90;
	pos2(stem,theta); pos3(stem,theta); 
	filldraw circ_stroke z1e{right}...z2e---z3e
	 ...{2(x4e-x3e),y4e-y3e}z4e;  % long diagonal
	y5=.5[bar_height,x_height]; z5=whatever[z2,z3];
	x6=1.5u; y6-.5stem=-oo; pos5(hair,theta-90); pos6(stem,angle(z5-z6)-90);
	filldraw circ_stroke z6e--z5e; % short diagonal
else:
	bot y4=0;
	y3=max(.07h,y4+eps);
	z4-(.25u,0)=whatever[z2,z3];
	y4l = y4r = y4;
	numeric theta; theta=angle(z2-z3)-90;
	pos2(stem',theta); pos3(stem',theta); 
	z4l = whatever[z3l,z2l]; z4r = whatever[z3r,z2r];
	filldraw stroke z1e{right}...z2e---z4e;  % long diagonal
	y5=.5[bar_height,x_height]; z5=whatever[z2,z3];
	x6=1.7u; y6-.5stem=-oo; 
	z5l=whatever[z2,z3]; z5l=whatever[z5,z6]+z6l-z6;
	z5=0.5[z5r,z5l];	
	pos6(0.6[vair,stem],angle(z5-z6)-90);
	z6'=whatever[z5,z6];
	z6'l=whatever[z5l,z6l];
	z6'r=whatever[z5r,z6r];
	y6'=y6'r=y6'l=0;
	filldraw stroke z6'e--z5e; % short diagonal
fi
penlabels(1,2,3,4,5,6); 
endchar;

cmchar "Lowercase Greek mu";
beginchar(oct"026",if hefty: 9.5u# else: 9u# fi,x_height#,desc_depth#);
italcorr 1/3x_height#*slant+.5hair#+.5u#;
adjust_fit(0,0); pickup fine.nib; interim superness:=more_super;
pos1(stem,-180); pos2(stem,-180); x1=x2; x1l=x3l;
lft x1r=hround(1.5u-.5stem);
if serifs: y1+.5stem=h+oo; y2-.5stem=-d-o; y6+.5stem=h;
else: y1=y6=h; y2=-d; fi
if serifs: filldraw z1r---z2r..z2l---z1l..cycle;  % left stem
else:  filldraw z1r--z2r--z2l--z1l--cycle; fi
pos3(if hefty: vair else: stem fi,-180); pos4(vair,-90); pos5(hair,0); x4=.5[x1,x6];
pos6(stem,0); rt x6r=hround(6.5u+.5stem);
x5=x6=x7; x9=w; 
hook_out(7,8,9);
y3=.7[y4,y5]; bot y4r=-oo; y5=.57h;
filldraw stroke super_arc.e(3,4)...{up}z5e; % left stem and arc
filldraw sans_circ_stroke z6e--z7e;  % right stem
math_fit(desc_depth#*slant+.5stem#-u#,ic#);
penlabels(1,2,3,4,5,6,7,8,9); endchar;

cmchar "Lowercase Greek nu";
beginchar(oct"027",8.5u#,x_height#,0);
italcorr x_height#*slant+.5stem#-u#;
adjust_fit(0,0); pickup fine.nib;
pos3(vair,-90); pos4(stem,0); bot y3r=0; 
if serifs: y4+.5stem=h+oo;
else: y4 = h; fi
x3-.5stem=hround(1.5u-.5stem); x4+.5stem=hround(w-1.5u+.5stem);
filldraw sans_circ_stroke z4e{down}...{-36u,-h}z3e;  % diagonal
pickup tiny.nib; pos1(stem,0); pos2(stem,0);
top y1=h+min(oo,serif_drop); bot y2=0; x1=x2=x3;
z=((z4{down}...{-36u,-h}z3)intersectionpoint((x2r,0)--(x2r,h)));
filldraw z1l--z2l...(x3,y2l)...z--z1r--cycle;  % stem
if serifs: sloped_serif.l(1,2,a,1/3,jut,serif_drop); fi % upper left serif
math_fit(0,ic#-1/3x_height#*slant-.5u#); penlabels(1,2,3,4); endchar;

cmchar "Lowercase Greek xi";
beginchar(oct"030",9u#,asc_height#,desc_depth#);
italcorr .75[x_height#,asc_height#]*slant-2u#;
adjust_fit(0,0); pickup fine.nib;
if serifs: 
  pos10(hair,-720); pos12(hair,-540); pos2(hair,-180); pos8(vair,-135);
  top y13l=bot y11l+vstem+eps=vround(y10-.25(h-x_height));
  top y3l=vround .5h=bot y1l+vstem+eps;
  lft x10l=hround 1/3w; 
  x11=x13=.5[x10,x12]; 
else:
  pos10(vair,-720); pos8(vair,-125);
  pos12(vair,-630); pos12'(vair,-450);
  pos2(vair,-270); pos2'(vair,-90);
  z12'=z12; z2 = z2';
  top y13l=top y11r=(y10-.33(h-x_height));
  top y3l=vround .5h;
  y3 = y1;
  lft x10l=hround 1/4w; 
  x11=x13=.8[x10,x12]; 
fi
pos11(vair,-630); pos13(vair,-450);
rt x12l=hround(w-2.5u);
top y10=h; 
y12=.5[y11,y13]; 
if serifs: if y11r>y13r: y11r:=y13r:=y12; fi fi
pos0(curve,-360); pos1(vair,-270); pos3(vair,-90);
numeric theta; theta=90-angle(22u,x_height); slope:=-x_height/22u;
pos6(stem,theta); pos7(vair,-90);
lft x0l=hround u; x1=x3=x11; x2=x12;
y0=.5[y13,y1];  y2=.5[y1,y3];
if serifs: if y1r>y3r: y1r:=y3r:=y2; fi fi
lft x4l=hround u; x4r-x4l=hround .5[vair,stem]-fine;
x6=x7=w-2u; x8=.5w+.5u; y6=-.3d; bot y7r=-d-oo; y8=max(-3/4d-oo,y7l);
ellipse_set(3l,4l,5l,6l); ellipse_set(3r,4r,5r,6r);
y4l:=.9[y6,y4l]; y4=y4r:=.9[y6,y4r];
if serifs:
  filldraw circ_stroke z10e{down}...z11e{right}...{up}z12e;  
  % opening hook
  filldraw stroke z12e{up}...z13e{left}...z0e{down}
   ...z1e{right}...{up}z2e;  % upper arc
  filldraw circ_stroke z8e{x7-x8,2(y7-y8)}...z7e{right}...z6e
   ---z5e...{up}z4e...{right}z3e...{down}z2e;  % main stroke
else:
  filldraw stroke z10e{down}...z11e{right}---z12e;  
  % opening hook
  filldraw stroke z12'e---z13e{left}...z0e{down}
   ...z1e---z2e;  % upper arc
  filldraw stroke z8e{x7-x8,2(y7-y8)}...z7e{right}...z6e
   ---z5e...{up}z4e...z3e---z2'e;  % main stroke
fi
math_fit(-.2asc_height#*slant-.5u#,0);
penlabels(0,1,2,3,4,5,6,7,8,10,11,12,13); endchar;

cmchar "Lowercase Greek pi";
beginchar(oct"031",10u#,x_height#,0);
italcorr x_height#*slant+.5stem#-u#;
adjust_fit(0,0); pi_stroke; % hook and bar
pos4(if hefty: vair else: hair fi,0); 
pos6(if hefty: vair else: hair fi,0); 
x4=3.5u; x6=w-4u; y4=y6=y2;
x5=3u; x7=w-2.5u; 
y5=y7=.5stem-oo;
pair v[]; v1=(z4-z5) xscaled 3.14159; v2=(z6-z7) xscaled 3.14159;
pos5(if hefty: vair else: hair fi,angle v1-90);
pos7(if hefty: vair else: hair fi,angle v2-90);
if serifs: 
 filldraw circ_stroke z5e{v1}...{up}z4e;  % left stem
 filldraw circ_stroke z7e{v2}...{up}z6e;  % right stem
else:
 z8l = z5l + whatever*v1;
 z8r = z5r + whatever*v1;
 z9 = z7 + whatever*v2;
 pos9(if hefty: vair else: stem fi,angle v2-90);
 y8r = y8l = 0; y9l = -oo;
 filldraw stroke z8e{v1}...{up}z4e;  % left stem
 filldraw stroke z9e{v2}...{up}z6e;  % right stem
fi
math_fit(-.7x_height#*slant+.5hair#+.5u#,ic#-1/3x_height#*slant);
penlabels(1,2,3,4,5,6,7,8,9); endchar;

cmchar "Lowercase Greek rho";
beginchar(oct"032",8.25u#,x_height#,desc_depth#);
italcorr .7x_height#*slant+.5curve#-u# if math_fitting:-.5u# fi;
adjust_fit(0,0); pickup fine.nib;
pos1(stem,180); pos2(stem,180); pos3(vair,90);
pos4(if hefty: 0.7[vair,curve] else: curve fi,0); pos5(vair,-90); pos6(if hefty: vair else: hair fi,-180);
lft x2r=hround(1.5u-.5stem); x1=x2; x2l=x6l; x3=x5=.5[x2,x4];
rt x4r=hround(w-1.5u+.5curve);
if serifs: y1-.5stem=-d-o;
else: y1=-d; fi
y2=y4=y6=.5[y3,y5]; top y3r=h+oo; bot y5r=-oo;
filldraw sans_circ_stroke z1e..pulled_arc.e(2,3) & pulled_arc.e(3,4)
 & pulled_arc.e(4,5) & pulled_arc.e(5,6);  % stem and bowl
math_fit(desc_depth#*slant+.5stem#-u#,ic#);
penlabels(1,2,3,4,5,6); endchar;

cmchar "Lowercase Greek sigma";
beginchar(oct"033",10.25u#,x_height#,0);
italcorr x_height#*slant+.5stem#-u#;
adjust_fit(0,0); pickup fine.nib;
pos1(vstem,90);
pos2(stem,0); 
pos3(if hefty: 0.9 fi vair,-90);
pos4(stem,-180); pos5(vstem,-270); pos6(vstem,-270);
x1=x3=x5=.5[x2,x4]; rt x2r=hround(w-2.5u);
lft x4r=hround(1.5u-.5curve);
if serifs: x6=w-1.5u; else: x6=w-1.2u; fi
top y6r=h; y2=y4=.5[y1,y3]; bot y3r=-oo; y5l=y6l=y1l;
filldraw sans_circ_stroke z6e..pulled_arc.e(5,4) & pulled_arc.e(4,3)
 & pulled_arc.e(3,2) & pulled_arc.e(2,1);  % ear and bowl
math_fit(-.3x_height#*slant+.5curve#-u#,ic#-1/3x_height#*slant);
penlabels(1,2,3,4,5,6); endchar;

cmchar "Lowercase Greek tau";
beginchar(oct"034",9u#,x_height#,0);
italcorr x_height#*slant+.5stem#-u#;
adjust_fit(0,0); pi_stroke; % hook and bar
pos4(if hefty: vair else: hair fi,0); pos5(stem,0);
x4=x5; x5-.5stem=hround(.5w-.5u-.5stem); y4=y2; 
if serifs: y5-.5stem=-oo; else: y5=0; fi
filldraw sans_circ_stroke z5e--z4e;  % stem
math_fit(-.7x_height#*slant+.5hair#+.5u#,-.5u#);
penlabels(1,2,3,4,5); endchar;

cmchar "Lowercase Greek upsilon";
beginchar(oct"035",9u#,x_height#,0);
italcorr x_height#*slant;
adjust_fit(0,0); pickup fine.nib; interim superness:=more_super;
x0=0; x2=x3+.25u; pos3(stem,-180); lft x3r=hround(2.5u-.5stem);
hook_in(0,1,2)(skewed);  % opening hook
pos2'(if hefty: vair else: stem fi,-180); z2'=z2; pos4(vair,-90); pos5(hair,0);
x4=.5w+u; rt x5r=hround(w-.5u); y3=.7[y4,y5]; bot y4r=-oo; y5=.57h;
filldraw stroke z2'e{-u,-x_height}...super_arc.e(3,4)
 ..tension atleast 1.05..{up}z5e; % left stem and arc
v_bulb(5,6);  % closing bulb
math_fit(-2/3x_height#*slant+.5hair#+.5u#,2/3ic#);
penlabels(0,1,2,3,4,5,6); endchar;

cmchar "Lowercase Greek phi";
beginchar(oct"036",11u#,asc_height#,desc_depth#);
italcorr .7x_height#*slant+.5curve#-u# if math_fitting:-.5u# fi;
adjust_fit(0,0); pickup fine.nib;
numeric light_curve; light_curve=hround(.5[stem,curve]-2stem_corr);
pos1(vair,90); pos2(light_curve,180); pos3(vair,270); pos4(light_curve,360);
x1=x3=.5w; lft x2r=hround(1.5u-.5light_curve); x4=w-x2;
top y1r=x_height+oo; y2=y4=.5[y1,y3]; bot y3r=-oo;
filldraw stroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & pulled_arc.e(3,4) & pulled_arc.e(4,1); % bowl
pos5(hair,0); pos6(hair,0); x5=x6=.5w; top y5=h; bot y6=-d-oo;
filldraw stroke z5e--z6e;  % stem
math_fit(-.3x_height#*slant+.5curve#-u#,ic#);
penlabels(1,2,3,4,5,6); endchar;

cmchar "Lowercase Greek chi";
beginchar(oct"037",11u#,x_height#,desc_depth#);
italcorr x_height#*slant+.5hair#-1.5u#;
adjust_fit(0,0); pickup fine.nib;
if hefty: pos1(vair,180);  pos6(vair,180);
else: pos1(hair,180);  pos6(hair,180); fi
pos2(vair,80); pos5(vair,80);
x1-.5hair=hround-.5hair; x6=w-x1; x2=w-x5=u;
y1=y2l-h/8; top y2r=h+oo; bot y5l=-d-oo; y6=y5r+h/8;
z0=.5[z2,z5]; z2'=z2l+(.5u,0); z5'=z5r-(.5u,0);
numeric theta; theta=angle(z5'-z2')+90;
pos3(if hefty: stem' else: stem fi,theta); 
pos4(if hefty: stem' else: stem fi,theta);
y3r=y2r-h/8; y4l=y5l+h/8; z3l=whatever[z2',z0]; z4r=whatever[z0,z5'];
filldraw stroke z1e{up}...z2e{right}...z3e{z4r-z3l}
 ..z4e{z4r-z3l}...{right}z5e...{up}z6e;  % major diagonal and hooks
if serifs: 
  x8=w-x7=2u; y7+.5hair=h; y8-.5hair=-d;
  numeric theta; theta=angle(z7-z8)-90;
  pos7(hair,theta); pos8(hair,theta);
  filldraw z7l---z8l..z8r---z7r..cycle;  % minor diagonal
else: 
  x8=w-x7=2u; y7=h; y8=-d; 
  numeric theta; theta=angle(z7-z8)-90;
  pos7(hair/cosd(theta),0); pos8(hair/cosd(theta),0);
  filldraw stroke z7e--z8e;
fi
math_fit((desc_depth#-x_height#)*slant+ic#,ic#);
penlabels(0,1,2,2',3,4,5',5,6,7,8); endchar;

cmchar "Lowercase Greek psi";
beginchar(oct"040",11u#,asc_height#,desc_depth#);
italcorr x_height#*slant;
adjust_fit(0,0); pickup fine.nib; interim superness:=more_super;
x0=0; x2=x3+.25u; pos3(stem,-180); lft x3r=hround(2.5u-.5stem);
hook_in(0,1,2)(skewed);  % opening hook
pos2'(if hefty: vair else: stem fi,-180); z2'=z2; pos4(vair,-90); pos5(hair,0);
x4=.5w+u; rt x5r=hround(w-.5u);
y3=.7[y4,y5]; bot y4r=-oo; y5=.57x_height;
filldraw stroke z2'e{-u,-x_height}...super_arc.e(3,4)
 ..tension atleast 1.05..{up}z5e; % left stem and arc
v_bulb(5,6);  % closing bulb
pos7(hair,0); pos8(hair,0); x7=x8=.5w+.5u; top y7=h; bot y8=-d-oo;
filldraw stroke z7e--z8e;  % stem
math_fit(-2/3x_height#*slant+.5hair#+.5u#,2/3ic#);
penlabels(0,1,2,3,4,5,6,7,8); endchar;

cmchar "Lowercase Greek omega";
beginchar(oct"041",11u#,x_height#,0);
italcorr x_height#*slant;
adjust_fit(0,0); pickup fine.nib;
pos2(hair,-180); lft x2r=hround.5u; y2=y4=y6=y8=bar_height;
if serifs: 
  y1+.5hair=h; 
  x1=x2+.75u; pos1(hair+dw,angle(2(x1-x2),y1-y2)+90);
  pos4(hair,0); pos5(vair,90); pos6(hair,180); 
  rt x4r-lft x6r=min(stem,2hair)+2eps;
  top y5r=vround(.2[y4,h]+.5vair);
else: 
  y1r = h; 
  x1=x2+.75u+hair/4; pos1(hair+dw,angle(2(x1-x2),y1r-y2r)+90);
  pos4(vair,0); pos5(vair,0); pos6(vair,180); pos5'(vair,180);
  z4 = z6; z5=z5';
  top y5r=y4+0.7u;
fi
pos3(vstem+dw,-90); pos7(vstem+dw,270); pos8(hair,360);
bot y3r=bot y7r=-oo; 
x3=.5[x2,x4]; x7-.25u=.5[x6,x8]; rt x8r=hround(w-.5u);
x5+.5stem=hround(.5w+.5stem)+eps;
x5=.5[x4,x6];
if serifs: if x4l<x6l: x4l:=x6l:=x5; fi fi
if serifs:
 filldraw scirc_stroke z1e{2(x2-x1),y2-y1}...z2e{down}...z3e{right}
  ...{up}z4e...{left}z5e;  % left arc
 filldraw stroke z5e{left}...z6e{down}...z7e{right}...{up}z8e;  % right arc
 v_bulb(8,9);  % closing bulb
else:
 filldraw stroke z1e{2(x2-x1),y2-y1}...z2e{down}...z3e{right}
  ...z4e---z5e;  % left arc
 filldraw stroke z5'e---z6e...z7e{right}...{up}z8e;  % right arc
  y9r=x_height; x9+.5curve=w-u-hair/4;
  pos9(curve,15); filldraw stroke z8e{up}..z9e; 
fi
math_fit(-bar_height#*slant,2/3ic#); penlabels(1,2,3,4,5,6,7,8,9); endchar;

cmchar "Variant lowercase Greek epsilon";
beginchar(oct"042",8u#,x_height#,0);
italcorr x_height#*slant-.5u#;
adjust_fit(0,0); pickup fine.nib;
numeric light_vstem; light_vstem=Vround 2/3[vair,vstem];
if serifs:
  x1+.5light_vstem=hround(w-u); 
  x9+.5vair=hround(w-.5u); 
  pos5(hair,360); 
  top y6r-bot y4r=vstem+eps; if y6l<y4l: y6l:=y4l:=y5; fi
else:
  x1+.25light_vstem=hround(w-u); 
  x9+.25vair=hround(w-.5u); 
  pos5(vair,270); pos5'(vair,450); z5=z5';
  y6=y4;  
fi
pos2(light_vstem,90); x2=x8=.5w+.5u; top y2r=h+o;
y1=.2[y2,bar_height];
pos1(light_vstem,angle(x1-x2,2(y1-y2))+90); pos3(hair,180); pos4(vair,270);
pos6(vair,450); pos7(hair,540); pos8(light_vstem,630);
lft x3r=hround u; 
rt x5r=hround(w-2.5u); x7=x3;
if serifs: x4=x6=.5w; else: x4=x6=x5-.5u; fi
y3=.5[y2,y4]; y5=bar_height=.5[y4,y6]; y7=.5[y6,y8]; bot y8r=-o;
y9=1/3[y8,bar_height];
pos9(vair,angle(x8-x9,2(y8-y9))+90);
if serifs:
	filldraw circ_stroke z1e{x2-x1,2(y2-y1)}...pulled_super_arc.e(2,3)(.5superpull)
	 & super_arc.e(3,4)...{up}z5e;  % upper arc
	filldraw circ_stroke z9e{x8-x9,8(y8-y9)}...pulled_arc.e(8,7)
	 & super_arc.e(7,6)...{down}z5e;  % lower arc
else:
	filldraw stroke z1e{x2-x1,2(y2-y1)}...pulled_super_arc.e(2,3)(.5superpull)
	 & super_arc.e(3,4)---z5e;  % upper arc
	filldraw stroke z9e{x8-x9,8(y8-y9)}...pulled_arc.e(8,7)
	 & super_arc.e(7,6)---z5'e;  % lower arc
fi
math_fit(-.5bar_height#*slant-.5u#,ic#);
penlabels(1,2,3,4,5,6,7,8,9); endchar;

cmchar "Variant lowercase Greek theta";
beginchar(oct"043",9u#,asc_height#,0);
italcorr .5[bar_height#,x_height#]*slant+.5vair#+.5u#;
adjust_fit(0,0); pickup fine.nib;
numeric light_curve; light_curve=hround .5[stem,curve];
x0=0; x2-.5stem=hround(2.5u-.5stem); hook_in(0,1,2);  % opening hook
pos2'(if hefty: vair else: stem fi,-180); z2'=z2; pos3(stem,-180); pos4(vair,-90);
pos5(light_curve,0); pos6(vair,90); pos7(hair,180); pos8(vair,270);
x3=x2; x4=x6=.5[x3,x5]; rt x5r=hround(w-1.5u+.5light_curve);
lft x7r=hround(3.25u-.5hair); x8+.5vair=hround(w+.5vair-epsilon);
y3=.4x_height; bot y4r=-oo; y5=.5[y4,y6]; top y6r=h+oo;
y7=.5[x_height,h]; y8=.5[bar_height,x_height];
filldraw stroke z2'e..{{interim superness:=hein_super; super_arc.e(3,4)}}
 & pulled_arc.e(4,5) & pulled_arc.e(5,6)
 ...{down}z7e...{4(x8-x7),y8-y7}z8e;  % bowl and loop
math_fit(-2/3x_height#*slant+.5hair#+.5u#,ic#);
penlabels(0,a,1,2,3,4,5,6,7,8); endchar;

cmchar "Variant lowercase Greek pi";
beginchar(oct"044",14.5u#,x_height#,0);
italcorr x_height#*slant+.5stem#-u#;
adjust_fit(0,0); pi_stroke; % hook and bar
pos4(hair,-180); pos5(hair,-180); pos6(vstem,-90);
pos7(hair,0); pos7'(hair,-180); z7'=z7;
pos8(vstem,-90); pos9(hair,0); pos0(hair,0);
x4=x5+1.5u; lft x5r=hround 2u; x6=x4+.5u; lft x7l=hround(.5w+.25u-.5hair);
x8=w-4.5u; rt x9r=hround(w-1.5u); x0=x9-1.25u;
top y4=top y0=h; y5+.1h=y7-.1h=y9=bar_height; bot y6r=bot y8r=-oo;
filldraw stroke z4e{2(x5-x4),y5-y4}...z5e{down}
 ...z6e{right}...z7e{up};  % left bowl
filldraw stroke z0e{2(x9-x0),y9-y0}...z9e{down}
 ...z8e{left}...z7'e{up};  % right bowl
math_fit(-.7x_height#*slant+.5hair#+.5u#,ic#-.5u#);
penlabels(0,1,2,3,4,5,6,7,8,9); endchar;

cmchar "Variant lowercase Greek rho";
beginchar(oct"045",8.25u#,x_height#,desc_depth#);
italcorr .7x_height#*slant+.5curve#-u# if math_fitting:-.5u# fi;
adjust_fit(0,0); pickup fine.nib;
pos2(stem,180); pos3(vair,90); pos4(curve,0); pos5(vair,-90); pos6(stem,-180);
lft x2r=hround(1.5u-.5stem); x2=x6; x3=x5=.5[x2,x4];
rt x4r=hround(w-1.5u+.5curve);
y2=y4=y6=.5[y3,y5]; top y3r=h+oo; bot y5r=-oo;
filldraw circ_stroke pulled_arc.e(2,3) & pulled_arc.e(3,4)
 & pulled_arc.e(4,5) & pulled_arc.e(5,6);  % bowl
pos2'(hair,-180); z2'r=z2r; pos1(vstem,-90); pos1'(vstem,90); z1'=z1;
pos0(hair,0); rt x0r=hround(w-u); bot y0=-d; bot y1r=vround-.9d; x1=x5;
interim superness:=sqrt superness;
filldraw stroke pulled_arc.e(0,1'); filldraw stroke pulled_arc.e(1,2'); % tail
math_fit(desc_depth#*slant+.5stem#-u#,ic#);
penlabels(0,1,2,3,4,5,6); endchar;

cmchar "Variant lowercase Greek sigma";
beginchar(oct"046",8u#,x_height#,.5min(desc_depth#,.5x_height#));
italcorr x_height#*slant-.5u#;
adjust_fit(0,0); pickup fine.nib;
numeric heavy_vair; heavy_vair=.25[vair,vstem];
if serifs:
	pos1(heavy_vair,-110);  pos8(vair,-135);
	x1+.5heavy_vair=hround(w-u); 
	x8=.5w+u; 
else:
	pos1(heavy_vair,-125);  pos8(vair,-110);
	x1+.3heavy_vair=hround(w-u); 
	x8=.5w+.7u; 
fi
pos2(vair,-90);
y1=.1[y2r,bar_height];
x2=min(.5w+u,x1r-eps); top y2l=h+oo;
filldraw sans_circ_stroke z1e{x2-x1,2(y2-y1)}...{left}z2e;  % upper bulb
numeric theta; theta=90-angle(16u,x_height); slope:=-x_height/16u;
pos6(stem,theta); pos7(vair,-90);
lft x4l=hround u; x4r-x4l=(hround .5[vair,stem])-fine;
x6=x7=w-2u; y6=.25[y8,y2]; y8=y7+1/8d; bot y7r=-d-oo;
ellipse_set(2l,4l,5l,6l); ellipse_set(2r,4r,5r,6r); y4=y4r;
filldraw sans_circ_stroke z8e{x7-x8,2(y7-y8)}...z7e{right}...z6e
 ---z5e...{up}z4e...{right}z2e;  % main stroke
math_fit(-.5x_height#*slant-.5u#,0); penlabels(1,2,4,5,6,7,8); endchar;

cmchar "Variant lowercase Greek phi";
beginchar(oct"047",11u#,x_height#,desc_depth#);
italcorr .7x_height#*slant;
adjust_fit(0,0); pickup fine.nib;
pos1(if hefty: vair else: hair fi,-180); x1=x2+.75u; top y1=h;
pos2(if hefty: vair else: hair fi,-180);
lft x2r=hround .5u; y2=bar_height;
pos3(if hefty: vair else: vstem fi,-90); x3=.5(w+u); bot y3r=-oo;
pos4(if hefty: vair else: hair fi,0); rt x4r=hround(w-.5u); y4=y2;
pos5(vstem,90); x5=.52[x6,x4]; top y5r=h+oo;
pos6(hair,180); x6=x7; y6=1/3h;
pos7(stem,180); lft x7r=hround(.5w-.5u-.5stem); 
if serifs: y7-.5stem=-d-o; else: y7=-d; fi
filldraw sans_circ_stroke z7e---z6e...{right}z5e...{down}z4e...{left}z3e
 ...{up}z2e...{3(x1-x2),y1-y2}z1e;  % bowl and stem
math_fit(-.3x_height#*slant,ic#); penlabels(1,2,3,4,5,6,7); endchar;