cmchar "The cyrillic letter A";
beginchar(CYR_A,13u#,cap_height#,0);
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric left_stem,right_stem,outer_jut,alpha;
right_stem=cap_stem-stem_corr;
left_stem=min(cap_hair if hefty: -3stem_corr fi,right_stem);
outer_jut=.8cap_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=cap_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+cap_jut+.5u+1<=lft x4'l-cap_jut: inner_jut=cap_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 "The cyrillic letter BE";
beginchar(CYR_BE,12.5u#,cap_height#,0);
italcorr .75cap_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,0);
numeric left_stem,right_curve;
left_stem=cap_stem-hround 2stem_corr; 
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
penpos5(cap_band,90); penpos6(cap_band,90); penpos7(right_curve,0);
penpos8(cap_band,-90); penpos9(cap_band,-90);
z9r=bot z2; y8=y9; y7=.5[y8,y6]; y5=y6=.52h;
x8=x6; x5=x1; x6l:=x6-.25u; x7r=hround(w-u); x8l:=x8l-.5u;
if serifs: right_curve=cap_curve-stem_corr; x6=.5[x1,w-1.8u];
else: right_curve=cap_curve-3stem_corr; x6=.5[x1,w-1.5u];
x6l:=x6l-.5u; fi
fill stroke z5e..super_arc.e(6,7) & super_arc.e(7,8)..z9e;  % lower lobe
pickup crisp.nib; pos3(slab,90); pos4(hair,0);
top y3r=h; x3=x1; rt x4r=hround(w-2u); y4=good.y(y3l-.8beak)-eps;
arm(3,4,e,beak_darkness,.9beak_jut);  % upper arm and beak
if serifs: nodish_serif(1,2,a,1/3,cap_jut,b,1/3,.5cap_jut);  % upper serif
nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi  % lower serif
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6,7,8,9); endchar;

cmchar "The cyrillic letter VE";
beginchar(CYR_VE,12.5u#,cap_height#,0);
italcorr .75cap_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,0);
numeric left_stem,right_curve,middle_weight;
left_stem=cap_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(cap_band,90); penpos4(cap_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(cap_band,-90); penpos12(cap_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=cap_curve-stem_corr; x4=.5[x1,w-1.5u];
else: right_curve=cap_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,cap_jut,b,1/3,.5cap_jut);  % upper serif
 nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi  % lower serif
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6,7,8,9,10,11,12); endchar;

