%
% lgt2slxu.mf
%
%% Cyrillic font container with T2 encoding beta-support
%
% This file is future part of lxfonts package
% Version 3.4 // Patchlevel=1
% (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:
%
% Uppercase Old Slav letters
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% List of letternames
%
% VNARROW_E
% ZELO
% VUK
% VI_A     upper
% IZH_dgr
% VL_YUS
% IZH_uml
% OLG
% OERY
% OHRDSN
% OO_cdot
% OO_cddot
% VIZH
% T_peter
% ZELO_m
%

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

iff serifs:%
lhchar "Uppercase Cyrillic letter variant NARROW_E - like Ukrainian E";
cyrchar(VNARROW_E,13u#,cap_height#,0);
if is_small_cap: getcharcode(vnarrow_e); fi
italcorr cap_height#*slant-.5u#;
adjust_fit(0,0);
% upper_ukre;
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=.5h-vair_corr; y3l:=.52h;
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_super_arc.e(2,3)(.5superpull)
 & pulled_super_arc.e(3,4)(.5superpull)...{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
% upukre_bar;
numeric bar[]; y7=y8=y3;
x7=x3l; x8=(min(lft x1l-.5hair,0.85[x3l,x1l]));
if (serifs=true) and (bar#<=.5curve#):
 penpos7(cap_bar,90); penpos8(cap_bar,90);
 bar2=7/8[cap_bar,fudged.cap_stem-3stem_corr];
 penpos9(bar2,45); z9=.575[z7l,z8l];
 fill circ_stroke z8e{-2,-1}..{-2,1}z9e..{-2,-1}z7e; % curve /\/
else:
 pickup fine.nib; pos7(cap_bar,90); pos8(cap_bar,90);
 filldraw stroke z7e--z8e; fi % bar --
%%%%%
penlabels(1,1',2,3,4,5,6); endchar;

iff not serifs:%
lhchar "Uppercase Cyrillic letter variant NARROW_E - like Ukrainian E";
cyrchar(VNARROW_E,11.5u#,cap_height#,0);
if is_small_cap: getcharcode(vnarrow_e); fi
italcorr cap_height#*slant-.5u#;
adjust_fit(0,0);
% uppers_ukre;
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);
% uukres_bar;
numeric bar[]; y6=y7=y3; x6=x3l; x7=(min(lft x1l-.5hair,0.85[x3l,x1l]));
pickup fine.nib;
bar1=if is_small_cap:max(fine.breadth+eps,.6[thin_join,vair]) else: cap_bar fi;
pos6(bar1,90); pos7(bar1,90);
filldraw stroke z6e--z7e; % bar --
%%%%%
penlabels(1,1',2,3,4,5,6); endchar;

lhchar "Uppercase Cyrillic letter ZELO";
cyrchar(ZELO,11u#,cap_height#,cap_sbeak#);
if is_small_cap: getcharcode(zelo); fi
italcorr cap_height#*slant-.5u#;
adjust_fit(0,0);
numeric arm_thickness[],z_stem;
if hefty: arm_thickness1=Vround(slab-vair_corr); arm_thickness2=slab;
 z_stem=.8[vair,cap_stem];
else: arm_thickness1=slab; arm_thickness2=cap_band;%vround(slab+vair_corr);
 z_stem=.9[vair,cap_stem]; fi
pickup tiny.nib; x3l-.75u=x4l-.75u=w-x1r=w-x2r; lft x3l=hround 1.75u;
top y1=h; y2=min(y1,h-2/3arm_thickness1);
bot y4=1/6h; y3=max(y4,2/3arm_thickness2);
numeric alpha; alpha=diag_ratio(1,z_stem-tiny,y2-y3,x2r-x3l);
penpos1(alpha*(z_stem-tiny),0); penpos2(alpha*(z_stem-tiny),0);
penpos3(alpha*(z_stem-tiny),0); penpos4(alpha*(z_stem-tiny),0);
pair delta; delta=penoffset z3-z2 of currentpen;
fill top lft z1l--z2l+delta---z3l+delta..lft z3l---lft z4l..bot z4l
 ---bot rt z4r--z3r-delta---z2r-delta..rt z2r---rt z1r..top z1r
 ---cycle;  % diagonal
pickup crisp.nib; pos5(arm_thickness1,90); pos6(hair,180);
top y5r=h; x5=x1; lft x6r=hround 1.25u; y6=good.y(y5l-beak)-eps;
arm(5,6,a,beak_darkness**.8,-.4beak_jut);  % upper arm and beak
if not serifs: pickup fine.nib; fi
pos7(arm_thickness2,-90); pos8(max(currentbreadth+eps,.7[thin_join,vair]),180);
bot y7r=tiny.bot y4; x7=x4r; x0=w+1.5u; y0=y7l;
z8l=z0+whatever*(z2-z3); bot y8=-d-o;
path p; p=(z7l{right}.. .45[z0,.5[z7,z8]] ..{z3-z2}z8l);
z9=point 1 of p; pos9(cap_curve,angle(direction 1 of p)-90);
filldraw stroke z7e{right}...z9e{z8-z7}...{z3-z2}z8e; % tail
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6,7,8,9); endchar;

lhchar "Uppercase Cyrillic letter VUK -- Variant UK";
cyrchar(VUK,14u#-width_adj#,cap_height#+acc_height#,0);
if is_small_cap: getcharcode(vuk); fi
italcorr .7cap_height#*slant-.5u#; %O
h:=.8cap_height;
adjust_fit(0,0);
% upper_o;
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
%%%%%
%"hachek"
if serifs:
 penpos14(1.414vair',90); pos15(whatever,0); x14=x1; y14=h+o-eps;
 x1-x15=x16-x1=good.x 4.25u; top y15=top y16=cap_height+.35acc_height+o;
 pos16(.25[vair,cap_curve],angle(z16-z14)+90);
 z15l=z14l+whatever*(z14-z15); z15r=z14r+whatever*(z14-z15);
 filldraw stroke z15e--z14e{z16r-z14}..{.5right}z16e;  % hachek
else:
 pickup fine.nib;
 pos14(hair,0); pos16(hair,0); penpos15(fudged.stem,0);
 x1-x14=x16-x1; y15=h; x15=x1;
 top y14=top y16=cap_height+.5acc_height+o;
 lft x14l=hround(rt x15r-5u-.5vair);
 z0=whatever[z14r,z15r]=whatever[z15l,z16l];
 pair delta[];
 delta1=penoffset z15-z14 of currentpen;
 delta2=penoffset z16-z15 of currentpen;
 fill z15l---z14l+delta1..top z14l---top z14r..z14r-delta1
 ---z0---
 z16l-delta2..top z16l---top z16r..z16r+delta2---z15r--cycle; fi  % hachek
%%%
penlabels(1,2,3,4,14,15,16); endchar;

lhchar "Uppercase Cyrillic letter OT";
% 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=outer_jut+.5u-eps; 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+.5cap_bar+eps=min(8h,h-max(1.2slab,bracket))-1-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;

% for shape, see Knizhnay Shrift p 58  Bodoni, Parma 1818
lhchar "Uppercase Cyrillic letter IZH_dgr - IZHITSA double grave";
cyrchar_twice(IZH_dgr,13u#,cap_height#+acc_height#,0);
if is_small_cap: getcharcode(izh_dgr); 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
if monospace:
 hpos_corr=-2u; put_gravis(cyrcaph);
 hpos_corr=2u; put_gravis(cyrcaph);
else: hpos_corr=-1.5u; put_gravis(cyrcaph);
 hpos_corr=1.5u; put_gravis(cyrcaph); fi
repeat_once;
penlabels(0,1,2,3,4,5,6,7); endchar;

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 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))+(x3e-x3)+eps,y4e)
  and (x3e,good.y(min(y6-.5,1/3h)+1/3(y4e-y4))-eps)..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=min(.5(lft x1l-rt x3r)-eps,.5cap_jut);
 dish_serif(2,1,a,1/3,cap_jut,b,1/3,cap_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); %upper left serif
 filldraw z.c0--z.c1--z.f1--z.f0--cycle; fi % upper inter_serif bar
%%%%%
% (old) upper right beak(2);
if (serifs=false) and (old_cyr=true):
 pickup tiny.nib;
 pos7(slab,90); top y7r=h; x7=x2;
 pos8(slab,90); y8=y7; rt x8r=hround(r-.65u);
 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; % vertical
else:
 pickup crisp.nib;
 pos7(slab,90); top y7r=h; x7=x2; rt x8r=hround(r-.65u);
 pos8(hair,0); y8=good.y(y7l-beak)-eps;
 arm(7,8,i,beak_darkness,.7beak_jut);  % upper arm and beak
fi
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-if serifs:1.5u else:2.5u fi]+.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-1.5u]+.5u;
 y[_one]l=y[_two]l-.35cap_bar=.52h-.5cap_bar;
 x[_two]=x[_four]-.35u; fi
x[_two]l:=x[_two]l-.5u; x[_four]l:=x[_four]l-.5u;
fill stroke z[_five]e..super_arc.e([_four],[_three])
 & super_arc.e([_three],[_two])..z[_one]e; % lobe
%%%
% (old) upper left beak(2);
if (serifs=false) and (old_cyr=true):
 pickup tiny.nib;
 pos8(slab,90); top y8r=h; x8=x2;
 pos9(slab,90); y8=y9; lft x9r=l+letter_fit+hround.65u;
 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; % vertical
else:
 pickup crisp.nib;
 pos8(slab,90); top y8r=h; x8=x2; lft x9r=l+letter_fit+hround.65u;
 pos9(hair,180); y9=good.y(y8l-beak)-eps;
 arm(8,9,i,beak_darkness,-.7beak_jut);  % upper arm and beak
fi
% 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-if serifs:1.5u else:2.5u fi]+.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-1.5u]+.5u;
 y[_one]l=y[_two]l-.35cap_bar=.52h-.5cap_bar;
 x[_two]=x[_four]-.35u; fi
x[_two]l:=x[_two]l-.5u; x[_four]l:=x[_four]l-.5u;
fill stroke z[_five]e..super_arc.e([_four],[_three])
 & super_arc.e([_three],[_two])..z[_one]e; % lobe
%%%
% (old) upper left beak(2);
if (serifs=false) and (old_cyr=true):
 pickup tiny.nib;
 pos8(slab,90); top y8r=h; x8=x2;
 pos9(slab,90); y8=y9; lft x9r=l+letter_fit+hround.65u;
 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; % vertical
else:
 pickup crisp.nib;
 pos8(slab,90); top y8r=h; x8=x2; lft x9r=l+letter_fit+hround.65u;
 pos9(hair,180); y9=good.y(y8l-beak)-eps;
 arm(8,9,i,beak_darkness,-.7beak_jut);  % upper arm and beak
fi
penlabels(1,2,3,4,5,6,7,8,9,10,11); 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;

lhchar "Uppercase Cyrillic letter VIZH - variant IZHITSA";
cyrcharmoving(VIZH); if is_small_cap: cyrcharmoving(vizh); fi

lhchar "Uppercase Cyrillic letter T_peter -- like flipped SH";
cyrchar(T_peter,19.75u#+width_adj#,cap_height#,0);
if is_small_cap: getcharcode(t_peter); fi
italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(if monospace: 0,0 else:cap_serif_fit#,cap_serif_fit# fi); %uwlett_adj
% upper_sh;flip
if odd(fudged.cap_stem-w): change_width; fi % symmetric & all three equal
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=top y5=h; bot y2=bot y4=bot y6=0;
lft x5l=lft x6l=hround (.5[x1,x3]-.5cap_stem); % middle stem point
filldraw stroke z1e--z2e; % left stem
filldraw stroke z3e--z4e; % right stem
filldraw stroke z5e--z6e; % center stem
numeric inner_jut,arm_thickness;
arm_thickness=vround(slab+vair_corr);
if serifs:
 begingroup
  save slab; slab:=arm_thickness; % bottom.bar.slab
  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(2,1,c,1/3,cap_jut,d,1/3,inner_jut); % lower left serif
  dish_serif(6,5,k,1/3,inner_jut,m,1/3,inner_jut); % lower center serif
  dish_serif(4,3,g,1/3,inner_jut,h,1/3,cap_jut);   % lower right serif
 endgroup;
 inner_jut:=min(.5(lft x3l-rt x1r)-eps,.5cap_jut);
 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 right serif
 nodish_serif(5,6,i,1/3,inner_jut,j,1/3,inner_jut); % upper center serif
 fill z.b0--z.b1--z.e1--z.e0--cycle; % upper inter_serif bar
else:
 save slab; slab:=arm_thickness; % upper.bar.slab
 lft x2'= lft x2l; top y2'r=h; pos2'(slab,90);
 rt x4'=rt x4r; y4'=y2'; pos4'(slab,90);
 filldraw stroke z2'e--z4'e; fi % upper bar
%%%%%
penlabels(1,2,3,4,5,6); endchar;

lhchar "Uppercase Cyrillic letter ZELO_m - Variant ZELO mirror";
cyrchar(ZELO_m,10u#,cap_height#,0);
if is_small_cap: getcharcode(zelo_m); fi
italcorr .7cap_height#*slant-.5u#; %O
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;
%mirror
forsuffixes $ = 2l,2,2r,3l,3,3r,4l,4,4r,5l,5,5r,6l,6,6r,7l,7,7r:
  x$:=l+(r-x$); endfor;
filldraw stroke super_arc.e(2,3) & z3e{down}
 ..z4e---z5e..z6e{down} & super_arc.e(6,7);  % main stroke mirror
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;
 %mirror
 forsuffixes $ = 1l,1,1r,8l,8,8r: x$:=l+(r-x$); y$:=y$; endfor;
 filldraw stroke z1e{x2-x1,10(y2-y1)}....{right}z2e;  % upper arc mirror
 filldraw stroke z7e{right}....{up}z8e;  % lower arc
 path upper_arc, lower_arc;
 upper_arc=z1{x2-x1,10(y2-y1)}....{right}z2;
 lower_arc=z7{right}....{up}z8;
 pos10(.3[fine.breadth,cap_hair],180); pos9(.3[fine.breadth,cap_hair],180);
 x10r=x1l; top y10=top y2l; x9l=x8r; bot y9=bot y7r;
 x1'-x1l=x8r-x8'=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;
 forsuffixes $ = 1l,1,1r,8l,8,8r: x$:=l+(r-x$); endfor;
 filldraw stroke term.e(2,1,left,.9,4);   % upper arc and terminal
 filldraw stroke term.e(7,8,right,1,4); fi  % lower arc and terminal
penlabels(0,1,1',2,3,4,5,6,7,8,8',9,10); endchar;

lhchar "Uppercase Cyrillic letter IZHEI ";
cyrchar(IZHEI,13.5u#,cap_height#,0); % N_width
if is_small_cap: getcharcode(izhei); 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(fudged.cap_stem,0); pos2(fudged.cap_stem,0);
pos3(fudged.cap_stem,0); pos4(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;
filldraw stroke z1e--z2e; % left stem
filldraw stroke z3e--z4e; % right stem
numeric stem[],alpha[];
y5=vround(.4h-eps); y6=vround(.6h-eps);
x5=hround (rt x1r-.5)-eps; x6=hround (lft x3l+.5)+eps;
stem1=max(tiny.breadth,fudged.hair);
penpos5(stem1,90); penpos6(stem1,90);
fill stroke z5e--z6e; % 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); fi % lower right serif
%%%%%
penlabels(1,2,3,4,5,6); endchar;

lhchar "Uppercase Cyrillic letter LO";
cyrchar(LO,13.5u#,cap_height#,0); % DL_width:N_width
if is_small_cap: getcharcode(lo); fi
italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(cap_serif_fit# if not serifs:+.5(cap_stem#-u#) fi, %DL_adj
 13.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))+(x3e-x3)+eps,y4e)
  and (x3e,good.y(min(y6-.5,1/3h)+1/3(y4e-y4))-eps)..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=min(.5(lft x1l-rt x3r)-eps,.5cap_jut);
 dish_serif(2,1,a,1/3,cap_jut,b,1/3,cap_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); %upper left serif
 filldraw z.c0--z.c1--z.f1--z.f0--cycle; fi % upper inter_serif bar
%%%
%O_part
full_w:=13.5u;
_zero:=2;
_one:=7; _two:=8; _three:=9; _four:=10; _five:=11; _six:=12;
penpos[_one](vair',90); penpos[_three](vround(vair+1.5vair_corr),-90);
penpos[_two](cap_curve,180); penpos[_four](cap_curve,0);
x[_two]r=hround u;
x[_four]r=full_w-x[_two]r; x[_one]=x[_three]=.5full_w; y[_one]r=h+o; y[_three]r=-o;
y[_two]=y[_four]=.5h-vair_corr; y[_two]l:=y[_two]l:=.52h;
%shift
forsuffixes $ = [_one]l,[_one],[_one]r,[_two]l,[_two],[_two]r,
 [_three]l,[_three],[_three]r,[_four]l,[_four],[_four]r: x$:=x$+w; endfor;
penstroke pulled_super_arc.e([_one],[_two])(.5superpull)
 & pulled_super_arc.e([_two],[_three])(.5superpull)
 & pulled_super_arc.e([_three],[_four])(.5superpull)
 & pulled_super_arc.e([_four],[_one])(.5superpull) & cycle;  % bowl
%%%
x[_five]=x[_zero]; y[_five]=y[_two];
x[_six]=x[_two]; y[_six]=y[_five];
pos[_five](cap_bar,90); pos[_six](cap_bar,90);
filldraw stroke z[_five]e--z[_six]e; % bar
%%%%%
penlabels(0,1,2,3,3,4,5,6); endchar;

lhchar "Uppercase Cyrillic letter MO";
cyrchar(MO,16u#+width_adj#,cap_height#,0);
if is_small_cap: getcharcode(mo); fi
italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(cap_serif_fit#,13.5u#);
% upper_m;
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
%%%
%O_part
full_w:=13.5u;
_zero:=4;
_one:=9; _two:=10; _three:=11; _four:=12; _five:=13; _six:=14;
penpos[_one](vair',90); penpos[_three](vround(vair+1.5vair_corr),-90);
penpos[_two](cap_curve,180); penpos[_four](cap_curve,0);
x[_two]r=hround u;
x[_four]r=full_w-x[_two]r; x[_one]=x[_three]=.5full_w; y[_one]r=h+o; y[_three]r=-o;
y[_two]=y[_four]=.5h-vair_corr; y[_two]l:=y[_two]l:=.52h;
%shift
forsuffixes $ = [_one]l,[_one],[_one]r,[_two]l,[_two],[_two]r,
 [_three]l,[_three],[_three]r,[_four]l,[_four],[_four]r: x$:=x$+w; endfor;
penstroke pulled_super_arc.e([_one],[_two])(.5superpull)
 & pulled_super_arc.e([_two],[_three])(.5superpull)
 & pulled_super_arc.e([_three],[_four])(.5superpull)
 & pulled_super_arc.e([_four],[_one])(.5superpull) & cycle;  % bowl
%%%
x[_five]=x[_zero]; y[_five]=y[_two];
x[_six]=x[_two]; y[_six]=y[_five];
pos[_five](cap_bar,90); pos[_six](cap_bar,90);
filldraw stroke z[_five]e--z[_six]e; % bar
%%%%%
penlabels(0,1,1',2,3,3',4,5,6,7,8); endchar;

endinput;
%end of file
