%
% lgsladu.mf
%
%% Cyrillic font container with T2 encoding beta-support
%
% This file is future part of lxfonts package
% Version 3.2 // Patchlevel=0
% (c) O.Lapko
%
% This package belongs to the public domain under conditions similar to
% those of D. E. Knuth specified for the Computer Modern family of fonts.
% In particular, only the authors are entitled to modify this file
% and to save it under the same name.
%
% Content:
%
% Upercase Old Slav letters not included in Unicode
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% List of letternames
%
% VL_YUS
% IZH_uml
% I_A
% OLG
% ONG
% OERY
% OHRDSN
% OCH
% OSHCH
% OO_cdot
% OO_cddot
%
% VFITA
% VI_A
% VKOPPA
%

LHver_check(3,2);  % like |version_check| in ec

lhchar "Uppercase Cyrillic letter VL_YUS - like crossed Delta";
cyrchar(VL_YUS,13u#+2cap_stem#,cap_height#,0);
if is_small_cap: getcharcode(Vl_yus); fi
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+.5u; y1=y4=0; %+outer_jut
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; % middle bar line
penpos5'(whatever,angle(z2-z1)); z5'=whatever[z1,z2];
penpos6'(whatever,angle(z3-z4)); z6'=whatever[z3,z4]; y6'=y5';
bot y5'l=0; y5'r-y5'l=y6'r-y6'l=slab;
penstroke z5'e--z6'e; % bar line
penlabels(0,1,2,3,4,5,5',6,6'); endchar;
%
% for shape, see Knizhnay Shrift p 58  Bodoni, Parma 1818
lhchar "Uppercase Cyrillic letter IZH_uml - IZHITSA umlaut";
cyrchar(IZH_uml,13u#,cap_height#+acc_height#,0);
if is_small_cap: getcharcode(izh_uml); fi
italcorr cap_height#*slant+.25u#;
adjust_fit(cap_serif_fit#,
 if serifs: min(1.5u#,.5u#+(flare#+(cap_stem#-stem#))) %ccL_adj
 else:.5u#fi);
full_h:=h; h:=cap_height;
% upper_izh;
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=l+letter_fit+outer_jut+.25u; y1=y4=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];
x6=if serifs:.5[x5,x7r] else:x7r fi;
penpos6(vair,90); y6r=h if serifs:+o fi;
penpos5(alpha*right_stem,0);
y5=min(.9cap_height,bot y6l-.5vair); z5=whatever[z3,z4];
x7r=hround(r-.5u); penpos7(hair,0);
y7=h-vround max(.05fig_height+.5flare,.1fig_height-.5flare)+o; z8r=z7r;
penpos8(flare,0); if serifs: cyrbulb(6,7,8); fi
if y0>cap_notch_cut: y0:=cap_notch_cut;
 fill z0+.5right{up}...{z4-z3}z5l...{right}
      if serifs: z6r--z6l
      else:
         (.5[x4,x4r],y6r)--(fine.lft x6r,y6r)..(x6r,fine.bot y6r)--
         (x6l,fine.top y6l)..(fine.lft x6l,y6l) fi
  {left}
  ....z5r{z3-z4}--diag_end(4r,3r,1,1,2l,1l)--diag_end(2l,1l,1,1,1r,2r){z2-z1}
  ...{down}z0+.5left--cycle; % left and right diagonals
else: fill z0--z5l{z4-z3}...{right}z6r--z6l{left}...{z3-z4}z5r
  --diag_end(4r,3r,1,1,2l,1l)
  --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);
 if rt x1'r+cap_jut+.5u+1<=x4l-cap_jut: inner_jut=cap_jut;
  else: rt x1'r+inner_jut+.5u+1=x4l-inner_jut; fi
 dish_serif(1',2,a,1/3,outer_jut,b,1/2,inner_jut); fi % left serif
%%%%%
% the accent
h:=full_h; uppercase_umlaut(.5[x1,x4]-.5w,0, 9,10,11,12);
penlabels(0,1,2,3,4,5,6,7,8, 9,10,11,12); endchar;

lhchar "Uppercase Cyrillic letter ligature I_A - IOT A";
cyrchar(I_A,12u#,cap_height#,0);
if is_small_cap: getcharcode(i_a); fi
italcorr max(1/3x_height#*slant,x_height#*slant+.5(.2[hair#,stem#])-u#);
adjust_fit(if monospace: 6.5u# else:
        max(5u#+.5cap_stem#,6u#)+cap_serif_fit# fi, %Ipart_adj
 cap_serif_fit#); pickup fine.nib;
forsuffixes $=hair,stem: shaved$:=mfudged$; save $; $=shaved$; endfor
pickup tiny.nib; numeric light_stem; light_stem=fudged.cap_stem;
% a_part of lowercase ae
pos1(light_stem,0); pos2(light_stem,0);
penpos6(vair-fine,-225); penpos4(cap_curve-fine,-180);
rt x1r=rt x2r=hround(w-max(2u,3u-.5light_stem));
if serifs: top y1=h+min(o,serif_drop); else: top y1=h; fi
bot y2=0; y3=.52h; x6=x1; y6+bar+eps=min(8h,h-max(bracket,.5slab));
penpos5(vair'-fine,-90); penpos3(thin_join-fine,0);
pickup fine.nib; lft x3l=tiny.lft x1l;
lft x4r=hround(1.5u-.5cap_curve); x5=.5[x4,x3];
y4=.3[y5,y1]; bot y5r=-o;
filldraw stroke z6e{3(x4-x1),y4-y1}...pulled_arc.e(4,5)
 & pulled_arc.e(5,3);  %  bowl of a
pickup tiny.nib;
filldraw stroke z1e--z2e;  % stem
if serifs: sloped_serif.l(1,2,a,1/3,cap_jut,serif_drop);  % upper serif
 serif(2,1,d,1/3,cap_jut); fi % lower serif
%I_part(6);
_zero:=6;
_one:=7; _two:=8; _three:=9; _four:=10;
%
pickup tiny.nib; pos[_one](cap_stem,0); pos[_two](cap_stem,0);%pos
lft x[_one]l=lft x[_two]l=
	l+letter_fit+if monospace:-.35u else: cap_serif_fit fi
	+hround max(2u,3u-.5cap_stem);
top y[_one]=h; bot y[_two]=0;
filldraw stroke z[_one]e--z[_two]e; % stem
x[_three]=x[_one]; y[_three]=y[_zero];
x[_four]=x[_zero]; y[_four]=y[_three];
pos[_three](cap_bar,90); pos[_four](cap_bar,90);
filldraw stroke z[_three]e--z[_four]e; % bar
if serifs: dish_serif([_one],[_two],s,1/3,cap_jut,t,1/3,cap_jut);
 dish_serif([_two],[_one],u,1/3,cap_jut,v,1/3,cap_jut); fi
%%%%%
penlabels(0,1,2,3,4,5,6, 7,8,9,10); endchar;

lhchar "Uppercase Cyrillic letter ligature OLG - Old soft EL (ELGHE)";
cyrchar(OLG,13.5u#,cap_height#,0); % DL_width:N_width
if is_small_cap: getcharcode(Olg); fi;
italcorr cap_height#*slant-beak_jut#; %Gamma+.25u
adjust_fit(cap_serif_fit# if not serifs:+.5(cap_stem#-u#) fi, %DL_adj
 if not serifs:.5u#+ fi
        min(4.5u#-.5stem#,3.5u#)-.5width_adj#); % Beak_adj+.5u
% upper_l;
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
rt x1r=rt x2r=w-hround max(2u,3u-.5cap_stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; %stem
numeric bulb_diam; bulb_diam=flare+(cap_stem-stem);
numeric light_hair,bot_vair,left_jut;
light_hair=max(tiny.breadth,fudged.hair if hefty:-4stem_corr fi);
left_jut=
   if serifs: max(limit_dist,1.1cap_jut)
   else:      hround (w+cap_serif_fit-rt x2r-.65u) fi;
bot_vair=Vround(.5[vair,light_hair]);
x3=1/3[w-rt x1r-(1/6left_jut),rt x1r] if not serifs:-.5(cap_stem-u) fi+eps;
if serifs:
 pos3(light_hair,0); pos4(light_hair,-90);
 pos6(bulb_diam,-180); pos5(cap_hair,-180);
 top y3=h; y6=1/6h-max(0,flare-stem-2vair_corr-.5); z6r=z5r;
 lft x6r=l+letter_fit+hround(.5u-.5);
 x4=max(lft x5r+.5bulb_diam,.4[lft x5r,rt x3r]); bot y4r=-o;
 filldraw stroke z4e{right}..
  controls (min(15/16[x4,x3],max(x4,lft x6r+2flare-eps))+(x3e-x3),y4e)
  and (x3e,good.y(min(y6-.5,1/3h-eps)+1/3(y4e-y4)))..z3e; % left tail
 {{less_tense; bulb(4,5,6)}};
else:
 pos3'(slab,90); pos1'(slab,90);
 lft x3'=x3-.5light_hair; rt x1'=x1r; top y3'r=top y1'r=h;
 filldraw stroke z3'e--z1'e;
 pickup fine.nib; pos3(max(fine.breadth,light_hair),0); pos4(bot_vair,-90); pos5(bot_vair,-90);
 bot y5r=0; x4=2/3[x3l,x5r]; lft x5=l+letter_fit+hround(.35u-.5);
 bot y4r=bot y5r; y3=y3'; x4l:=.25[x4,x5];
 path p;
 p=stroke z3{down}
   ..controls (x3,y5+.35h-eps) and (min(7/8[x4,x3],x5+2.5light_hair+.5u),y4)
   ..{left}z4--z5;
 z6=point .35 of p;
 pos6(max(fine.breadth,7/8[bot_vair,light_hair]),angle(direction .35 of p)+90);
 filldraw stroke z3e{down}...z6e{direction .35 of p}...{left}z4e--z5e; fi % arc
%%%
if serifs: x0=x3; y0=0; numeric inner_jut; inner_jut=.5(x1l-x3r)+.5crisp+eps;
 dish_serif(2,1,a,1/3,cap_jut,b,1/3,.5cap_jut);   %!!!%lower right serif
 nodish_serif(1,2,c,1/3,inner_jut,d,1/3,cap_jut);   %upper right serif
 nodish_serif(3,0,e,1/3,1.05cap_jut,f,1/3,inner_jut); fi %upper left serif
%%%%%
% old upper right beak(2);
pickup if serifs: crisp.nib; else: tiny.nib; fi
pos7(slab,90); top y7r=h; x7=x2; rt x8r=hround(r-.65u);
if serifs: pos8(hair,0); y8=good.y(y7l-beak)-eps;
 arm(7,8,i,beak_darkness,.7beak_jut);  % upper arm and beak
else: pos8(slab,90); y8=y7;
 filldraw stroke z7e--z8e; % horisontal
 pickup fine.nib; pos9(.3[slab,cap_stem],0); pos10(.3[slab,cap_stem],0);
 rt x9r=rt x10r=tiny.rt x8r; y9=y8r; bot y10=y8l-sbeak;
 filldraw stroke z9e--z10e; fi % vertical
penlabels(1,2,3,4,5,6,7,8,9,10); endchar;

lhchar "Uppercase Cyrillic letter ligature ONG - Old soft EN (ENGHE)";
cyrchar(ONG,13.5u#,cap_height#,0);
if is_small_cap: getcharcode(Ong); fi;
italcorr cap_height#*slant-beak_jut#; %Gamma+.25u
adjust_fit(cap_serif_fit#,
 if not serifs:.5u#+ fi
        min(4.5u#-.5stem#,3.5u#)-.5width_adj#); % Beak_adj+.5u
% upper_n;
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
 nodish_serif(3,4,e,1/3,inner_jut,f,1/3,.5cap_jut);  %!!!% upper rt serif
 dish_serif(4,3,g,1/3,inner_jut,h,1/3,cap_jut); fi  % lower rt serif
%%%%%
% old upper right beak(4);
pickup if serifs: crisp.nib; else: tiny.nib; fi
pos7(slab,90); top y7r=h; x7=x4; rt x8r=hround(r-.65u);
if serifs: pos8(hair,0); y8=good.y(y7l-beak)-eps;
 arm(7,8,i,beak_darkness,.7beak_jut);  % upper arm and beak
else: pos8(slab,90); y8=y7;
 filldraw stroke z7e--z8e; % horisontal
 pickup fine.nib; pos9(.3[slab,cap_stem],0); pos10(.3[slab,cap_stem],0);
 rt x9r=rt x10r=tiny.rt x8r; y9=y8r; bot y10=y8l-sbeak;
 filldraw stroke z9e--z10e; fi % vertical
penlabels(1,2,3,4,5,6,7,8,9,10); endchar;

lhchar "Uppercase Cyrillic letter OERY - Old ERY";
cyrchar(OERY,12.5u#,cap_height#,0); %V_width#=12.5u#
if is_small_cap: getcharcode(Oery); fi
italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(if not serifs:.5u#+ fi
        min(4.5u#-.5stem#,3.5u#)-.5width_adj#, % Beak_adj+.5u
 cap_serif_fit#+4.5u#); %ERYadj
numeric left_stem; 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
if serifs: nodish_serif(1,2,a,1/3,.5cap_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
% usftsn_bowl(2);
_zero:=2;
_one:=3; _two:=4; _three:=5; _four:=6; _five:=7;
%
pickup tiny.nib;
penpos[_one](cap_bar,90);
penpos[_three](cap_curve if hefty:-3stem_corr fi,0);
penpos[_four](cap_band,-90); penpos[_five](cap_band,-90);
z[_five]r=bot z[_zero]; y[_four]=y[_five];
y[_three]=.5[y[_four],y[_two]];
x[_one]=x[_zero]r; x[_three]r=hround(w-u);
if (serifs=false) or (cap_bar#>.5cap_curve#) or (cap_bar<3):
 penpos[_two](cap_bar,90);
 x[_four]=.5[x[_zero],w-1.5u];
 y[_one]=y[_two]=.52h; x[_two]=x[_four];
else: penpos[_two](1/18[cap_bar,cap_curve],90);
 x[_four]=.5[x[_zero],w-2.5u];
 y[_one]l=y[_two]l-.35cap_bar=.52h-.5cap_bar;
 x[_two]=x[_four]-.35u; fi
x[_two]l:=x[_four]l:=x[_two]-.25cap_curve;
fill stroke z[_five]e..pulled_arc.e([_four],[_three])
 & pulled_arc.e([_three],[_two])..z[_one]e; % lobe
%%%
% old upper left beak(2);
pickup if serifs: crisp.nib; else: tiny.nib; fi
pos8(slab,90); top y8r=h; x8=x2; lft x9r=l+letter_fit+hround.65u;
if serifs: pos9(hair,180); y9=good.y(y8l-beak)-eps;
 arm(8,9,i,beak_darkness,-.7beak_jut);  % upper arm and beak
else: pos9(slab,90); y8=y9;
 filldraw stroke z8e--z9e; % horisontal
 pickup fine.nib; pos10(.3[slab,cap_stem],0); pos11(.3[slab,cap_stem],0);
 lft x10l=lft x11l=tiny.lft x9; y10=y9r; bot y11=y9l-sbeak;
 filldraw stroke z10e--z11e; fi % vertical
% I
w:=w+4.5u; pickup tiny.nib;
rt x13r=rt x14r=w-hround max(2u,3u-.5stem);
top y13=h; bot y14=0; pos13(cap_stem,0); pos14(cap_stem,0);
filldraw stroke z13e--z14e;
if serifs: dish_serif(13,14,e,1/3,cap_jut,f,1/3,cap_jut);
 dish_serif(14,13,g,1/3,cap_jut,h,1/3,cap_jut); fi
penlabels(1,2,3,4,5,6,7,8,9,10,11,12,13,14); endchar;

lhchar "Uppercase Cyrillic letter OHRDSN - Old HARD SIGN";
cyrchar(OHRDSN,12.5u#,cap_height#,0); %V_width#=12.5u#
if is_small_cap: getcharcode(Ohrdsn); fi
italcorr .52*.7cap_height#*slant-.5u#; % D*.52h
adjust_fit(if not serifs:.5u#+ fi
        min(4.5u#-.5stem#,3.5u#)-.5width_adj#, % Beak_adj+.5u
 0);
numeric left_stem; 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
if serifs: nodish_serif(1,2,a,1/3,.5cap_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
% usftsn_bowl(2);
_zero:=2;
_one:=3; _two:=4; _three:=5; _four:=6; _five:=7;
%
pickup tiny.nib;
penpos[_one](cap_bar,90);
penpos[_three](cap_curve if hefty:-3stem_corr fi,0);
penpos[_four](cap_band,-90); penpos[_five](cap_band,-90);
z[_five]r=bot z[_zero]; y[_four]=y[_five];
y[_three]=.5[y[_four],y[_two]];
x[_one]=x[_zero]r; x[_three]r=hround(w-u);
if (serifs=false) or (cap_bar#>.5cap_curve#) or (cap_bar<3):
 penpos[_two](cap_bar,90);
 x[_four]=.5[x[_zero],w-1.5u];
 y[_one]=y[_two]=.52h; x[_two]=x[_four];
else: penpos[_two](1/18[cap_bar,cap_curve],90);
 x[_four]=.5[x[_zero],w-2.5u];
 y[_one]l=y[_two]l-.35cap_bar=.52h-.5cap_bar;
 x[_two]=x[_four]-.35u; fi
x[_two]l:=x[_four]l:=x[_two]-.25cap_curve;
fill stroke z[_five]e..pulled_arc.e([_four],[_three])
 & pulled_arc.e([_three],[_two])..z[_one]e; % lobe
%%%
% old upper left beak(2);
pickup if serifs: crisp.nib; else: tiny.nib; fi
pos8(slab,90); top y8r=h; x8=x2; lft x9r=l+letter_fit+hround.65u;
if serifs: pos9(hair,180); y9=good.y(y8l-beak)-eps;
 arm(8,9,i,beak_darkness,-.7beak_jut);  % upper arm and beak
else: pos9(slab,90); y8=y9;
 filldraw stroke z8e--z9e; % horisontal
 pickup fine.nib; pos10(.3[slab,cap_stem],0); pos11(.3[slab,cap_stem],0);
 lft x10l=lft x11l=tiny.lft x9; y10=y9r; bot y11=y9l-sbeak;
 filldraw stroke z10e--z11e; fi % vertical
penlabels(1,2,3,4,5,6,7,8,9,10,11); endchar;

lhchar "Uppercase Cyrillic letter OCH - Old CHE";
cyrchar(OCH,13.5u#,cap_height#,0); % N_width
if is_small_cap: getcharcode(Och); 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);
numeric middle_weight; middle_weight=.5[vair,cap_band];
pos5(middle_weight,90); pos6(middle_weight,-90);
lft x1l=lft x2l=hround max(2u,3u-.5cap_stem); x3=x4=w-x1;
top y1=top y3=h; bot y2=bot y4=.3[y6,h]; x5l=x6=x7=.5[x1,x3]; z5=z6;
y6=good.y (h-.52h if serifs: -.35(.5[cap_hair,.7cap_stem]) fi);
filldraw stroke z1e--z2e & pulled_arc.e(2,5);
filldraw stroke pulled_arc.e(6,4) & z4e--z3e; % U
pos6'(cap_stem,0); pos7(cap_stem,0); top z6'=z6; bot y7=0;
filldraw stroke z6'e--z7e; % stem
if serifs: pickup tiny.nib; numeric inner_jut,fit; fit=.5u+1;
 if rt x1r+cap_jut+fit<=lft x3r-cap_jut: inner_jut=cap_jut;
  else: rt x1r+inner_jut+fit=lft x3r-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 left serif
 dish_serif(7,6,g,1/3,inner_jut,h,1/3,cap_jut); fi % lower left serif
penlabels(1,2,3,4,5,6,7); endchar;

lhchar "Uppercase Cyrillic letter OSHCH - Old SHCHA";
cyrchar(OSHCH,19.7u#+width_adj#,cap_height#,cap_sbeak#);
if is_small_cap: getcharcode(Oshch); fi
italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(cap_serif_fit#,if serifs: cap_serif_fit# else: -.3u#+.1tiny# fi);
if odd(fudged.cap_stem-w): change_width; fi % symmetric & all three equal
% upper_sh;
pickup tiny.nib;
pos1(fudged.cap_stem,0); pos2(fudged.cap_stem,0);
pos3(fudged.cap_stem,0); pos4(fudged.cap_stem,0);
pos5(fudged.cap_stem,0); pos6(fudged.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; z5=.5[z1,z3]; z6=.5[z2,z4];
filldraw stroke z1e--z2e; % left stem
filldraw stroke z3e--z4e; % right stem
filldraw stroke z5e--z6e; % center stem
if serifs: numeric inner_jut;
 if rt x1r+cap_jut+.5u+1<=lft x5l-cap_jut: inner_jut=cap_jut;
  else: rt x1r+inner_jut+.5u+1=lft x5l-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
 dish_serif(5,6,i,1/3,inner_jut,j,1/3,inner_jut); % upper center serif
 inner_jut:=.5(x3l-x5r)+.5crisp+eps;
 nodish_serif(2,1,c,1/3,cap_jut,d,1/3,inner_jut); % lower left serif
 nodish_serif(6,5,k,1/3,inner_jut,m,1/3,inner_jut); % lower center serif
 nodish_serif(4,3,g,1/3,inner_jut,h,1/3,cap_jut);   % lower right serif
else: lft x2'= lft x2l; bot y2'l=0; pos2'(slab,90);
 rt x4'=rt x4r; y4'=y2'; pos4'(slab,90); filldraw stroke z2'e--z4'e; fi
% middle serif
pickup tiny.nib; x7=x6; bot y7=-d;
if serifs: numeric light_hair;
 light_hair=min(fudged.stem,fudged.hair if hefty:-4stem_corr fi);
 pos7(light_hair,0);
 filldraw stroke z6e....{down}z7e;
else: pos7(fudged.cap_stem,0);
 filldraw stroke z6e--z7e; fi % middle serif
penlabels(1,2,3,4,5,6); endchar;

lhchar "Uppercase Cyrillic letter OO_cdot - Old O cdot";
cyrchar(OO_cdot,15u#,cap_height#,0); %F width-u
if is_small_cap: getcharcode(Oo_cdot); fi
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: if serifs: interim superness:=1.05 superness;
 else: interim superness:=1.075 superness; fi 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
% dot
pickup tiny.nib;
dot_diam:=min((lft x4l-rt x2l)-1,
max(tiny.breadth,hround(max(dot_size,cap_curve)-2stem_corr)));
pos5(dot_diam,0); pos5'(dot_diam,90);
z5=z5'; x5=x1; y5=.5[y1,y3]; dot(5,5'); % dot
penlabels(1,2,3,4, 5,5); endchar;

lhchar "Uppercase Cyrillic letter OO_cddot - Old double cdot";
cyrchar(OO_cddot,17u#,cap_height#,0); %F width+u
if is_small_cap: getcharcode(Oo_cddot); fi
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: if serifs: interim superness:=1.05 superness;
 else: interim superness:=1.075 superness; fi 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
%
_one:=5; _two:=6; _three:=7; _four:=8;
dot_diam:=min(.5(lft x4l-rt x2l)-1,
max(tiny.breadth,hround(max(dot_size,cap_curve)-2stem_corr)));
pickup tiny.nib;
pos[_one](dot_diam,0); pos[_two](dot_diam,90);
x[_one]=x[_two]=max(x2l+.5dot_diam+1+eps,.5w-2.25u); y[_one]=y[_two]=.5[y1,y3];
dot([_one],[_two]);  % left dot
pos[_three](dot_diam,0); penpos[_four](y[_two]r-y[_two]l,90);
y[_three]=y[_four]=y[_one];
x[_three]=x[_four]=min(x4r-.5dot_diam-1-eps,x[_one]+4u);
dot([_three],[_four]);  % right dot
penlabels(1,2,3,4, 5,6,7,8); endchar;

% like tilded O
lhchar "Uppercase Cyrillic letter VFITA";
cyrchar(VFITA,14u#-width_adj#,cap_height#,0);
if is_small_cap: getcharcode(Vfita); fi
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
%tilde
pickup fine.nib; numeric bar[]; bar1=cap_bar; z5=z2l; z6=z4l;
penpos5(bar1,90); penpos6(bar1,90);
if serifs: bar2=.5[cap_bar,cap_curve];
 if cap_bar#>.5curve#: fill stroke z5e--z6e; else:
 penpos7(bar2,90); z7=.5[z5,z6];
 fill stroke z5e{1,1}..{1,-1}z7e..{1,1}z6e; fi
else: fill stroke z5e--z6e; fi
penlabels(1,2,3,4,5,6,7); endchar;

% A from AE
lhchar "Uppercase Cyrillic letter ligature VI_A - IOT A";
cyrchar(VI_A,11u#,cap_height#,0);
if is_small_cap: getcharcode(Vi_a); fi
italcorr cap_height#*slant-beak_jut#-.5u#;
adjust_fit(.5u#+
        if monospace: 6.5u# else:
        max(5u#+.5cap_stem#,6u#)+cap_serif_fit# fi, %Ipart_adj+.5u
 cap_serif_fit#);
numeric left_stem,amid_stem,outer_jut,alpha;
amid_stem=max(tiny.breadth,hround .9[mfudged.hair,mfudged.cap_stem]);
pickup tiny.nib; pos1(amid_stem,0); pos2(amid_stem,0);
rt x1r=rt x2r=hround(w-max(2u,3u-.5amid_stem));
top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
pos5(cap_bar,-90); z0=z5;
x5=x1; top y5l=vround(if hefty:.52 else:.48 fi\\[y2,y1]+.5cap_bar);
left_stem=if monospace:fudged.hair else: cap_hair fi if hefty: -3stem_corr fi;
outer_jut=.8cap_jut; x11l=l+letter_fit
+if monospace: 6u else: max(4.75u+.5cap_stem,5.75u) fi+eps+outer_jut+.5u; y11=0;
x12=x1l-apex_corr-if monospace:2 fi\\u; y12=h;
alpha=diag_ratio(1,.5left_stem,y12-y11,x12-x11l);
penpos11(alpha*left_stem,0); penpos12(alpha*left_stem,0);
fill diag_end(12l,11l,1,1,11r,12r)
 --diag_end(11r,12r,1,1,12l,11l)--cycle; % diagonal
y10=h-slab; z10=whatever[z11,z12];
fill z10--(x1,y10)--(x1,h)--z12--cycle;  % link
penpos13(whatever,angle(z2-z1)); z13=whatever[z11,z12];
penpos14(cap_band,90); x14=x0; y13l=y14l; y13r=y14r;
if hefty: y14r=.4h; else: y14=y0; fi
penstroke z13e--z14e; % bar line
if serifs: numeric inner_jut; pickup tiny.nib;
 prime_points_inside(11,12);
 if rt x11'r+cap_jut+.5u+1<=lft x2l-.75cap_jut: inner_jut=cap_jut;
 else: rt x11'r+inner_jut+.5u+1=lft x2l-.75inner_jut; fi
 dish_serif(11',12,i,1/2,outer_jut,j,.6,inner_jut)(dark);  % lower left serif
 nodish_serif(1,2,a,1/3,cap_jut+x1l-x12,b,1/3,cap_jut);  % upper serif
 nodish_serif(2,1,c,1/3,.75inner_jut,d,1/3,cap_jut); fi  % lower middle serif
%
z15=whatever[z11,z12]; y15+.5bar+eps=min(8h,h-max(bracket,.5slab))-eps;
%I_part(15);
_zero:=15;
_one:=16; _two:=17; _three:=18; _four:=19;
%
pickup tiny.nib; pos[_one](cap_stem,0); pos[_two](cap_stem,0);%pos
lft x[_one]l=lft x[_two]l=
	l+letter_fit+if monospace:-.35u else: cap_serif_fit fi
	+hround max(2u,3u-.5cap_stem);
top y[_one]=h; bot y[_two]=0;
filldraw stroke z[_one]e--z[_two]e; % stem
x[_three]=x[_one]; y[_three]=y[_zero];
x[_four]=x[_zero]; y[_four]=y[_three];
pos[_three](cap_bar,90); pos[_four](cap_bar,90);
filldraw stroke z[_three]e--z[_four]e; % bar
if serifs: dish_serif([_one],[_two],s,1/3,cap_jut,t,1/3,cap_jut);
 dish_serif([_two],[_one],u,1/3,cap_jut,v,1/3,cap_jut); fi
%%%%%
penlabels(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19); endchar;

iff serifs:%
lhchar "Uppercase Cyrillic letter VKOPPA - Variant KOPPA (C with tail)";
cyrchar(VKOPPA,14u#,cap_height#,cap_sbeak#);
 if is_small_cap: getcharcode(Vkoppa); fi
 italcorr cap_height#*slant-1.5u#-.5cap_serif_fit#;
 adjust_fit(0,0);
 pickup tiny.nib; pos0(cap_stem,0); pos7(cap_stem,0);
 rt x0r=hround(w-2u); y0=good.y(.1[bar_height,x_height]+1); x7=x0;
 pickup fine.nib; bot y7=-d; pos5(cap_stem,0); x5=x0; top y5=tiny.top y0;
 pos1(cap_hair,0); pos2(cap_band,90);
 pos3(cap_curve,180); pos4(cap_band,270);
 rt x1r=hround(w-2u); lft x3r=hround u; x2=x4=.55[x3,x1];
 top y2r=h+o; bot y4r=-o; y3=.5[y2,y4];
 bot y1=min(vround max(.6h,x_height-.5vair),bot y2l-eps);
 (x2l',y2l)=whatever[z2r,z1l]; x2l:=min(x2l',x2l+.5u);
 (x4l',y4l)=whatever[z4r,z5l]; x4l:=min(x4l',x4l+.5u);
 filldraw stroke z1e{x2-x1,10(y2-y1)}
  ...pulled_arc.e(2,3) & pulled_arc.e(3,4)...z5e{up}; % arc
 pos6(.3[fine.breadth,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
 pickup tiny.nib; filldraw stroke z0e--z7e;  % stem
 serif(0,7,a,1/3,-max(cap_jut,2.25u));  % serif
 dish_serif(7,0,c,1/3,cap_jut,d,1/3,.7cap_jut);  % lower serif
penlabels(0,1,1',2,3,4,5,6,7); endchar;

iff not serifs:%
lhchar "Uppercase Cyrillic letter VKOPPA - Variant KOPPA (C with tail)";
cyrchar(VKOPPA,12u#,cap_height#,cap_sbeak#);
 if is_small_cap: getcharcode(Vkoppa); fi
 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,270);
 rt x1r=hround(w-1.35u); x2=x4=.5w+u;
 lft x3r=hround max(u,2u-.5cap_curve); rt x5l=hround(w-1.2u);
 top y1r=vround .93h+o; top y2r=h+o; y3=.5h;
 bot y4r=-o; bot y5r=vround .07h-o;
 filldraw stroke rterm.e(2,1,right,.9,4)&super_arc.e(2,3)
  & super_arc.e(3,4) & term.e(4,5,right,1,4); % arc and terminals
 pos0(stem,0); pos7(stem,0);
 x7r=x5r; y7=-d; x0=x7; top y0=1+vround .35[bar_height,x_height];
 filldraw stroke z0e--z7e;  % stem
 pos8(cap_bar,90); pos9(cap_bar,90); z0r=z9r; y8=y9; lft x8=hround x4;
 filldraw stroke z8e--z9e;  % bar
penlabels(0,1,1',2,3,4,5,6,7,8,9); endchar;