cmchar "The cyrillic letter GHE";
beginchar(CYR_GHE,11.5u#-width_adj#,cap_height#,0);
italcorr cap_height#*slant-beak_jut#-.25u#;
adjust_fit(cap_serif_fit#,0);
h:=vround(h-stem_corr);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5cap_stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
pickup crisp.nib; pos3(slab,90); pos4(hair,0);
top y3r=h; x3=x1; rt x4r=hround(w-.75u); y4=good.y(y3l-beak)-eps;
arm(3,4,e,beak_darkness,beak_jut);  % upper arm and beak
if serifs: nodish_serif(1,2,a,1/3,cap_jut,b,1/3,.5cap_jut);  % upper serif
 dish_serif(2,1,c,1/3,cap_jut,d,1/3,1.25cap_jut); fi % lower serif
math_fit(0,ic#-2.5u#); penlabels(1,2,3,4); endchar;

cmchar "The cyrillic letter DE";
beginchar(CYR_DE,13u#,cap_height#,comma_depth#);
italcorr cap_height#*slant-cap_serif_fit#
 +.75cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(0,cap_serif_fit#);
pickup tiny.nib; numeric thin_stem;
thin_stem=if monospace: cap_stem-tiny
 else: min(cap_hair,cap_stem-1.5tiny) fi;
if serifs: penpos1(thin_stem,0); penpos2(thin_stem,0); 
penpos0(thin_stem,0); x2=.5[hround .5u,x1];
else: penpos1(thin_stem,0); penpos2(thin_stem,0); 
penpos0(thin_stem,0); x2=.5u+cap_stem; fi 
pos3(cap_stem,0); pos4(cap_stem,0);
x1l=x0l=.33w; top y1=h; y0=.75h; bot y2=0;
rt x3r=rt x4r=hround(w-2u); top y3=h; bot y4=0;
filldraw stroke z3e--z4e;
filldraw stroke z1e--z0e{down}..z2e;  % stem and arc
if serifs: pickup crisp.nib; numeric inner_jut, newbracket;
 newbracket:=max(1.5,bracket); inner_jut:=.5(x3l-x1r);
 path p[]; p1=z1{down}...z2; 
 p12=(0,y1-newbracket)--(w,y1-newbracket);
 p21=(0,y2+newbracket)--(w,y2+newbracket);
 z12=p1 intersectionpoint p12; z21=p1 intersectionpoint p21; 
 nodish_serif(1,12,a,1/3,cap_jut,b,1/3,inner_jut);  % upper left serif
 nodish_serif(3,4,c,1/3,inner_jut,d,1/3,cap_jut);  % upper right serif
 inner_jut:=.5(x4l-x2r);
 nodish_serif(2,21,e,1/3,cap_jut,f,1/3,inner_jut);  % middle left serif
 nodish_serif(4,3,g,1/3,inner_jut,h,1/3,cap_jut);  % middle right serif
 pickup crisp.nib; 
 pos5(slab,90); pos6(cap_hair,180); pos7(cap_hair,0);
 x5=.5[x2,x4]; bot y5l=0; 
 rt x7r=tiny.rt x4r+cap_jut; lft x6r=tiny.lft x2l-cap_jut;
 y6=y7=good.y(y5l-.5beak)-eps;
 arm(5,6,m,1.25beak_darkness,0);  % left beak
 arm(5,7,n,1.25beak_darkness,0);  % right beak
else:
 pos1'(slab,90); pos3'(slab,90);
 pos6(slab,90); pos7(slab,90);
 pos6'(stem,0); pos7'(stem,0);
 pos8(stem,0); pos9(stem,0);
 lft x1'=lft x1l; rt x3'=rt x3r; top y1'r=top y3'r=h;
 lft x6=lft x6'l=lft x8l=.5u; rt x7=rt x7'r=rt x9r=w-.5u; 
 bot y6l=bot y7l=0; y6'=y7'=y6; bot y8=bot y9=-.8d;
 filldraw stroke z1'e--z3'e;  % upper bar
 filldraw stroke z6e--z7e;  % lower bar
 filldraw stroke z6'e--z8e;  % left beak
 filldraw stroke z7'e--z9e;  % right beak
fi  
math_fit(0,.5ic#-.5u#);
penlabels(0,1,1',2,3,3',4,5,6,7,8,9,12,21); endchar;

cmchar "The cyrillic letter IE";
beginchar(CYR_IE,12u#-width_adj#,cap_height#,0);
italcorr cap_height#*slant-beak_jut#-.5u#;
adjust_fit(cap_serif_fit#,0);
h:=vround(h-stem_corr);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5cap_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-beak)-eps;
arm(3,4,e,beak_darkness,beak_jut);  % upper arm and beak
pos5(cap_bar,-90); pos6(hair,0);
top y5l=vround(.52[y2,y1]+.5cap_bar); x5=x1;
pos0(cap_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+.6beak)+eps;
 rt x9r=hround(w-.5u);
else: rt x6r=hround(w-1.5u); y6=y5l+eps; rt x9r=hround(w-.75u); fi
arm(5,6,f,beak_darkness,0); arm(0,7,g,beak_darkness,0);  % middle arm and serif
pos8(slab if not serifs:+2stem_corr fi,-90); pos9(hair,0);
bot y8r=0; x8=x2; y9=good.y(y8l+7/6beak)+eps;
arm(8,9,h,beak_darkness,1.5beak_jut);  % lower arm and beak
if serifs: nodish_serif(1,2,a,1/3,cap_jut,b,1/3,.5cap_jut);  % upper serif
 nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi  % lower serif
math_fit(0,.5ic#); penlabels(0,1,2,3,4,5,6,7,8,9); endchar;

cmchar "The cyrillic letter YE";
numeric dot_diam#,dot_diam;
dot_diam#=max(dot_size#,cap_curve#);
beginchar(CYR_YE,12u#-width_adj#,1.3cap_height#,0);
dot_diam=max(tiny.breadth,hround(max(dot_size,cap_curve)-2stem_corr));
italcorr cap_height#*slant-beak_jut#-.5u#;
adjust_fit(cap_serif_fit#,0);
numeric letter_h; letter_h=cap_height;
letter_h:=vround(letter_h-stem_corr);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5cap_stem); top y1=letter_h; bot y2=0;
filldraw stroke z1e--z2e; % stem
pickup crisp.nib; pos3(slab,90); pos4(hair,0);
top y3r=letter_h; x3=x1; rt x4r=hround(w-u); y4=good.y(y3l-beak)-eps;
arm(3,4,e,beak_darkness,beak_jut);  % upper arm and beak
pos5(cap_bar,-90); pos6(hair,0);
top y5l=vround(.52[y2,y1]+.5cap_bar); x5=x1;
pos0(cap_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+.6beak)+eps;
 rt x9r=hround(w-.5u);
else: rt x6r=hround(w-1.5u); y6=y5l+eps; rt x9r=hround(w-.75u); fi
arm(5,6,f,beak_darkness,0); arm(0,7,g,beak_darkness,0);  % middle arm and serif
pos8(slab if not serifs:+2stem_corr fi,-90); pos9(hair,0);
bot y8r=0; x8=x2; y9=good.y(y8l+7/6beak)+eps;
arm(8,9,h,beak_darkness,1.5beak_jut);  % lower arm and beak
if serifs: nodish_serif(1,2,a,1/3,cap_jut,b,1/3,.5cap_jut);  % upper serif
 nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi  % lower serif
pos10(dot_diam,0); pos11(dot_diam,90);
x10=x11=3.5u; top y11r=h+1;
if bot y11l<letter_h+o+slab: y11l:=min(y11r-eps,letter_h+o+slab+.5tiny); fi
y10=.5[y11l,y11r]; dot(10,11);  % left dot
pos12(dot_diam,0); penpos13(y11r-y11l,90); y12=y13=y10; x12=x13=w-x10;
dot(12,13);  % right dot
math_fit(0,.5ic#); 
penlabels(0,1,2,3,4,5,6,7,8,9,10,11,12,13); endchar;

cmchar "The cyrillic letter ZHE";
beginchar(CYR_ZHE,21u#,cap_height#,0);
italcorr cap_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric right_jut,stem[],alpha[];
if serifs: right_jut=.6cap_jut;
else: right_jut=.4tiny; fi
pickup tiny.nib; pos1(fudged.cap_stem,0); pos2(fudged.cap_stem,0);
x1=x2=.5w; top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
stem2=max(tiny.breadth,fudged.cap_stem-3stem_corr);
stem1=max(tiny.breadth,fudged.hair if hefty:-3stem_corr fi);
rt x3r=w-lft x7l=hround(r-letter_fit-u-right_jut);
rt x6r=w-lft x9l=hround(r-letter_fit-.75u-right_jut);
top y3=top y7=h; bot y6=bot y9=0; x4=x4'=x1; y4=y4'=1/3h;
alpha1=diag_ratio(1,.5(stem1-tiny),y3-y4,x3r-x4);
penpos3(alpha1*(stem1-tiny),0); penpos4(whatever,-90);
penpos7(alpha1*(stem1-tiny),0);
alpha2=diag_ratio(1,.5(stem2-tiny),y1-y6,x6r-x1);
penpos6(alpha2*(stem2-tiny),0); penpos9(alpha2*(stem2-tiny),0);
forsuffixes $=l,r: y3'$=y7'$=h; y6'$=y9'$=0;
 z4$=z3'$+whatever*(z3-z4);
 z5$=z6'$+whatever*(z1-z6)=whatever[z3,z4];
 x8$=w-x5$; y8$=y5$; endfor
z5=.5[z5l,z5r]; z8=.5[z8l,z8r];
z3'r=z3r+penoffset z3-z4 of currentpen+whatever*(z3-z4);
z6'r=z6r+penoffset z1-z6 of currentpen+whatever*(z1-z6);
z6'l=z6l+penoffset z6-z1 of currentpen+whatever*(z1-z6);
x7'r=w-x3'r; x7'l=w-x3'l; x9'r=w-x6'r; x9'l=w-x6'l;
fill z4r--diag_end(4r,3'r,1,.5,3'l,4l)--z4l--cycle;  % right upper diagonal
fill z4r--diag_end(4r,7'r,1,.5,7'l,4l)--z4l--cycle;  % left upper diagonal
fill z5l--diag_end(5l,6'l,.5,1,6'r,5r)--z5r--cycle;  % right lower diagonal
fill z8l--diag_end(8l,9'l,.5,1,9'r,8r)--z8r--cycle;  % left lower diagonal
if serifs: numeric inner_jut;
 if rt x2r+cap_jut+.5u+1<=lft x6l-cap_jut: inner_jut=cap_jut;
 else: rt x2r+cap_jut+.5u+1=lft x6l-inner_jut; fi
 dish_serif(1,2,a,1/3,cap_jut,b,1/3,cap_jut); % upper stem serif
 dish_serif(2,1,c,1/3,cap_jut,d,1/3,cap_jut);  % lower stem serif
 dish_serif(3,4,e,2/3,1.2cap_jut,f,1/2,right_jut)(dark); % upper diagonal serif
 dish_serif(6,5,g,1/2,inner_jut,h,1/3,right_jut)(dark); % lower diagonal serif
 dish_serif(7,4,i,1/2,right_jut,j,2/3,1.2cap_jut)(dark); % upper diagonal seri
 dish_serif(9,8,k,1/3,right_jut,l,1/2,inner_jut)(dark);fi % lower diagonal seri
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6,7,8,9); endchar;

cmchar "The cyrillic letter ZE";
beginchar(CYR_ZE,11u#,cap_height#,0);
italcorr cap_height#*slant-.5u#;
adjust_fit(0,0);pickup fine.nib;
if serifs: pos1(cap_hair,180); pos2(cap_band,90);
 pos3(max(fine.breadth,cap_curve-stem_corr),0); pos4(vair',270);
 lft x1r=1.5u; top y2r=h+o;
 bot y1=min(vround .7h,bot y2l-eps); rt x3r=hround(w-u);
 pos7(cap_bar,-90); pos8(cap_bar,-90);
 pos9(max(fine.breadth,vround 2/3cap_bar),90); pos10(cap_curve,0);
 x9=.5w-.75u; x2=x4=.5w; bot y4r=-o; 
 rt x10r=w-.5u; lft x8=min(hround 5u,lft x9)-eps;
 y3=.5[top y7l,bot y2l]; y10=.5[bot y9l,top y4l];
 top y8l=vround(.54h+.5vair); y8r=y9l;
 x7=1/3[x8,x3l]; z7=z8+whatever*(150u,h);
 pos5(cap_hair,180); lft x5r=hround(u);
 y5=max(good.y(.6bar_height),y4l+vair');
 (x,y4l)=whatever[z4r,z5l]; x4l:=max(x,x4l-.5u);
 interim superness:=more_super;
 filldraw stroke z1e{up}
  ... pulled_super_arc.e(2,3)(.5superpull)
  & z3e{down}...z7e---z8e;  % upper bowl
% filldraw z8r--z9l--z9r--z8l---cycle;  % middle tip
 filldraw stroke pulled_super_arc.e(9,10)(.5superpull)
  & pulled_super_arc.e(10,4)(.5superpull)
  ..z5e;  % arc and lower terminal
 pos6(.3[fine.breadth,cap_hair],180); x6r=x1r; top y6=h+o;
 x1'-x1r=1.5cap_curve-fine; y1'=y1;
 path upper_arc; upper_arc=z1{x1-x2,10(y2-y1)}..z2{right};
 numeric t; t=xpart(upper_arc intersectiontimes (z6l--z1'));
 filldraw z1r--z6r--z6l--subpath(t,0) of upper_arc--cycle; % barb
else: pos1(1.2flare,100); pos2(slab,90);
 pos3(cap_curve,0); pos4(slab,-90); pos5(flare,-95);
 rt x1r=hround(1.1u); x2=.5w; x4=.45[x1,x10]; x9=.5w-u;
 rt x3r=hround w-max(u,2u-.5cap_curve); rt x5r=hround(.9u);
 top y1r=vround .9h+o; top y2r=h+o; y3=.5[y7,y2];
 bot y4r=-o; bot y5r=vround .15h-o; y5l:=good.y y5l; x5l:=good.x x5l;
 pos7(vair,-90); pos8(vair,-90);
 pos9(max(fine.breadth,vround 2/3vair),90); pos10(cap_curve,0);
 rt x10r=hround(w-.75u); lft x8=min(hround 5u,lft x9)-eps;
 y10=.5[y9,y4]; top y8l=vround(.54h+.5vair); y8r=y9l;
 x7=1/3[x8,x3l]; z7=z8+whatever*(150u,h);
 filldraw stroke rterm.e(2,1,left,.9,4) & super_arc.e(2,3)
 & pulled_arc.e(3,8);  % upper bowl
 filldraw stroke pulled_arc.e(9,10)
  & super_arc.e(10,4) & term.e(4,5,left,.8,4); fi % lower bowl
penlabels(1,1',2,3,4,5,6,7,8,9,10); endchar;

cmchar "The cyrillic letter I";
beginchar(CYR_I,13u#+width_adj#,cap_height#,0);
italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(cap_serif_fit#,cap_serif_fit#);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
pos3(cap_stem,0); pos4(cap_stem,0);
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.cap_stem);
filldraw stroke z1e--z2e; % left stem
filldraw stroke z3e--z4e; % right stem
if serifs:  y5=h-y6=.1h;
 else:  bot y5l=h-top y6r=0; fi
x5=rt x2r; x6=lft x3l; 
if hefty: numeric upper_notch,lower_notch,alpha;
 alpha=if monospace: 100 else: 90 fi;
 upper_notch=h-cap_notch_cut; lower_notch=cap_notch_cut;
 penpos5(1.5cap_stem,alpha); penpos6(1.5cap_stem,alpha);
 x2'=rt x2r; z2'=whatever[z6r,z5r]; x3'=lft x3l; z3'=whatever[z5l,z6l];
 fill z5l..
  if y2'<lower_notch: {right}(x2'+1,lower_notch){up}... fi
  {z6-z5}diag_in(5l,6l,1,6r)--z6r..
  if y3'>upper_notch: {left}(x3'-1,upper_notch){down}... fi
  {z5-z6}diag_in(6r,5r,1,5l)--cycle;  % diagonal
else: penpos5(whatever,90); penpos6(whatever,90);
 z7=z6l-(cap_hair,0) rotated (angle(z5-z6)-90);
 z5r=z7+whatever*(z5-z6); z6r=z7+whatever*(z5-z6);
 filldraw stroke z5e..z6e; fi  % diagonal
if serifs: numeric inner_jut;
 if rt x1r+cap_jut+.5u+1<=lft x3l-cap_jut: inner_jut=cap_jut;
 else: rt x1r+inner_jut+.5u+1=lft x3l-inner_jut; fi
 dish_serif(1,2,a,1/3,cap_jut,b,1/3,inner_jut);  % upper left serif
 dish_serif(2,1,c,1/3,cap_jut,d,1/3,inner_jut); % lower left serif
 dish_serif(3,4,e,1/3,inner_jut,f,1/3,cap_jut);  % upper left serif
 dish_serif(4,3,g,1/3,inner_jut,h,1/3,cap_jut); fi  % lower left serif
math_fit(0,max(.5ic#-.5u#,0));
penlabels(1,2,2',3,3',4,5,6,7); endchar;

cmchar "The cyrillic letter SHORT I";
beginchar(CYR_SHORT_I,13u#+width_adj#,1.3cap_height#,0);
italcorr 1.3cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(cap_serif_fit#,cap_serif_fit#);
pickup tiny.nib; pos1(cap_stem',0); pos2(cap_stem',0);
pos3(cap_stem',0); pos4(cap_stem',0);
pickup tiny.nib; top y1=top y3=cap_height; bot y2=bot y4=0;
x1=x2; x3=x4; x1l=w-x3r; rt x3r=hround min(w-2u,w-3u+.5fudged.cap_stem);
filldraw stroke z1e--z2e; % left stem
filldraw stroke z3e--z4e; % right stem
if serifs:  y5=cap_height-y6=.12cap_height;
 else:  bot y5l=cap_height-top y6r=0; fi
x5=rt x2r; x6=lft x3l; 
if hefty: numeric upper_notch,lower_notch,alpha;
 alpha=if monospace: 100 else: 90 fi;
 upper_notch=cap_height-cap_notch_cut; lower_notch=cap_notch_cut;
 penpos5(1.5cap_stem,alpha); penpos6(1.5cap_stem,alpha);
 x2'=rt x2r; z2'=whatever[z6r,z5r]; x3'=lft x3l; z3'=whatever[z5l,z6l];
 fill z5l..
  if y2'<lower_notch: {right}(x2'+1,lower_notch){up}... fi
  {z6-z5}diag_in(5l,6l,1,6r)--z6r..
  if y3'>upper_notch: {left}(x3'-1,upper_notch){down}... fi
  {z5-z6}diag_in(6r,5r,1,5l)--cycle;  % diagonal
else: penpos5(whatever,90); penpos6(whatever,90);
 z6'=z6l-(cap_hair,0) rotated (angle(z5-z6)-90);
 z5r=z6'+whatever*(z5-z6); z6r=z6'+whatever*(z5-z6);
 filldraw stroke z5e..z6e; fi  % diagonal
if serifs: numeric inner_jut;
 if rt x1r+cap_jut+.5u+1<=lft x3l-cap_jut: inner_jut=cap_jut;
 else: rt x1r+inner_jut+.5u+1=lft x3l-inner_jut; fi
 dish_serif(1,2,a,1/3,cap_jut,b,1/3,inner_jut);  % upper left serif
 dish_serif(2,1,c,1/3,cap_jut,d,1/3,inner_jut);  % lower left serif
 dish_serif(3,4,e,1/3,inner_jut,f,1/3,cap_jut);  % upper right serif
 dish_serif(4,3,g,1/3,inner_jut,h,1/3,cap_jut);  % lower right serif
 if monospace: penpos7(.25vair,-90);
 else: penpos7(vair,-90); fi
 penpos8(.7vair,-180); penpos9(.75flare,-180); 
 penpos10(.7vair,0); penpos11(.75flare,0); 
 x7=.5[x8,x10]; bot y7r=.85h;
 x8=.5w-2u; x10=w-x8; y8=y11=.95h;
 bulb(7,8,9);  % left bulb
 bulb(7,10,11);  % right bulb
else:  pickup fine.nib; penpos7(.75vair,-90);
 penpos8(.75vair,-180); penpos10(.75vair,0);
 x7=.5[x8,x10]; y7=.9h;
 x8r=x1r; x10r=x3l; top y8=top y10=h;
 filldraw stroke z8e...z7e...z10e; 
fi
math_fit(0,max(.5ic#-.5u#,0));
penlabels(1,2,2',3,3',4,5,6,7,8,9,10,11);  endchar;

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

cmchar "The cyrillic letter EL";
beginchar(CYR_EL,13u#,cap_height#,0);
italcorr cap_height#*slant-cap_serif_fit#
 +.75cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(0,cap_serif_fit#);
pickup tiny.nib; numeric thin_stem;
thin_stem=min(1.5cap_hair,cap_stem);
if serifs: pos1(thin_stem,0); pos12(thin_stem,0);   
else: pos1(cap_hair,0); pos12(cap_hair,0); fi 
pos5(cap_stem,0); pos6(cap_stem,0);
x1=.33w; top y1=h; x12=x1; y12=.5h; 
rt x5r=rt x6r=hround(w-3u+.5cap_stem); top y5=h; bot y6=0;
filldraw stroke z5e--z6e;  % right stem
if serifs:   numeric inner_jut;
 inner_jut:=.5(x5l-x1r);  
 pos2(thin_stem,-90); pos3(thin_stem,-180); 
 pos4(1.2flare,-180);
 bot y2r=-o; x2=.38[x4,x1]; y4=.15h; rt x4l=hround 2.5u; z4r=z3r;
 bulb(2,3,4);  % bulb
 filldraw stroke z2e{right}...{up}z12e--z1e;  % left stem and arc
 nodish_serif(1,12,a,1/3,cap_jut,b,1/3,inner_jut);  % upper left serif
 nodish_serif(5,6,g,1/3,inner_jut,h,1/3,cap_jut);  % upper right serif
 dish_serif(6,5,e,1/3,cap_jut,f,1/3,cap_jut);  % lower right serif
else: pos1'(slab,90); pos5'(slab,90); 
 pos2(cap_hair,-90); pos3(cap_hair,-90); 
 x2=.5u; x3=x2+u; bot y2r=0; bot y3r=-o;
 lft x1'=lft x1l; rt x5'=rt x5r; top y1'r=top y5'r=h;
 filldraw stroke z1'e--z5'e;  % upper bar
 filldraw stroke z2e...z3e{right}...{up}z12e--z1e;  % stem and arc
fi
math_fit(0,.5ic#-.5u#);
penlabels(1,1',2,3,4,5,5',6,7); endchar;

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


cmchar "The cyrillic letter EN";
beginchar(CYR_EN,13u#+width_adj#,cap_height#,0);
italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(cap_serif_fit#,cap_serif_fit#);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
pos3(cap_stem,0); pos4(cap_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5cap_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(cap_bar,90); penpos6(cap_bar,90);
x5=x1; x6=x3; y5=y6=.52h;
fill stroke z5e--z6e;  % bar
if serifs: 
 numeric inner_jut;
 if rt x1r+cap_jut+.5u+1<=lft x3l-cap_jut: inner_jut=cap_jut;
 else: rt x1r+inner_jut+.5u+1=lft x3l-inner_jut; fi
 dish_serif(1,2,a,1/3,cap_jut,b,1/3,inner_jut);  % upper left serif
 dish_serif(2,1,c,1/3,cap_jut,d,1/3,inner_jut); % lower left serif
 dish_serif(3,4,e,1/3,inner_jut,f,1/3,cap_jut);  % upper left serif
 dish_serif(4,3,g,1/3,inner_jut,h,1/3,cap_jut); fi  % lower left serif
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6); endchar;

cmchar "The cyrillic letter O";
beginchar(CYR_O,14u#-width_adj#,cap_height#,0);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,0);
penpos1(vair',90); penpos3(vround(vair+1.5vair_corr),-90);
penpos2(cap_curve,180); penpos4(cap_curve,0);
if monospace: x2r=hround 1.5u;
 interim superness:=sqrt superness;  % make |"O"|, not |"0"|
else: x2r=hround u; fi
x4r=w-x2r; x1=x3=.5w; y1r=h+o; y3r=-o;
y2=y4=.5h-vair_corr; y2l:=y4l:=.52h;
penstroke pulled_super_arc.e(1,2)(.5superpull)
 & pulled_super_arc.e(2,3)(.5superpull)
 & pulled_super_arc.e(3,4)(.5superpull)
 & pulled_super_arc.e(4,1)(.5superpull) & cycle;  % bowl
math_fit(-.3cap_height#*slant-.5u#,ic#-.5u#); penlabels(1,2,3,4); endchar;

cmchar "The cyrillic letter PE";
beginchar(CYR_PE,13u#+width_adj#,cap_height#,0);
italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(cap_serif_fit#,cap_serif_fit#);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
pos3(cap_stem,0); pos4(cap_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5cap_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
if serifs: numeric inner_jut;
 if rt x1r+cap_jut+.5u+1<=lft x3l-cap_jut: inner_jut=cap_jut;
 else: rt x1r+inner_jut+.5u+1=lft x3l-inner_jut; fi
 dish_serif(2,1,c,1/3,cap_jut,d,1/3,inner_jut); % lower left serif
 dish_serif(4,3,g,1/3,inner_jut,h,1/3,cap_jut);  % lower left serif
 inner_jut:=inner_jut+2u;
 nodish_serif(1,2,a,1/3,cap_jut,b,1/3,inner_jut);  % upper left serif
 nodish_serif(3,4,e,1/3,inner_jut,f,1/3,cap_jut);  % upper left serif
else: pos5(slab,90); pos6(slab,90);
 lft x5=x1l; rt x6=x3r; y5r=y6r=y3;
 filldraw stroke z5e--z6e; fi  % upper bar
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6); endchar;

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

cmchar "The cyrillic letter ES";
if serifs: beginchar(CYR_ES,13u#,cap_height#,0);
 italcorr cap_height#*slant-.5u#;
 adjust_fit(0,0);
 pickup fine.nib; pos1(cap_hair,0); pos2(cap_band,90);
 pos3(cap_curve,180); pos4(cap_band,270); pos5(hair,360);
 rt x1r=rt x5r=hround(w-u); 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,x_height-.5vair),bot y2l-eps);
 y5=max(good.y .95(h-y1),y4l+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)...{up}z5e; % arc
 pos6(.3[fine.breadth,cap_hair],0); x6r=x1r; top y6=h+o;
 x1r-x1'=2cap_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
else: beginchar(CYR_ES,11.5u#,cap_height#,0);
 italcorr cap_height#*slant-.5u#;
 adjust_fit(0,0);
 pickup fine.nib; pos1(1.2flare,80); pos2(slab,90);
 pos3(cap_curve,180); pos4(slab,270); pos5(flare,275);
 rt x1r=hround(w-1.1u); x2=x4=.5w+1.25u;
 lft x3r=hround max(u,2u-.5cap_curve); rt x5r=hround(w-.9u);
 top y1r=vround .95h+o; top y2r=h+o; y3=.5h;
 bot y4r=-o; bot y5r=vround .08h-o; y5l:=good.y y5l; x5l:=good.x x5l;
 filldraw stroke rterm.e(2,1,right,.9,4) & super_arc.e(2,3)
  & super_arc.e(3,4) & term.e(4,5,right,.8,4); fi % arc and terminals
math_fit(-.3cap_height#*slant-.5u#,.5ic#);
penlabels(1,1',2,3,4,5,6); endchar;

cmchar "The cyrillic letter TE";
beginchar(CYR_TE,13u#-width_adj#,cap_height#,0);
italcorr cap_height#*slant-beak_jut#-.25u#;
adjust_fit(0,0);
h:=vround(h-2stem_corr);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
lft x1l=lft x2l=hround(.5w-.5cap_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-.65u); y4=good.y(y3l-beak)-eps;
arm(3,4,e,beak_darkness,.7beak_jut);  % right arm and beak
pos5(hair,180); x5=w-x4; y5=y4;
arm(3,5,f,beak_darkness,-.7beak_jut);  % left arm and beak
if serifs: dish_serif(2,1,c,1/3,1.414cap_jut,d,1/3,1.414cap_jut);  % lower serif
 nodish_serif(1,2,a,1/3,.5cap_jut,b,1/3,.5cap_jut); fi  % upper bracketing
math_fit(-.75cap_height#*slant,ic#-2.5u#); penlabels(1,2,3,4,5,6); endchar;

cmchar "The cyrillic letter U";
beginchar(CYR_U,13u#,cap_height#,0);
italcorr cap_height#*slant+.25u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric left_stem,right_stem,bot_stem,bot_vair,outer_jut;
left_stem=fudged.cap_stem-stem_corr;
right_stem=fudged.hair if hefty:-2stem_corr fi;
bot_stem=fudged.hair if hefty:-8stem_corr fi;
bot_vair=Vround(if serifs: vair else: .5[vair,bot_stem] fi);
outer_jut=.75cap_jut;
x1l=w-x4r=l+letter_fit+outer_jut+.25u; y1=y4r=h; y2=y3=3.5u; x2l=x3l;
numeric alpha,alpha[]; x9=5u; y9=bot_vair-o;
alpha1=diag_ratio(2,bot_stem,y1-y3,x4r-x1l-apex_corr);
alpha2=diag_ratio(1,bot_stem,y1-y9,x4r-x9);
if alpha1<alpha2: x2l-x1l=x4r-x3r+apex_corr; alpha=alpha1;
else: alpha=alpha2; z3l=whatever[z9,z4r-(alpha*bot_stem,0)]; fi
penpos3(alpha*right_stem,0); penpos4(alpha*right_stem,0);
alpha3=(y1++(x2l-x1l))/y1;
penpos1(alpha3*left_stem,0); penpos2(alpha3*left_stem,0);
z0=whatever[z1r,z2r]=z4l+whatever*(z3r-z4r);
fill z0+.5right{up}...{z4r-z3r}diag_end(0,4l,1,1,4r,3r)
  --z3r--z2l--diag_end(2l,1l,1,1,1r,2r){z2-z1}
  ...{down}z0+.5left--cycle; % left and right diagonals
penpos5(alpha*right_stem,0); z5r=whatever[z3r,z4r]; y5=.5[y3,y9];
if serifs: numeric light_bulb;
 light_bulb=hround 7/8[cap_hair,flare]; clearpen;
 penpos6(vair,-90); penpos7(cap_hair,-180); penpos8(light_bulb,-180);
 x6=4u; y6r=-o; y8+.5light_bulb=3u; x8r=hround 1.5u;
 fill stroke z3e---z5e...{left}z6e; bulb(6,7,8);  % arc and bulb
 numeric inner_jut; pickup tiny.nib;
 prime_points_inside(1,2); prime_points_inside(4,3);
 if rt x1'r+cap_jut+.5u+1<=lft x4'l-cap_jut: inner_jut=cap_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);  % right serif
else: penpos6(right_stem,-90); x6=4.75u; y6r=-o;
 fill stroke z3e---z5e...{left}z6e;  % arc
 pickup fine.nib; pos6'(right_stem,-90); z6'=z6;
 pos7(2/3[bot_stem,flare],-85);
 lft x7l=hround 3.5u; bot y7r=.02h-o; y7l:=good.y y7l;
 filldraw stroke term.e(6',7,left,1,4); fi % arc and terminal
math_fit(0,.5ic#); penlabels(0,1,2,3,4,5,6,7,8,9); endchar;

cmchar "The cyrillic letter EF";
beginchar(CYR_EF,14u#-width_adj#,cap_height#,0);
italcorr .75cap_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,0);
pickup tiny.nib; penpos1(cap_stem'-tiny,0); penpos2(cap_stem-tiny,0);
x1=x2=.5w; top y1=h; bot y2=0;
penpos3(cap_band,90); penpos4(cap_band,90); penpos5(curve,0);
penpos6(.5[vair,cap_band],-90); penpos7(.5[vair,cap_band],-90);
penpos8(cap_band,90); penpos9(curve,180);
penpos10(.5[vair,cap_band],270);
x3=x1; y3=y4=y8=vround .8h; y5=y9=.5[y4l,y6l];
x7=x2; y7=vround .2h; x4r=x6r=w-x8r=w-x10r=.5w+1.75u;
x5r=w-x9r=hround(w-.5u); y6=y10=y7;
filldraw stroke z1e--z2e; % stem
fill stroke z3e..pulled_arc.e(4,5) & pulled_arc.e(5,6)..z7e;
fill stroke z3e..pulled_arc.e(8,9) & pulled_arc.e(9,10)..z7e;  % lobe
if serifs: dish_serif(1,2,a,1/3,cap_jut,b,1/3,cap_jut);  % upper serif
dish_serif(2,1,c,1/3,cap_jut,d,1/3,cap_jut); fi  % lower serif
math_fit(0,ic#-2.5u#);
penlabels(0,1,2,3,4,5,6,7,8,9,10); endchar;

cmchar "The cyrillic letter HA";
beginchar(CYR_HA,13u#,cap_height#,0);
italcorr cap_height#*slant-.25u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric stem[],outer_jut,xjut,alpha[];
stem1=cap_stem-2stem_corr; stem2=min(cap_hair,stem1);
outer_jut=.75cap_jut; xjut= if serifs: (stem1-stem2)/4 else: 0 fi;
x1l=l+letter_fit+.5u+outer_jut; x2r=r-letter_fit-u-outer_jut-xjut;
x3l=l+letter_fit+.25u+outer_jut+xjut; x4r=r-letter_fit-.25u-outer_jut;
y1=y2=h; y3=y4=0;
alpha1=diag_ratio(1,stem1,h,x4r-x1l);
alpha2=diag_ratio(1,stem2,h,x2r-x3l);
penpos1(alpha1*stem1,0); penpos2(alpha2*stem2,0);
penpos3(alpha2*stem2,0); penpos4(alpha1*stem1,0);
if hefty: z0=whatever[z1,z4]=whatever[z2,z3];
 x12=x34=x0; y13=y24=y0;
 z12=whatever[z2l,z3l]; z13=whatever[z2l,z3l];
 z24=whatever[z2r,z3r]; z34=whatever[z2r,z3r];
 forsuffixes $=13,24,34: z$'=.1[z$,z0]; endfor
 fill diag_end(12,1r,.5,1,1l,13')--z13'--diag_end(13',3l,1,.5,3r,34')--z34'
  --diag_end(34',4l,.5,1,4r,24')--z24'
  --diag_end(24',2r,1,.5,2l,12)--z12--cycle; % diagonals
else: fill diag_end(4r,1r,.5,1,1l,4l)
  --diag_end(1l,4l,.5,1,4r,1r)--cycle; % left diagonal
 fill diag_end(2l,3l,.5,1,3r,2r)
  --diag_end(3r,2r,.5,1,2l,3l)--cycle; fi  % right diagonal
if serifs: numeric inner_jut[]; pickup tiny.nib;
 prime_points_inside(1,4); prime_points_inside(2,3);
 prime_points_inside(3,2); prime_points_inside(4,1);
 if rt x1'r+cap_jut+.5u+1<=lft x2'l-cap_jut-xjut: inner_jut1=cap_jut;
 else: rt x1'r+inner_jut1+.5u+1=lft x2'l-inner_jut1-xjut; fi
 if rt x3'r+cap_jut+.5u+1<=lft x4'l-cap_jut-xjut: inner_jut2=cap_jut;
 else: rt x3'r+inner_jut2+.5u+1=lft x4'l-inner_jut2-xjut; fi
 dish_serif(1',4,a,1/3,outer_jut,b,2/3,inner_jut1);  % upper left serif
 dish_serif(4',1,c,2/3,inner_jut2,d,1/3,outer_jut);  % lower right serif
 dish_serif(2',3,e,2/3,inner_jut1+xjut,
  f,1/2,outer_jut+xjut)(dark);  % upper right serif
 dish_serif(3',2,g,1/2,outer_jut+xjut,
  h,2/3,inner_jut2+xjut)(dark); fi  % lower left serif
math_fit(0,.5ic#); penlabels(0,1,2,3,4,12,13,24,34); endchar;

cmchar "The cyrillic letter TSE";
beginchar(CYR_TSE,13u#+width_adj#,cap_height#,comma_depth#);
italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(cap_serif_fit#,cap_serif_fit#);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
pos3(cap_stem,0); pos4(cap_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5cap_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
if serifs: numeric inner_jut;   
 if rt x1r+cap_jut+.5u+1<=lft x3l-cap_jut: inner_jut=cap_jut;
 else: rt x1r+inner_jut+.5u+1=lft x3l-inner_jut; fi
   dish_serif(1,2,a,1/3,  cap_jut,b,1/3,inner_jut);  % upper left serif
   dish_serif(3,4,e,1/3,inner_jut,f,1/3,cap_jut);  % upper right serif
 inner_jut:=.5(x3l-x1r);
 nodish_serif(2,1,c,1/3,  cap_jut,d,1/3,inner_jut);   % lower left serif
 nodish_serif(4,3,g,1/3,inner_jut,h,1/3,cap_jut);   % lower right serif
 pickup crisp.nib; pos5(slab,90); pos6(hair,0);
 x5=.5[x2,x4]; bot y5l=0; 
 rt x6r=tiny.rt x4r+cap_jut; y6=good.y(y5l-.75beak)-eps;
 arm(5,6,m,1.25beak_darkness,0);  %  beak
else: pos2'(slab,90); pos4'(slab,90);
 pos5(stem,0); pos6(stem,0);
 lft x2'=lft x2l; rt x4'=rt x5r=rt x6r=w-.5u; 
 bot y2'l=bot y4'l=0; y5=y4; bot y6=-.8d;
 filldraw stroke z2'e--z4'e;  % lower bar
 filldraw stroke z5e--z6e;  % right beak
fi
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6); endchar;

cmchar "The cyrillic letter CHE";
beginchar(CYR_CHE,13u#,cap_height#,0);    % [AS]
italcorr cap_height#*slant-serif_fit#+.5cap_stem#-2u#;
adjust_fit(cap_serif_fit#+stem_shift#,cap_serif_fit#-stem_shift#);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
pos3(cap_stem,0); pos4(cap_stem,0);
lft x1l=hround(2.5u-.5cap_stem); x1=x2; x3l=w-x1r; x3r=x4r;
top y1=h; bot y4=0;
penpos2'(cap_stem-fine,-180); z2'=z2; y3=y1; y2=.65h;
if monospace: penpos5(.5vair,-90); penpos6(.5vair,-90);
else: penpos5(vair,-90); penpos6(vair,-25); fi
y6=.52h; lft x6l=lft x3l;
filldraw stroke z1e--z2e;  % left stem
filldraw stroke z3e--z4e;  % right stem
pickup fine.nib; bot y5r=y6-vair-.1h; x5=.5w; 
filldraw stroke {{interim superness:=hein_super; 
 pulled_super_arc.e(2',5)(.01superpull)}}
 & z5e{right}...z6e;  % arc
if serifs: numeric inner_jut;   
 if rt x1r+cap_jut+.5u+1<=lft x3l-cap_jut: inner_jut=cap_jut;
 else: rt x1r+inner_jut+.5u+1=lft x3l-inner_jut; fi
 dish_serif(1,2,a,1/3,jut,b,1/3,inner_jut);  % upper left serif
 dish_serif(3,4,e,1/3,inner_jut,f,1/3,jut);  % upper right serif
 dish_serif(4,3,g,1/3,jut,h,1/3,jut); fi  % lower right serif
penlabels(1,2,2',3,4,5,6); endchar;

cmchar "The cyrillic letter SHA";
beginchar(CYR_SHA,18u#,cap_height#,0);  
italcorr cap_height#*slant-.25u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
pickup tiny.nib; pos1(cap_stem',0); pos2(cap_stem',0);
pos3(cap_stem',0); pos4(cap_stem',0);
pos5(cap_stem',0); pos6(cap_stem',0);
if odd(w-cap_stem'): change_width; fi
lft x1l=lft x2l=hround max(2u,3u-.5cap_stem); 
x3=x4=.5w; x5=x6=w-x1;
top y1=top y5=top y3=h; bot y2=bot y6=bot y4=0;
filldraw stroke z1e--z2e; % right stem
filldraw stroke z3e--z4e; % middle stem
filldraw stroke z5e--z6e; % left stem
if serifs:  numeric inner_jut;  
 if rt x1r+cap_jut+.5u+1<=lft x3l-cap_jut: inner_jut=cap_jut;
 else: rt x1r+inner_jut+.5u+1=lft x3l-inner_jut; fi
   dish_serif(1,2,a,1/3,  cap_jut,b,1/3,inner_jut);  % upper left serif
   dish_serif(3,4,c,1/3,inner_jut,d,1/3,inner_jut);  % upper middle serif
   dish_serif(5,6,e,1/3,inner_jut,f,1/3,  cap_jut);  % upper right serif
 inner_jut:=.5(x3l-x1r);
 nodish_serif(2,1,g,1/3,cap_jut,h,1/3,inner_jut);  % lower left serif
 nodish_serif(4,3,i,1/3,inner_jut,j,1/3,inner_jut);  % lower middle serif
 nodish_serif(6,5,k,1/3,inner_jut,l,1/3,cap_jut);    % lower right serif
else: pos2'(slab,90); pos6'(slab,90);
 lft x2'=lft x1l; rt x6'=rt x6r; bot y2'l=bot y6'l=0;
 filldraw stroke z2'e--z6'e; % lower bar
fi
math_fit(0,.5ic#); penlabels(1,2,2',3,4,5,6,6'); endchar;

cmchar "The cyrillic letter SHCHA";
beginchar(CYR_SHCHA,18u#,cap_height#,comma_depth#); 
italcorr cap_height#*slant-.25u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
pickup tiny.nib; pos1(cap_stem',0); pos2(cap_stem',0);
pos3(cap_stem',0); pos4(cap_stem',0);
pos5(cap_stem',0); pos6(cap_stem',0);
if odd(w-cap_stem'): change_width; fi
lft x1l=lft x2l=hround max(2u,3u-.5cap_stem); 
x3=x4=.5w; x5=x6=w-x1;
top y1=top y5=top y3=h; bot y2=bot y6=bot y4=0; 
filldraw stroke z1e--z2e; % right stem
filldraw stroke z3e--z4e; % middle stem
filldraw stroke z5e--z6e; % left stem
if serifs:  numeric inner_jut;  
 if rt x1r+cap_jut+.5u+1<=lft x3l-cap_jut: inner_jut=cap_jut;
 else: rt x1r+inner_jut+.5u+1=lft x3l-inner_jut; fi
   dish_serif(1,2,a,1/3,  cap_jut,b,1/3,inner_jut);  % upper left serif
   dish_serif(3,4,c,1/3,inner_jut,d,1/3,inner_jut);  % upper middle serif
   dish_serif(5,6,e,1/3,inner_jut,f,1/3,  cap_jut);  % upper right serif
 inner_jut:=.5(x3l-x1r);
 nodish_serif(2,1,g,1/3,  cap_jut,h,1/3,    inner_jut);  % lower left serif
 nodish_serif(4,3,i,1/3,inner_jut,    j,1/3,inner_jut);  % lower middle serif
 nodish_serif(6,5,k,1/3,inner_jut,    l,1/3,  cap_jut);    % lower right serif
 pickup crisp.nib; pos7(slab,90); pos8(hair,0);
 x7=.5[x4,x6]; bot y7l=0; 
 rt x8r=tiny.rt x6r+cap_jut; y8=good.y(y7l-.75beak)-eps;
 arm(7,8,m,1.25beak_darkness,0);  %  beak
else: pos2'(slab,90); pos6'(slab,90);
 pos7(stem,0); pos8(stem,0);
 lft x2'=lft x1l; rt x6'=rt x7r=rt x8r=w-.5u; 
 bot y2'l=bot y6'l=0; y7=y6; bot y8=-.8d;
 filldraw stroke z2'e--z6'e;  % lower bar
 filldraw stroke z7e--z8e;  % right beak
fi
math_fit(0,.5ic#); penlabels(1,2,2',3,4,5,6,6',7,8); endchar;

cmchar "The cyrillic letter HARD_SIGN";
beginchar(CYR_HARD_SIGN,16u#,cap_height#,0);
italcorr .75cap_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,0);
numeric left_stem,right_curve,middle_weight;
left_stem=cap_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(5.5u,6.5u-.5left_stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
penpos5(cap_band,90); penpos6(cap_band,90); penpos7(right_curve,0);
penpos8(cap_band,-90); penpos9(cap_band,-90);
z9r=bot z2; y8=y9; y7=.5[y8,y6]; y5=y6=.52h;
x8=x6; x5=x1; x6l:=x6-.25u; x7r=hround(w-u); x8l:=x8l-.5u;
if serifs: right_curve=cap_curve-stem_corr; x6=.5[x1,w-1.8u];
else: right_curve=cap_curve-3stem_corr; x6=.5[x1,w-1.5u];
x6l:=x6l-.5u; fi
fill stroke z5e..super_arc.e(6,7) & super_arc.e(7,8)..z9e;  % lower lobe
pickup crisp.nib; pos3(slab,90); pos4(cap_hair,180);
top y3r=h; x3=x1; lft x4r=hround(.5u); y4=good.y(y3l-.75beak)-eps;
arm(3,4,e,beak_darkness,-.7beak_jut);  % upper arm and beak
if serifs: nodish_serif(1,2,a,0,cap_jut,b,1/3,cap_jut);  % upper serif
 nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi  % lower serif
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6,7,8,9); endchar;

cmchar "The cyrillic letter YERU";
beginchar(CYR_YERU,17.5u#,cap_height#,0);
italcorr .75cap_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,0);
numeric left_stem,right_curve,middle_weight;
left_stem=cap_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; % left stem
pos3(cap_stem,0); pos4(cap_stem,0);
penpos5(cap_band,90); penpos6(cap_band,90); penpos7(right_curve,0);
penpos8(cap_band,-90); penpos9(cap_band,-90);
x3=x4=w-x1; top y3=h; bot y4=0;
z9r=bot z2; y8=y9; y7=.5[y8,y6]; y5=y6=.52h;
x6=x8; x5=x1; x6l:=x6-.25u; x8l:=x8l-.5u;
rt x7r=if serifs: tiny.lft x3l-cap_jut; else: 11.5u; fi 
if serifs: right_curve=cap_curve-stem_corr; x6=.5[x1,w-6.8u];
else: right_curve=cap_curve-3stem_corr; x6=.5[x1,w-7.5u];
x6l:=x6l-.5u; fi
fill stroke z5e..super_arc.e(6,7) & super_arc.e(7,8)..z9e;  % lower lobe
filldraw stroke z3e--z4e; % right stem
if serifs: dish_serif(1,2,a,1/3,cap_jut,b,1/3,cap_jut);  % upper left serif
 nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut);  % lower left serif
 dish_serif(3,4,e,1/3,1.05cap_jut,f,1/3,1.05cap_jut);  % upper right serif
 dish_serif(4,3,g,1/3,1.05cap_jut,h,1/3,1.05cap_jut); fi % lower right serif
labels(1,2,3,4,5,6,7,8,9);
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6,7,8,9); endchar;

cmchar "The cyrillic letter SOFT_SIGN";
beginchar(CYR_SOFT_SIGN,12.5u#,cap_height#,0);
italcorr .75cap_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,0);
numeric left_stem,right_curve,middle_weight;
left_stem=cap_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
penpos5(cap_band,90); penpos6(cap_band,90); penpos7(right_curve,0);
penpos8(cap_band,-90); penpos9(cap_band,-90);
z9r=bot z2; y8=y9; y7=.5[y8,y6]; y5=y6=.52h;
x6=x8; x5=x1; x6l:=x6-.25u; x7r=hround(w-u); x8l:=x8l-.5u;
if serifs: right_curve=cap_curve-stem_corr; x6=.5[x1,w-1.8u];
else: right_curve=cap_curve-3stem_corr; x6=.5[x1,w-1.5u];
x6l:=x6l-.5u; fi
fill stroke z5e..super_arc.e(6,7) & super_arc.e(7,8)..z9e;  % lower lobe
if serifs: dish_serif(1,2,a,1/3,cap_jut,b,1/3,cap_jut);  % upper serif
 nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi  % lower serif
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6,7,8,9); endchar;

cmchar "The cyrillic letter E";
if serifs: beginchar(CYR_E,13u#,cap_height#,0);
 italcorr cap_height#*slant-.5u#;
 adjust_fit(0,0);
 pickup fine.nib; pos1(cap_hair,180); pos2(cap_band,90);
 pos3(cap_curve,0); pos4(cap_band,270); pos5(hair,180);
 lft x1r=lft x5r=hround u; rt x3r=hround (w-u); x2=x4=.55[x3,x1];
 top y2r=h+o; bot y4r=-o; y3=.5[y2,y4];
 bot y1=min(vround max(.6h,x_height-.5vair),bot y2l-eps);
 y5=max(good.y .95(h-y1),y4l+eps);
 (x2l',y2l)=whatever[z2r,z1l]; x2l:=max(x2l',x2l-.5u);
 (x4l',y4l)=whatever[z4r,z5l]; x4l:=max(x4l',x4l-.5u);
 filldraw stroke z1e{x2-x1,10(y2-y1)}
  ...pulled_arc.e(2,3) & pulled_arc.e(3,4)...{up}z5e; % arc
 pos6(.3[fine.breadth,cap_hair],180); x6r=x1r; top y6=h+o;
 x1'-x1r=2cap_curve-fine; y1'=y1;
 path upper_arc; upper_arc=z1{x2-x1,10(y2-y1)}..z2{right};
 numeric t; t=xpart(upper_arc intersectiontimes (z6l--z1'));
 filldraw z1r--z6r--z6l--subpath(t,0) of upper_arc--cycle; % barb
else: beginchar(CYR_E,11.5u#,cap_height#,0);
 italcorr cap_height#*slant-.5u#;
 adjust_fit(0,0);
 pickup fine.nib; pos1(1.2flare,110); pos2(slab,90);
 pos3(cap_curve,0); pos4(slab,270); pos5(flare,265);
 lft x1r=hround 1.1u; x2=x4=.5w-1.25u;
 rt x3r=w-hround max(u,2u-.5cap_curve); lft x5r=hround .9u;
 top y1r=vround .95h+o; top y2r=h+o; y3=.5h;
 bot y4r=-o; bot y5r=vround .08h-o; y5l:=good.y y5l; x5l:=good.x x5l;
 filldraw stroke rterm.e(2,1,left,.9,4) & super_arc.e(2,3)
  & super_arc.e(3,4) & term.e(4,5,left,.8,4); fi % arc and terminals
penpos7(cap_bar,90); penpos8(cap_bar,90);
x7=lft x3l; x8=.5w-1.5u;
%if serifs: y7l=y8l else: 
y7=y8=.5h;
fill stroke z7e--z8e;  % bar
math_fit(-.3cap_height#*slant-.5u#,.5ic#);
penlabels(1,1',2,3,4,5,6); endchar;

cmchar "The cyrillic letter YU";
beginchar(CYR_YU,20u#,cap_height#,0);
italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(cap_serif_fit#,cap_serif_fit#);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5cap_stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % left stem
penpos5(vair',90); penpos7(vround(vair+1.5vair_corr),-90);
penpos6(cap_curve,180); penpos8(cap_curve,0);
if monospace: x8r=hround(w-1.5u); x6r=hround(w-12.5u);
 interim superness:=sqrt superness;  % make |"O"|, not |"0"|
else: x8r=hround(w-u); x6r=hround(w-13u);  fi
x5=x7=.5[x8,x6]; y5r=h+o; y7r=-o; y6=y8=.5h-vair_corr; y6l:=y8l:=.52h;
penstroke pulled_super_arc.e(5,6)(.5superpull)
 & pulled_super_arc.e(6,7)(.5superpull)
 & pulled_super_arc.e(7,8)(.5superpull)
 & pulled_super_arc.e(8,5)(.5superpull) & cycle;  % bowl
penpos3(cap_bar,90); penpos4(cap_bar,90);
x3=x1; x4=x6; y3=y4=.52h;
fill stroke z3e--z4e;  % bar
if serifs: numeric inner_jut; inner_jut=cap_jut;
 dish_serif(1,2,a,1/3,cap_jut,b,1/3,inner_jut);  % upper left serif
 dish_serif(2,1,c,1/3,cap_jut,d,1/3,inner_jut); fi  % lower left serif
math_fit(-.3cap_height#*slant-.5u#,ic#-.5u#);
penlabels(1,2,3,4,5,6,7,8); endchar;

cmchar "The cyrillic letter YA";
beginchar(CYR_YA,12u#+.5max(2u#,cap_curve#),cap_height#,0);
italcorr .75cap_height#*slant- if serifs: 1.75 else: .5 fi\\ u#;
adjust_fit(0,cap_serif_fit#);
pickup tiny.nib; pos1(cap_stem',0); pos2(cap_stem',0);
rt x1r=rt x2r=w-hround(3u-.5cap_stem'); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
penpos3(cap_band,90); penpos4(cap_band,90);
penpos5(cap_curve if hefty:-3stem_corr fi,180);
penpos6(vair,-90); penpos7(vair,-90);
z3r=top z1; y4=y3; y5=.5[y4l,y6l]; y6=y7; x7=x2; y7=.5h; x4=x6;
if serifs: x4=.5w+.5u; x5r=hround(1.5u);
else: x4=.5w-.5u; x5r=hround u; fi
x4l:=x6l:=x4+.125cap_curve;
fill stroke z3e..pulled_arc.e(4,5) & pulled_arc.e(5,6)..z7e;  % lobe
pos6'(cap_curve,0); x6'r=x6l+.5u; y6'=y6;
pos8(cap_curve,0); tiny.lft x8l=.5u+.5cap_jut; bot y8=0;
filldraw stroke z6'e--z8e; % diagonal stem
if serifs:
 nodish_serif(1,2,a,1/3,.5cap_jut,b,1/3,cap_jut);  % upper serif
 dish_serif(2,1,c,1/3,cap_jut,d,1/3,cap_jut);  % lower serif
 serif(8,6',e,1/3,-.5cap_jut); fi  % lower diagonal serif
math_fit(0,.75ic#); penlabels(1,2,3,4,5,6,7,8); endchar;

