%% @metafontfile{
%%     filename="serb.mf",
%%     version="2.2",
%%     date="04-JAN-1995",
%%     filetype="Metafont: driver",
%%     copyright="Copyright (C) Humanities and Arts Computing Center,
%%            University of Washington;
%%            all rights reserved.  Copying of this file is
%%            authorized only if either:
%%            (1) you make absolutely no changes to your copy
%%                including name; OR
%%            (2) if you do make changes, you first rename it to some
%%                other name.",
%%     author="American Mathematical Society",
%%     address="American Mathematical Society,
%%            Technical Support, Electronic Products and Services,
%%            P. O. Box 6248,
%%            Providence, RI 02940,
%%            USA",
%%     telephone="401-455-4080 or (in the USA) 800-321-4AMS",
%%     email="Internet: Tech-Support@Math.AMS.org",
%%     codetable="ISO/ASCII",
%%     checksum = "47996 550 2173 26152"
%%     keywords="amsfonts, tex, metafont , cyrillic ",
%%     abstract="This is the driver file for use with 
%%            the cyrillic fonts in AMSFonts 2.2."
%%     docstring       = "The checksum field above contains a CRC-16
%%                        checksum as the first value, followed by the
%%                        equivalent of the standard UNIX wc (word
%%                        count) utility output of lines, words, and
%%                        characters.  This is produced by Robert
%%                        Solovay's checksum utility.",
%%     }
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This is serb.mf containing serbian and other letters with offsets
%of 8 between upper and lower case

%  The letter "ZHE" is first in this file because it uses the picture "K"
%  saved from the end of the previous file.
cmchar "The Russian letter ZHE";
beginchar(oct"021",12u#,cap_height#,0);
italcorr cap_height#*slant+.25u#;
adjust_fit(6u#+cap_serif_fit#,cap_serif_fit#); slantswitch;
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
if serifs:  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
% pickup fine.nib; pos3(vair,90); x3=x1; y3=.55h; z3'=z3; pos3'(slab,90);
 pickup fine.nib; pos3(vair,90); x3=x1; y3=.55h; z3'=z3; pos3'(varwid,90);
% pos4(vair,90); x4=w-2u; top y4r=h+oo;
 pos4(varwid,90); x4=w-.75flare-.125u; top y4r=h+oo;
% filldraw stroke z3'e{right}..{right}z4e;  % upper diagonal
 x41=x4; y41=y3'; x42=x4-2u; y42=y4;
 filldraw stroke z3'e..controls z41 and z42..z4e;  % upper diagonal
 pos5(hair,0); pos6(flare,0);
 rt x5r=hround(w-.125u); y5+.5flare=vround(top y4r-hair)+1;
 top y4'r=top y4r; x4'=x4; pos4'(hair,90);
 bulb(4',5,6); % bulb
% pos7(stem,0); pos8(vair,90); pos9(hair,180);
 pos7(stem,0); pos8(varwid,90); pos9(hair,180);
 x9+.5hair=hround(w+.5hair-eps); y9=1/3x_height;
 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
else:
 numeric right_jut,stem[],alpha[];
 right_jut=.4tiny; 
 pickup tiny.nib; 
 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
fi
picture V; %transform t;
%t=identity reflectedabout(z1,z2);
%V=currentpicture transformed t;
%addto currentpicture also V;
mirror(x1);
addto currentpicture also K_pic;
%  !!!!! note that this requires K_pic be set as current by previous K definition
%  
picture K_pic; %release resources held by K_pic
endchar;

cmchar "The Serbian letter Soft N (looks like Hb)";
beginchar(oct"000",19u#,cap_height#,0);
italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(cap_serif_fit#,0);
w:=13u;
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 rt serif
 nodish_serif(4,3,g,1/3,inner_jut,h,1/3,cap_jut); fi  % lower rt serif
% now the b part
w:=19u; numeric middle_weight;
  middle_weight=if serifs: .6vair+.5 else: cap_bar fi;
z88=z6; penpos88(middle_weight,90); penpos89(middle_weight,90);
y89=y88; x89=x91= if serifs: .5[x3,w-1.5u]+.5u else: .5[x3,w-2.5u] +.5u fi;
numeric right_curve; 
if serifs: right_curve=cap_curve-stem_corr;
else: right_curve=cap_curve-3stem_corr; fi
x89l:=x89-.25u; penpos90(right_curve,0); y90=.5[y89,y91]; x90r=hround(w-u);
bot y92r=0; x92=x4; penpos92(cap_band,-90); y91=y92; penpos91(cap_band,-90);
filldraw stroke z88e..super_arc.e(89,90)&super_arc.e(90,91)..z92e;
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6); endchar;

cmchar "The Serbian letter Soft L";
beginchar(oct"001",19u#,cap_height#,0);
adjust_fit(0,0); w:=13u;
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
lft x1l=lft x2l=hround(w-3u); top y1=h; bot y2=0;
filldraw stroke z1e--z2e;
if serifs:
  numeric inner_jut; inner_jut=.5(x1-x5);
  x4=u+.5dot_size; x3=x4+.5dot_size; bot y3r=0; pos3(1.5cap_hair,-90); 
  x5=.42[x4,x1]; top y5=h; pos5(1.5cap_hair,0); pos4(dot_size,-180);
  pos10(hair,-180);
  filldraw stroke z3e{right}...{up}z5e;
  y4=dot_size; bulb(3,10,4);
  nodish_serif(2,1,a,1/3,cap_jut,b,1/3,cap_jut);
  nodish_serif(1,2,c,1/3,inner_jut,d,1/3,cap_jut);
%  pickup crisp.nib; 
  top y6=h;  x6-.75cap_jut=rt x1r; pos6(slab,90);
  x5'+.5cap_jut=lft x5l; top y5'=h; pos5'(slab,90);
%  filldraw stroke z5'e--z6e;
  x9=x5; bot y9=0; pos9(cap_hair,0);
  nodish_serif(5,9,aa,1/3,cap_jut,ab,1/3,inner_jut);  % upper left serif
else:
  x5r=hround u; bot y5r=vround(.06h-o); bot y4r=-o; x4r=.35[x5,x3r];
  x3=x5+3flare; top y3=h; lft x3'=lft x3l; top y3'r=h; rt x1'r=rt x1r;
  top y1'r=h; pos3'(slab,90); pos1'(slab,90); pos5(flare,-120); pos4(vair,-90);
  pos3(hair,0);
  filldraw stroke z5e...{right}z4e...{up}z3e;
  filldraw stroke z3'e--z1'e;
fi
% now the b part
w:=19u; numeric middle_weight; middle_weight=.6vair+.5;
x88=x1; y88=.52h; penpos88(middle_weight,90); penpos89(middle_weight,90);
y89=y88; x89=x91= if serifs: .5[x1,w-1.5u]+.5u else: .5[x1,w-2.5u] +.5u fi;
numeric right_curve; 
if serifs: right_curve=cap_curve-stem_corr; else: right_curve=cap_curve-3stem_corr; fi
x89l:=x89-.25u; penpos90(right_curve,0); y90=.5[y89,y91]; x90r=hround(w-u);
x92=x2; bot y92r=0; penpos92(cap_band,-90); y91=y92; penpos91(cap_band,-90);
filldraw stroke z88e..super_arc.e(89,90)&super_arc.e(90,91)..z92e;
endchar;

cmchar "The Serbian letter Hard DJ";
beginchar(oct"002",13u#+width_adj#,cap_height#,if serifs: 1.75cap_stem#
  else: .5desc_depth# fi);
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,c,1/3,cap_jut,d,1/3,inner_jut); % upper left serif
 dish_serif(3,4,g,1/3,inner_jut,h,1/3,cap_jut);   % upper left serif
 inner_jut:=.5(x3l-x1r);
 nodish_serif(2,1,a,1/3,cap_jut,b,1/3,inner_jut);  % lower left serif
 nodish_serif(4,3,e,1/3,inner_jut,f,1/3,cap_jut);  % lower left serif 
else:
 lft x1'= lft x1l; bot y1'l=0; pos1'(slab,90);
 rt x3'=rt x3r; y3'=y1'; pos3'(slab,90); filldraw stroke z1'e--z3'e;
fi
x90=.5[x2,x4]; y90=0; x91=x90; y91=-d; pos90(cap_stem,0); pos91(cap_stem,0);
filldraw stroke z90e--z91e; 
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6); endchar;

cmchar "The Russian letter Reverse E (looks like backwards C)";
if serifs: beginchar(oct"003",13u#,cap_height#,0);
 italcorr cap_height#*slant-.5u#;
 adjust_fit(0,0); slantswitch;
 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 .675h,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(oct"003",11.5u#,cap_height#,0);
 italcorr cap_height#*slant-.5u#;
 adjust_fit(0,0); slantswitch;
 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;
 x1'=.65w;
 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
z90=z3l; x91=x1; y91=y90; pos90(bar,90); pos91(bar,90); 
if serifs: z92=.625[z90,z91]; pos92(if serifs: 2.5 fi bar,90);
  filldraw stroke z90e{1,1}..{1,-1}z92e..{1,1}z91e;
else: filldraw stroke z90e--z91e; fi
mirror(.5w);
math_fit(-.3cap_height#*slant-.5u#,.5ic#);
penlabels(1,1',2,3,4,5,6); endchar;

cmchar "The Ukrainian letter YE (looks like C with mid-line)";
if serifs: beginchar(oct"005",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 .675h,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(oct"005",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;
 x1'=.65w;
 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
z90=z3l; x91=x1; y91=y90; pos90(bar,90); pos91(bar,90); 
if serifs: z92=.625[z90,z91]; pos92(if serifs: 2.5 fi bar,90);
  filldraw stroke z90e{1,1}..{1,-1}z92e..{1,1}z91e;
else: filldraw stroke z90e--z91e; fi
math_fit(-.3cap_height#*slant-.5u#,.5ic#);
penlabels(1,1',2,3,4,5,6); endchar;

cmchar "The Russian letter YU (looks like IO)";
beginchar(oct"020",14u#-width_adj#,cap_height#,0);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(6.5u#,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
pickup tiny.nib;
x80=x81=-3u; top y80=h; bot y81=0; pos80(cap_stem,0); pos81(cap_stem,0);
filldraw stroke z80e--z81e;
if serifs: 
  dish_serif(80,81,e,1/3,cap_jut,f,1/3,cap_jut);
  dish_serif(81,80,g,1/3,cap_jut,h,1/3,cap_jut); 
fi  
x82=x80; y82=y2; x83=x2; y83=y82; pos82(cap_bar,90); pos83(cap_bar,90);
filldraw stroke z82e--z83e;
math_fit(-.3cap_height#*slant-.5u#,ic#-.5u#); penlabels(1,2,3,4); endchar;

cmchar "The Russian letter Short I";
beginchar(oct"022",14u#+width_adj#,cap_height#+3dot_size#,0);
italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(cap_serif_fit#,cap_serif_fit#); h:=cap_height;
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: penpos5(.85cap_stem,90); penpos6(.85cap_stem,90); else: penpos5(cap_stem,90); penpos6(cap_stem,90); fi
x5=x1r; x6=x3l; if serifs: y5=.1h; y6=.9h; else: bot y5l=0; top y6r=h; fi
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
x51=.5w; y51=h; h:=body_height+2dot_size; nucyrbrev(51,q);
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6); endchar;

% for shape, see Knizhnay Shrift p 58  Bodoni, Parma 1818
cmchar "The Old Russian letter IZHITSA (looks like V)";
beginchar(oct"024",13u#,cap_height#,0);
italcorr cap_height#*slant+.25u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric left_stem,right_stem,outer_jut,alpha;
left_stem=cap_stem-stem_corr;
right_stem=min(cap_hair if hefty:-2stem_corr fi,left_stem);
outer_jut=.75cap_jut;
x1l=w-x4r-1.5u=l+letter_fit+outer_jut+.25u; y1=y4+.1h+cap_hair=h;
x2-x1=x4-x3; x2l+apex_corr=x3l; y2=y3=-apex_o;
alpha=diag_ratio(2,right_stem,y1-y2,x4r-x1l-apex_corr);
penpos1(alpha*left_stem,0); penpos2(alpha*left_stem,0);
penpos3(alpha*right_stem,0); penpos4(alpha*right_stem,0);
z0=whatever[z1r,z2r]=whatever[z3l,z4l];
x5=x4+ if serifs:1.5 else: 2.25 fi u; top y5r=h+oo; penpos5(cap_hair,90); 
rt x6r-.25flare=hround(w-.5u-.5); y6+.55flare=bot y5l; penpos6(hair,0);
penpos7(flare,0); if serifs: bulb(5,6,7); fi
if y0>cap_notch_cut: y0:=cap_notch_cut; message "y0>cap_notch_cut";
  fill z0+.5right{up}...{z4-z3}z4l...{right}z5r--z5l{left}
    ...z4r{z3-z4}--z3r...z3l--diag_end(2l,1l,1,1,1r,2r){z2-z1}
    ...{down}z0+.5left--cycle; % left and right diagonals
else: fill z0--z4l{z4-z3}...{right}z5r--z5l{left}
    ...{z3-z4}z4r--z3r{-10,-1}...{-10,1}z3l
    --diag_end(2l,1l,1,1,1r,0)--cycle; fi % left and right diagonals
if serifs: numeric inner_jut; pickup tiny.nib;
 prime_points_inside(1,2); prime_points_inside(4,3);
 if rt x1'r+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
fi 
math_fit(.75u#-cap_height#*slant,ic#-4u#); penlabels(0,1,2,3,4); endchar;

cmchar "The Old Russian letter FITA (looks like Theta)";
beginchar(oct"025",14u#,cap_height#,0);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,0);
numeric light_curve; light_curve=hround(cap_curve-2stem_corr);
penpos1(vair,90); penpos3(vround(vair+.5vair_corr),-90);
penpos2(light_curve,180); penpos4(light_curve,0);
if monospace: x2r=hround 4.5u;
 interim superness:=sqrt superness;  % make |"O"|, not |"0"|
else: x2r=hround 2.5u; fi
x4r=w-x2r; x1=x3=.5w; y1r=h+o; y2=y4=.5h-vair_corr; y3r=-o;
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
pickup crisp.nib; pos5(cap_vstem,90); pos6(cap_vstem,90);
lft x5=w-rt x6=hround .5u; y5=y6=.5[y1l,y3l];
filldraw stroke z5e--z6e;  % bar
if serifs: pos7(hair,0); pos8(hair,0); pos9(hair,0); pos10(hair,0);
 x7l=x8l=x5; x9r=x10r=x6;
 y7=y5r; y9=y6r; y5l-y8=y6l-y10=vround .075h;
 filldraw stroke z7e--z8e;  % left serif
 filldraw stroke z9e--z10e; fi  % right serif
math_fit(-.3cap_height#*slant-.5u#,ic#-.5u#);
penlabels(1,2,3,4,5,6,7,8,9,10); endchar;

cmchar "The Macedonian letter ZELO (looks like S)";
beginchar(oct"026",10u#,cap_height#,0);
italcorr cap_height#*slant-u#;
adjust_fit(0,0);
numeric theta; theta=90-angle(50u,h); slope:=-h/50u;  % angle at middle
numeric s_slab; s_slab=if serifs:slab else:vround .2[slab,cap_stem] fi;
numeric ess'; ess'=max(fine.breadth,cap_ess);
pickup fine.nib; pos2(max(fine.breadth,s_slab-vround vair_corr),-90);
pos0(ess',theta); pos7(s_slab,-90);
x2+x7=2x0=w; x7-x2=if serifs: u else: 0 fi; top y2l=h+o; bot y7r=-o;
y0=.52h; lft x3l=hround u; rt x6r=hround(w-u);
x3r-x3l=x6r-x6l=hround .5[s_slab,ess']-fine;
ellipse_set(2l,3l,4l,0l); ellipse_set(2r,3r,4r,0r); y3=y3r;
ellipse_set(7l,6l,5l,0l); ellipse_set(7r,6r,5r,0r); y6=y6r;
filldraw stroke super_arc.e(2,3) & z3e{down}
 ..z4e---z5e..z6e{down} & super_arc.e(6,7);  % main stroke
if serifs: pos1(hair,180); pos8(hair,180);
 rt x1l=hround(w-1.5u); lft x8r=hround u;
 bot y1=vround 2/3h+1; top y8=vround 1/3h-1;
 filldraw stroke z1e{x2-x1,10(y2-y1)}....{left}z2e;  % upper arc
 filldraw stroke z7e{left}....{up}z8e;  % lower arc
 path upper_arc, lower_arc;
 upper_arc=z1{x2-x1,10(y2-y1)}....{left}z2;
 lower_arc=z7{left}....{up}z8;
 pos10(.3[fine.breadth,cap_hair],0); pos9(.3[fine.breadth,cap_hair],0);
 x10r=x1l; top y10=top y2l; x9l=x8r; bot y9=bot y7r;
 x1l-x1'=x8'-x8r=1.6cap_curve-fine; y1'=y1; y8'=y8;
 numeric t; t=xpart(upper_arc intersectiontimes(z10l--z1'));
 filldraw z1l--z10r--z10l--subpath(t,0) of upper_arc--cycle;  % upper barb
 t:=xpart(lower_arc intersectiontimes(z9r--z8'));
 filldraw z8r--z9l--z9r--subpath(t,1) of lower_arc--cycle;  % lower barb
else: pos1(1.2flare,-100); pos8(1.2flare,-100);
 x1l=good.x(x1l+w-1.75u-rt x1); lft x8r=hround .8u;
 top y1l=vround .93h+o; bot y8r=vround .1h-o;
 filldraw stroke term.e(2,1,right,.9,4);  % upper arc and terminal
 filldraw stroke term.e(7,8,left,1,4); fi  % lower arc and terminal
math_fit(0,.5ic#); penlabels(0,1,1',2,3,4,5,6,7,8,8',9,10); endchar;

cmchar "The Russian letter YA (looks like backward R)";
beginchar(oct"027",if serifs: 12u#+.5max(2u#,cap_curve#)
 else:12.5u#-.5width_adj# fi,cap_height#,0);
italcorr .75cap_height#*slant- if serifs: 1.75 else: .5 fi\\ u#;
adjust_fit(0,cap_serif_fit#); slantswitch;
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
penpos3(cap_band,90); penpos4(cap_band,90);
penpos5(cap_curve if hefty:-3stem_corr fi,0);
penpos6(vair,-90); penpos7(vair,-90);
z3r=top z1; y4=y3; y5=.5[y4l,y6l]; y6=y7;
x7=x2; y7l=vround(.5h+.5vair); x4=x6;
if serifs: x4=.5w-.5u; x5r=hround(w-2.25u);
else: x4=.5w+.5u; x5r=hround(w-u); fi
x4l:=x6l:=x4-.125cap_curve;
fill stroke z3e..pulled_arc.e(4,5) & pulled_arc.e(5,6)..z7e;  % lobe
if serifs: pos6'(vair,-90); pos0(cap_stem,180);
 pos8(cap_curve,180); pos9(vair,-90); pos10(hair,0);
 z6'=z6; lft x0r=lft x8r=hround(x5-2/3u-.5cap_curve);
 y8=1/3[y2,y7]; y0=3/5[y2,y7]; x9=.5[x8l,x10r];
 bot y9r=-o; rt x10r=hround(w-.05u); y10=1/4[y2,y7];
 filldraw stroke z6'e{right}..z0e---z8e....z9e{right}..z10e{up};  % tail
 nodish_serif(1,2,a,1/3,cap_jut,b,1/3,.5cap_jut);  % upper serif
 dish_serif(2,1,c,1/3,cap_jut,d,1/3,cap_jut);  % lower serif
else: penpos8(cap_stem-2stem_corr,0); penpos9(cap_stem,0);
 x8=x6+.5u; y8=y6; x9r=hround(w-.5u); y9=0;
 fill z8l--diag_end(8l,9l,.5,1,9r,8r)--z8r--cycle; fi  % tail
mirror(.5w);
math_fit(0,.75ic#); penlabels(0,1,2,3,4,5,6,7,8,9,10); endchar;

endinput;                    %%%%%%%%%%%%%%%%%%%%

cmchar "The Ukrainian letter Hard G (looks like Gamma)";
beginchar(oct"225",11.5u#-width_adj#,body_height#,0);
italcorr cap_height#*slant-beak_jut#-.25u#;
adjust_fit(cap_serif_fit#,0);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5cap_stem); top y1=cap_height; bot y2=0;
filldraw stroke z1e--z2e; % stem
pickup crisp.nib; pos3(slab,90); pos4(hair,0);
top y3r=cap_height; x3=x1; rt x4r=hround(w-.75u); y4=good.y(y3l+beak)+eps;
if serifs: armup(3,4,e,beak_darkness,beak_jut);  % upper arm and beak
else: x21=x4; y21=y3; rt x22r=rt x21; x22'=x22; y22'=top y21r; y22=top y21r+slab; pos21(slab,90); pos22(slab,0); pos22'(slab,0);
  filldraw stroke z3e--z21e; filldraw stroke z22e--z22'e;
fi
pos5(cap_bar,-90); pos6(hair,0);
top y5l=vround(.5[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-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
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(0,1,2,3,4,5,6,7,8,9); endchar;

cmchar "The letter A modified";
beginchar(oct"255",13u#+2cap_stem#,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 =.5y0;
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,.6inner_jut)(dark);  % left serif
 dish_serif(4',3,c,1/2,.6inner_jut,d,1/3,outer_jut); fi  % right serif
x99=.5[x5,x6]; y99=y5; pos99(.5cap_stem,0); pos98(.5cap_stem,0);
x98=x99; bot y98=0; filldraw stroke z98e--z99e;
if serifs: dish_serif(98,99,e,1/3,.6inner_jut,f,1/3,.6inner_jut); fi
penlabels(0,1,2,3,4,5,6); endchar;

cmchar "The Old Bulgarian letter YUS";
beginchar(oct"322",18u#,cap_height#,0);
italcorr cap_height#*slant+.25u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
pickup tiny.nib;
x1l=w-x2r=.2w;
pos1(cap_stem,0); pos2(cap_hair,0); top y1=h; y2=y1;
x3=.5[x1,x2]; x4=x3; bot y4=0; pos3(cap_stem,0); pos4(cap_stem,0);
pos5(cap_stem,0); x5=x3;
bot y5=.52h; %top y5=x_height; 
z3l=whatever[z1l,z5l]; z3r=whatever[z5r,z2r];
x5'r=x5r; y5'=y5; pos5'(cap_hair,0);
filldraw stroke z1e--z5e;
filldraw stroke z5'e--z2e; filldraw stroke z3e--z4e;
if serifs: pos0(cap_stem,180); pos8(cap_curve,180); pos9(vair,-90); pos10(hair,0);
  x7=x3; y7r=bot y5; x6=1/3[x4,x8]; y6=y7; pos6(vair,-90); pos7(vair,-90);
  x11=w-x6; pos11(vair,-90); y11=y6;
  pos12(cap_stem,0); pos13(cap_curve,0); pos14(vair,-90); pos15(hair,180);
  lft x0r=lft x8r=hround(w-3.5u-.5cap_curve); x12r=x13r=w-x8r;
  y8=y13=1/3[y4,y7]; y0=y12=3/6[y4,y7]; x9=.5[x8l,x10r]; x14=w-x9;
  bot y9r=-o; y14=y9; rt x10r=hround(w-.05u); x15=w-x10; y10=y15=1/4[y4,y7];
  filldraw stroke
    z15e{down}..{right}z14e....z13e---z12e..{right}z11e--z6e{right}..z0e---z8e
    ....z9e{right}..{up}z10e;
 dish_serif(4,3,c,1/3,.75cap_jut,d,1/3,.75cap_jut); 
else:
  penpos9(cap_stem,0); penpos14(cap_stem,180); x9r=hround(w-.5u); x14=w-x9;
  y9=y14=0; penpos10(cap_stem,0); penpos15(cap_stem,180); penpos13(cap_stem,90);
  top y13r=.52h; x13=x4; x10=x13+.2w; y10=y15=.8y13; x15=w-x10;
  fill z13l{right}...{z9l-z10l}z10l--diag_end(10l,9l,.5,1,9r,10r)--z10r{z10r-z9r}...{left}z13r--cycle;
  fill z13l{left}...{z14l-z15l}z15l--diag_end(15l,14l,.5,1,14r,15r)--z15r{z15r-z14r}...{right}z13r--cycle;
fi
x20=x1r; x21=x2l; top y20r=top y21r=h; pos20(slab,90); pos21(slab,90);
filldraw stroke z20e--z21e;
endchar;
