%
% lgcaccl.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:
%
% Lowercase Cyrillic accented letters
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% List of letternames
%
% a_bar
% o_bar
% o_lcom
% u_tld
% u_hat
% u_gr
% u_com
% ery_bar
% erev_uml
% erev_dot
% erev_bar
% yu_bar
% ya_bar
% otld_bar
% y_bar
% eps_uml
%
% l_ldot
% n_ldot
% r_brv
% t_lcom
% ch_ldot
%

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

lhchar "Lowercase Cyrillic letter a_bar";
cyrchar(a_bar,9u#,x_height#+acc_height#,0);
bh#:=min(bar_height#,1.14x_height#-bar_height#); define_pixels(bh);
italcorr 1/3[bh#,x_height#]*slant+.5stem#-serif_fit#-2u#;
adjust_fit(0,serif_fit# if serifs: if hair#+.5stem#>1.5u#:-.25u# fi\\fi);
full_h:=h; h:=x_height;
% lower_a;
pickup fine.nib; top y3r=h+vround 1.5oo;
if serifs: pos1(flare,180); pos2(hair,180);
 pos3(vair,90);  lft x1r=hround max(u,2.1u-.5flare); x3=.5w-.5u;
 y1=min(bh+.5flare+2vair+2,.9[bh,h]-.5flare);
 bulb(3,2,1);  % bulb
else: pos1(5/7[vair,flare],95); x1l=good.x 1.5u; x1r:=good.x x1r;
 pos3(1/8[vair,thin_join],90);
 x3=.5w-.2u; top y1r=vround .82[bh,top y3r];
 filldraw stroke term.e(3,1,left,.9,4); fi  % terminal
pos4(stem,0); rt x4r=hround(w-2.5u+.5stem); y4=1/3[bh,h];
pos5(stem,0); x5=x4; y5=max(.55bh,2vair);
filldraw stroke super_arc.e(3,4)&z4e..z5e;  % arc and stem
pos6(.3[thin_join,vair],90); x6=x4; bot y6=bh;
pos7(hround(curve-2stem_corr),180);
lft x7r=hround max(.5u,1.5u-.5curve); y7=1/3[top y8l,top y6r];
pos8(vair,270); x8l=.5w-.75u; bot y8r=-oo;
pos9(thin_join,360); z9l=z5l; (x,y8r)=whatever[z8l,z9l]; x8r:=max(x,x8-u);
{{interim superness:=more_super;
 filldraw stroke z9e{down}...z8e{left}...{up}z7e&super_arc.e(7,6)}}; % bowl
if serifs: numeric shaved_stem; shaved_stem=hround(stem-3stem_corr);
 if hair#+.5stem#>1.5u#: pickup tiny.nib;
  pos5'(shaved_stem,0); rt x5'r=fine.rt x5r; y5'=y5;
  pos10(shaved_stem,0); x10=x5'; y10=.2[.5tiny,bh];
  pos11(shaved_stem,0); rt x11r=hround(w-.25u); bot y11=0;
  pos12(shaved_stem,0); x11=x12; top y12=slab+eps;
  filldraw z5'l---z10l...z11l{right}--z11r
   --z12r{left}...z10r+.75(z12-z11)---z5'r--cycle;  % foot
 else: pickup crisp.nib; pos5'(shaved_stem,0); rt x5'r=fine.rt x5r; y5'=y5;
  pos10(shaved_stem,0); x10=x5'; y10=1/3bh;
  pos11(.2[vair,stem],90); x11r=.5[x10r,x12r]; bot y11l=-vround .5oo;
  pos12(hair,180); rt x12l=hround(w-.1u); y12=max(y10,y11+vair);
  pos13(hair,180); x13=x12; top y13=max(vround .6bh,top y12);
  (x',y11l)=whatever[z11r,z12r]; x11l:=max(x',x10);
  filldraw stroke z5'e---z10e...z11e{right}...z12e---z13e; fi  % hook
else: numeric shaved_stem; shaved_stem=hround(stem-stem_corr);
 pickup tiny.nib; pos5'(shaved_stem,0); rt x5'r=fine.rt x5r; y5'=y5;
 pos10(shaved_stem,0); x10=x5'; bot y10=0;
 filldraw stroke z5'e--z10e; fi  % base of stem
%%%%%
% the accent
h:=full_h;
% low_bar(.5w,0, 14,15);
x_move:=.5w; y_move:=0; _one:=14; _two:=15;
pickup if serifs: crisp.nib else: fine.nib fi;
numeric macron_breadth; macron_breadth:=Vround .2[vair,stem];
pos[_one](macron_breadth,90); pos[_two](macron_breadth,90);
x[_one]=x_move+hround(2.5u if monospace:/expansion_factor fi+.5vair);
top y[_one]r=top y[_two]r=lc_trema_height+o;
x[_two]=x_move-hround(2.5u if monospace:/expansion_factor fi+.5vair);
filldraw stroke z[_one]e--z[_two]e;  % bar
penlabels(1,2,3,4,5,6,7,8,9,10,11,12,13, 14,15); endchar;

lhchar "Lowercase Cyrillic letter o_bar";
cyrchar(o_bar,9u#,x_height#+acc_height#,0);
italcorr .7x_height#*slant;
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
full_h:=h; h:=x_height;
% lower_o;
penpos1(vair,90); penpos3(vair',-90); penpos2(curve,180); penpos4(curve,0);
x2r=hround max(.5u,1.25u-.5curve);
x4r=w-x2r; x1=x3=.5w; y1r=h+vround 1.5oo; y3r=-oo;
y2=y4=.5h-vair_corr; y2l:=y4l:=.52h;
penstroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & pulled_arc.e(3,4) & pulled_arc.e(4,1) & cycle;  % bowl
%%%%%
% the accent
h:=full_h;
% low_bar(x1,0, 5,6);
x_move:=x1; y_move:=0; _one:=5; _two:=6;
pickup if serifs: crisp.nib else: fine.nib fi;
numeric macron_breadth; macron_breadth:=Vround .2[vair,stem];
pos[_one](macron_breadth,90); pos[_two](macron_breadth,90);
x[_one]=x_move+hround(2.5u if monospace:/expansion_factor fi+.5vair);
top y[_one]r=top y[_two]r=lc_trema_height+o;
x[_two]=x_move-hround(2.5u if monospace:/expansion_factor fi+.5vair);
filldraw stroke z[_one]e--z[_two]e;  % bar
penlabels(1,2,3,4, 5,6); endchar;

lhchar "Lowercase Cyrillic letter u_tld - u tilded";
cyrchar(u_tld,if serifs:9.5u# else:9u# fi,x_height#+acc_height#,desc_depth#); % eng
italcorr x_height#*slant+.25u#;
adjust_fit(serif_fit# if monospace:+\\.5u#,.5u#+ else:,fi\\ serif_fit#);
full_h:=h; h:=x_height;
% lower_u;
numeric left_stem,right_stem,bot_stem,bot_vair,outer_jut;
left_stem=fudged.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=.75jut;
x1l=w-x4r=l+letter_fit+outer_jut+.25u; y1=y4r=h; y2=y3=0; x2l=x3l;
numeric alpha,alpha[]; x9=3u; y9=bot_vair-d-oo;
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*bot_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);
if y0>notch_cut:
 y0:=notch_cut;
 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
else:
 fill z0--diag_end(0,4l,1,1,4r,3r)--z3r--z2l
  --diag_end(2l,1l,1,1,1r,0)--cycle; fi % left and right diagonals
penpos5(alpha*bot_stem,0); z5r=whatever[z3r,z4r]; y5-.5vair=-.5d;
if serifs:
 numeric light_bulb; light_bulb=hround 7/8[hair,flare]; clearpen;
 penpos6(vair,-90); penpos7(hair,-180); penpos8(light_bulb,-180);
 x6=2u; y6r=-d-oo; y8-.5light_bulb=-.85d; x8r=hround .35u;
 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+jut+.5u+1<=lft x4'l-jut: inner_jut=jut;
  else: rt x1'r+inner_jut+.5u+1=lft x4'l-inner_jut; fi
 save slab; slab:=Vround(vair-vair_corr); % lower.slab
 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(bot_vair,-90); x6=2.5u; y6r=-d-oo;
 fill stroke z3e---z5e...{left}z6e;  % arc
 pickup fine.nib; pos6'(bot_vair,-90); z6'=z6;
 pos7(2/3[bot_vair,flare],-85);
 lft x7l=hround u; bot y7r=vround-.96d-oo; y7l:=good.y y7l;
 filldraw stroke term.e(6',7,left,1,4); fi % arc and terminal
%%%%%
% the accent
h:=full_h; lowercase_tilde(0,0, 10,11,12,13,14);
penlabels(0,1,2,3,4,5,6,7,8,9, 10,11,12,13,14); endchar;

lhchar "Lowercase Cyrillic letter u_hat - u hat";
cyrchar(u_hat,if serifs:9.5u# else:9u# fi,x_height#+acc_height#,desc_depth#); % eng
italcorr x_height#*slant+.25u#;
adjust_fit(serif_fit# if monospace:+\\.5u#,.5u#+ else:,fi\\ serif_fit#);
full_h:=h; h:=x_height;
% lower_u;
numeric left_stem,right_stem,bot_stem,bot_vair,outer_jut;
left_stem=fudged.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=.75jut;
x1l=w-x4r=l+letter_fit+outer_jut+.25u; y1=y4r=h; y2=y3=0; x2l=x3l;
numeric alpha,alpha[]; x9=3u; y9=bot_vair-d-oo;
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*bot_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);
if y0>notch_cut:
 y0:=notch_cut;
 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
else:
 fill z0--diag_end(0,4l,1,1,4r,3r)--z3r--z2l
  --diag_end(2l,1l,1,1,1r,0)--cycle; fi % left and right diagonals
penpos5(alpha*bot_stem,0); z5r=whatever[z3r,z4r]; y5-.5vair=-.5d;
if serifs:
 numeric light_bulb; light_bulb=hround 7/8[hair,flare]; clearpen;
 penpos6(vair,-90); penpos7(hair,-180); penpos8(light_bulb,-180);
 x6=2u; y6r=-d-oo; y8-.5light_bulb=-.85d; x8r=hround .35u;
 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+jut+.5u+1<=lft x4'l-jut: inner_jut=jut;
  else: rt x1'r+inner_jut+.5u+1=lft x4'l-inner_jut; fi
 save slab; slab:=Vround(vair-vair_corr); % lower.slab
 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(bot_vair,-90); x6=2.5u; y6r=-d-oo;
 fill stroke z3e---z5e...{left}z6e;  % arc
 pickup fine.nib; pos6'(bot_vair,-90); z6'=z6;
 pos7(2/3[bot_vair,flare],-85);
 lft x7l=hround u; bot y7r=vround-.96d-oo; y7l:=good.y y7l;
 filldraw stroke term.e(6',7,left,1,4); fi % arc and terminal
%%%%%
% the accent
h:=full_h; lowercase_hat(.5[x1,x4],0, 10,11,12,13,14);
penlabels(0,1,2,3,4,5,6,7,8,9); endchar;

lhchar "Lowercase Cyrillic letter u_gr - u grave";
cyrchar_twice(u_gr,if serifs:9.5u# else:9u# fi,x_height#,desc_depth#); % eng
italcorr x_height#*slant+.25u#;
adjust_fit(serif_fit# if monospace:+\\.5u#,.5u#+ else:,fi\\ serif_fit#);
begingroup
% lower_u;
numeric left_stem,right_stem,bot_stem,bot_vair,outer_jut;
left_stem=fudged.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=.75jut;
x1l=w-x4r=l+letter_fit+outer_jut+.25u; y1=y4r=h; y2=y3=0; x2l=x3l;
numeric alpha,alpha[]; x9=3u; y9=bot_vair-d-oo;
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*bot_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);
if y0>notch_cut:
 y0:=notch_cut;
 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
else:
 fill z0--diag_end(0,4l,1,1,4r,3r)--z3r--z2l
  --diag_end(2l,1l,1,1,1r,0)--cycle; fi % left and right diagonals
penpos5(alpha*bot_stem,0); z5r=whatever[z3r,z4r]; y5-.5vair=-.5d;
if serifs:
 numeric light_bulb; light_bulb=hround 7/8[hair,flare]; clearpen;
 penpos6(vair,-90); penpos7(hair,-180); penpos8(light_bulb,-180);
 x6=2u; y6r=-d-oo; y8-.5light_bulb=-.85d; x8r=hround .35u;
 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+jut+.5u+1<=lft x4'l-jut: inner_jut=jut;
  else: rt x1'r+inner_jut+.5u+1=lft x4'l-inner_jut; fi
 save slab; slab:=Vround(vair-vair_corr); % lower.slab
 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(bot_vair,-90); x6=2.5u; y6r=-d-oo;
 fill stroke z3e---z5e...{left}z6e;  % arc
 pickup fine.nib; pos6'(bot_vair,-90); z6'=z6;
 pos7(2/3[bot_vair,flare],-85);
 lft x7l=hround u; bot y7r=vround-.96d-oo; y7l:=good.y y7l;
 filldraw stroke term.e(6',7,left,1,4); fi % arc and terminal
%%%%%
endgroup;
% the accent
hpos_corr=0.75u; put_gravis; repeat_once;
penlabels(0,1,2,3,4,5,6,7,8,9); endchar;

lhchar "Lowercase Cyrillic letter ery_bar";
cyrchar(ery_bar,9u#,x_height#+acc_height#,0); % v_witdh
italcorr x_height#*slant-serif_fit#+jut#-2u#+.5stem#; %d->x_height+jut
adjust_fit(if monospace: 0,0 else: serif_fit#,serif_fit# fi %wlett_adj
 +4u#);
full_h:=h; h:=x_height;
% lower_ery;
pickup tiny.nib; pos1(fudged.stem,0); pos2(fudged.stem,0);
lft x1l=lft x2l=hround (2.5u-.5fudged.stem-eps); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
if serifs:
 save slab; slab:=Vround(vair-vair_corr); % lower.slab
 dish_serif(1,2,a,1/3,jut,b,1/3,jut);	% upper serif
 slab:=vair; % lower.slab
 nodish_serif(2,1,c,1/3,jut,d,1/3,.5jut); fi % lower serif
% lsftsn_bowl(2);
_zero:=2;
_one:=3; _two:=4; _three:=5; _four:=6; _five:=7;
%
set_bar_axis;
penpos[_three](curve if hefty:-3stem_corr fi,0);
penpos[_four](vair',-90); penpos[_five](vair',-90);
z[_five]r=bot z[_zero]; y[_four]=y[_five];
y[_three]=.5[y[_two]l,y[_four]l];
y[_one]l=y[_two]l=y1.bh; y[_one]r=y[_two]r=y2.bh;
x[_two]l=x[_two]r=x[_four]=w-3.75u; %.5v_width+.75u;
x[_one]l=x[_one]r=x[_zero]; x[_three]r=hround(w-.6u);
x[_two]l:=x[_four]l:=x[_two]r-.25curve;
fill stroke
 {{if not serifs: interim superness:=more_super; fi
  z[_five]e..super_arc.e([_four],[_three])}} &
 super_arc.e([_three],[_two])..z[_one]e;  % lobe
%%%
% I
w:=w+4u; rt x8r=rt x9r=w-lft x1l; top y8=h; bot y9=0;
pos8(fudged.stem,0); pos9(fudged.stem,0);
filldraw stroke z8e--z9e; % stem
if serifs:
 slab:=Vround(vair-vair_corr); % lower.slab
 dish_serif(8,9,e,1/3,jut,f,1/3,jut);	% upper serif
 slab:=vair; % lower.slab
 dish_serif(9,8,g,1/3,jut,h,1/3,jut); fi% lower serif
%%%%%
% the accent
h:=full_h;
if monospace:
% low_bar(.5[l,r],oo, 10,11);
 x_move:=.5[l,r]; y_move:=oo; _one:=10; _two:=11;
 pickup if serifs: crisp.nib else: fine.nib fi;
 numeric macron_breadth; macron_breadth:=Vround .2[vair,stem];
 pos[_one](macron_breadth,90); pos[_two](macron_breadth,90);
 x[_one]=x_move+hround(2.5u if monospace:/expansion_factor fi+.5vair);
 top y[_one]r=top y[_two]r=lc_trema_height+o;
 x[_two]=x_move-hround(2.5u if monospace:/expansion_factor fi+.5vair);
 filldraw stroke z[_one]e--z[_two]e;  % bar
else:
% low_wbar(l+2.5u-.5stem,w-2.5u+.5stem,oo, 10,11);
 x_left:=l+2.5u-.5stem; x_right:=w-2.5u+.5stem; y_move:=oo; _one:=10; _two:=11;
 pickup if serifs: crisp.nib else: fine.nib fi;
 numeric macron_breadth; macron_breadth:=Vround .2[vair,stem];
 pos[_one](macron_breadth,90); pos[_two](macron_breadth,90);
 x[_one]=x_left; x[_two]=x_right;
 top y[_one]r=top y[_two]r=lc_trema_height+o;
 filldraw stroke z[_one]e--z[_two]e;  fi % bar
penlabels(1,2,3,4,5,6,7,8,9, 10,11); endchar;

lhchar "Lowercase Cyrillic letter erev_uml - reverse e umlaut";
cyrchar(erev_uml,8u#,lc_trema_height#,0); % eng
italcorr x_height#*slant-.2u#;
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
full_h:=h; h:=x_height;
% lower_erev;
set_bar_axis;
pickup fine.nib; pos2(vair',90); pos3(curve,0); pos4(vair',-90);
x2=x4=w-.5(w+u); top y2r=vround(h+1.5oo); bot y4r=-oo;
rt x3r=w-hround max(.6u,1.35u-.5curve); y3=.5h; % eng
if serifs:
 pos1(hair,180); pos5(hair,-180);
 y1=min(y2.bh+.75flare-.25vair+eps,.9[bar_height,h]-.75flare);
 lft x1r=lft x5r=hround.5u;
 y5=max(good.y(.5bar_height-.9),y4l+vair');
 (x,y4l)=whatever[z4r,z5l]; x4l:=max(x,x4l-.5u);
 filldraw stroke z1e{x2-x1,5(y2-y1)}...pulled_super_arc.e(2,3)(.7superpull)
  & pulled_super_arc.e(3,4)(.5superpull)
  ..tension .9 and 1..{x5-x4,5(y5-y4)}z5e;  % arc and lower terminal
 pos6(.3[fine.breadth,hair],180); x6r=x1r; top y6=h+oo;
 x1'-x1r=1.5curve; y1'=y1;
 path upper_arc; upper_arc=z1{x2-x1,5(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(4/7[vair',flare],100); pos5(.6[vair',flare],-95);
 lft x1r=good.x .6u; top y1r=vround .82[bar_height,top y2r];
 filldraw stroke term.e(2,1,left,.8,4);  % upper terminal
 lft x5r=good.x .5u;
 y5r=good.y(y5r+1/3bar_height-y5); y5l:=good.y y5l; x5l:=good.x x5l;
 forsuffixes e=l,r: path p.e; p.e=z4e{left}..tension .9 and 1..z5e;
  if angle direction 1 of p.e<105:
   p.e:=z4e{left}..tension atleast.9 and 1..{dir 105}z5e; fi
 endfor
 filldraw stroke pulled_super_arc.e(2,3)(.7superpull)
  & pulled_super_arc.e(3,4)(.5superpull) & p.e; fi  % arc and lower terminal
%%%
% lerev_bar;
if (serifs=true) and (bar#<=.5curve#):
   x7r=max(rt x1l+.5hair,0.85[x3l,x1l]); x8r=x3l;
   y7l=y8l=y1.bh; y7r=y8r=y2.bh; x7l=x7r; x8l=x8r;
   numeric bar[];
   bar2=7/8[bar,fudged.stem-2stem_corr];
   penpos9(bar2,45); z9=.475[z7l,z8l];
   fill circ_stroke z7e{2,1}..{2,-1}z9e..{2,1}z8e; % curve /\/
else:
   bar_stroke(max(rt x1l+.5hair,0.85[x3l,x1l]),x3l); % bar --
fi
%%%%%
% the accent
h:=full_h; lowercase_umlaut(0,0, 10,11,12,13);
penlabels(1,1',2,3,4,5,6,7,8,9, 10,11,12,13); endchar;

lhchar "Lowercase Cyrillic letter erev_dot - reverse e dot";
cyrchar_twice(erev_dot,8u#,x_height#,0); % eng
italcorr x_height#*slant-.2u#;
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
% lower_erev;
set_bar_axis;
pickup fine.nib; pos2(vair',90); pos3(curve,0); pos4(vair',-90);
x2=x4=w-.5(w+u); top y2r=vround(h+1.5oo); bot y4r=-oo;
rt x3r=w-hround max(.6u,1.35u-.5curve); y3=.5h; % eng
if serifs:
 pos1(hair,180); pos5(hair,-180);
 y1=min(y2.bh+.75flare-.25vair+eps,.9[bar_height,h]-.75flare);
 lft x1r=lft x5r=hround.5u;
 y5=max(good.y(.5bar_height-.9),y4l+vair');
 (x,y4l)=whatever[z4r,z5l]; x4l:=max(x,x4l-.5u);
 filldraw stroke z1e{x2-x1,5(y2-y1)}...pulled_super_arc.e(2,3)(.7superpull)
  & pulled_super_arc.e(3,4)(.5superpull)
  ..tension .9 and 1..{x5-x4,5(y5-y4)}z5e;  % arc and lower terminal
 pos6(.3[fine.breadth,hair],180); x6r=x1r; top y6=h+oo;
 x1'-x1r=1.5curve; y1'=y1;
 path upper_arc; upper_arc=z1{x2-x1,5(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(4/7[vair',flare],100); pos5(.6[vair',flare],-95);
 lft x1r=good.x .6u; top y1r=vround .82[bar_height,top y2r];
 filldraw stroke term.e(2,1,left,.8,4);  % upper terminal
 lft x5r=good.x .5u;
 y5r=good.y(y5r+1/3bar_height-y5); y5l:=good.y y5l; x5l:=good.x x5l;
 forsuffixes e=l,r: path p.e; p.e=z4e{left}..tension .9 and 1..z5e;
  if angle direction 1 of p.e<105:
   p.e:=z4e{left}..tension atleast.9 and 1..{dir 105}z5e; fi
 endfor
 filldraw stroke pulled_super_arc.e(2,3)(.7superpull)
  & pulled_super_arc.e(3,4)(.5superpull) & p.e; fi  % arc and lower terminal
%%%
% lerev_bar;
if (serifs=true) and (bar#<=.5curve#):
   x7r=max(rt x1l+.5hair,0.85[x3l,x1l]); x8r=x3l;
   y7l=y8l=y1.bh; y7r=y8r=y2.bh; x7l=x7r; x8l=x8r;
   numeric bar[];
   bar2=7/8[bar,fudged.stem-2stem_corr];
   penpos9(bar2,45); z9=.475[z7l,z8l];
   fill circ_stroke z7e{2,1}..{2,-1}z9e..{2,1}z8e; % curve /\/
else:
   bar_stroke(max(rt x1l+.5hair,0.85[x3l,x1l]),x3l); % bar --
fi
%%%%%
% the accent
put_dot(tiny,max(dot_size#,cap_curve#)); repeat_once;
penlabels(1,1',2,3,4,5,6,7,8,9); endchar;

lhchar "Lowercase Cyrillic letter erev_bar - reverse e bar";
cyrchar(erev_bar,8u#,x_height#+acc_height#,0); % eng
italcorr x_height#*slant-.2u#;
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
full_h:=h; h:=x_height;
% lower_erev;
set_bar_axis;
pickup fine.nib; pos2(vair',90); pos3(curve,0); pos4(vair',-90);
x2=x4=w-.5(w+u); top y2r=vround(h+1.5oo); bot y4r=-oo;
rt x3r=w-hround max(.6u,1.35u-.5curve); y3=.5h; % eng
if serifs:
 pos1(hair,180); pos5(hair,-180);
 y1=min(y2.bh+.75flare-.25vair+eps,.9[bar_height,h]-.75flare);
 lft x1r=lft x5r=hround.5u;
 y5=max(good.y(.5bar_height-.9),y4l+vair');
 (x,y4l)=whatever[z4r,z5l]; x4l:=max(x,x4l-.5u);
 filldraw stroke z1e{x2-x1,5(y2-y1)}...pulled_super_arc.e(2,3)(.7superpull)
  & pulled_super_arc.e(3,4)(.5superpull)
  ..tension .9 and 1..{x5-x4,5(y5-y4)}z5e;  % arc and lower terminal
 pos6(.3[fine.breadth,hair],180); x6r=x1r; top y6=h+oo;
 x1'-x1r=1.5curve; y1'=y1;
 path upper_arc; upper_arc=z1{x2-x1,5(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(4/7[vair',flare],100); pos5(.6[vair',flare],-95);
 lft x1r=good.x .6u; top y1r=vround .82[bar_height,top y2r];
 filldraw stroke term.e(2,1,left,.8,4);  % upper terminal
 lft x5r=good.x .5u;
 y5r=good.y(y5r+1/3bar_height-y5); y5l:=good.y y5l; x5l:=good.x x5l;
 forsuffixes e=l,r: path p.e; p.e=z4e{left}..tension .9 and 1..z5e;
  if angle direction 1 of p.e<105:
   p.e:=z4e{left}..tension atleast.9 and 1..{dir 105}z5e; fi
 endfor
 filldraw stroke pulled_super_arc.e(2,3)(.7superpull)
  & pulled_super_arc.e(3,4)(.5superpull) & p.e; fi  % arc and lower terminal
%%%
% lerev_bar;
if (serifs=true) and (bar#<=.5curve#):
   x7r=max(rt x1l+.5hair,0.85[x3l,x1l]); x8r=x3l;
   y7l=y8l=y1.bh; y7r=y8r=y2.bh; x7l=x7r; x8l=x8r;
   numeric bar[];
   bar2=7/8[bar,fudged.stem-2stem_corr];
   penpos9(bar2,45); z9=.475[z7l,z8l];
   fill circ_stroke z7e{2,1}..{2,-1}z9e..{2,1}z8e; % curve /\/
else:
   bar_stroke(max(rt x1l+.5hair,0.85[x3l,x1l]),x3l); % bar --
fi
%%%%%
% the accent
h:=full_h;
% low_bar(x2,oo, 10,11);
x_move:=x2; y_move:=oo; _one:=10; _two:=11;
pickup if serifs: crisp.nib else: fine.nib fi;
numeric macron_breadth; macron_breadth:=Vround .2[vair,stem];
pos[_one](macron_breadth,90); pos[_two](macron_breadth,90);
x[_one]=x_move+hround(2.5u if monospace:/expansion_factor fi+.5vair);
top y[_one]r=top y[_two]r=lc_trema_height+o;
x[_two]=x_move-hround(2.5u if monospace:/expansion_factor fi+.5vair);
filldraw stroke z[_one]e--z[_two]e;  % bar
penlabels(1,1',2,3,4,5,6,7,8,9, 10,11); endchar;

lhchar "Lowercase Cyrillic letter yu_bar (looks like IO)";
cyrchar(yu_bar,9u#,x_height#+acc_height#,0);
italcorr .7x_height#*slant;
adjust_fit(if monospace: 4u# else: 4.5u# fi +serif_fit#, %li_part_adj
 if monospace: -.45u# else: 0 fi);
full_h:=h; h:=x_height;
% lower_yu;
penpos1(vair,90); penpos3(vair',-90); penpos2(curve,180); penpos4(curve,0);
x2r=hround max(.5u,1.25u-.5curve);
x4r=w-x2r; x1=x3=.5w; y1r=h+vround 1.5oo; y3r=-oo;
y2=y4=.5h-vair_corr; y2l:=y4l:=.52h;
penstroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & pulled_arc.e(3,4) & pulled_arc.e(4,1) & cycle;  % bowl
save slab; % lower.slab
% barh_i_part(2);
_zero:=2;
_one:=5; _two:=6;
%
pickup tiny.nib;
pos[_one](stem,0); pos[_two](stem,0);
lft x[_one]l=lft x[_two]l=
    l+letter_fit+if not monospace: serif_fit+ fi hround (2.5u-.5stem-eps);
top y[_one]=h; bot y[_two]=0;
filldraw stroke z[_one]e--z[_two]e; % stem
bar_stroke(x[_one],x[_zero]); % bar
if serifs:
   slab:=Vround(vair-vair_corr); % lower.slab
   dish_serif([_one],[_two],s,1/3,jut,t,1/3,jut); % upper serif
   slab:=vair; % lower.slab
   dish_serif([_two],[_one],u,1/3,jut,v,1/3,jut); % lower serif
fi
%%%%%
% the accent
h:=full_h;
if monospace:
% low_bar(.5[l,r],oo, 9,10);
 x_move:=.5[l,r]; y_move:=oo; _one:=9; _two:=10;
 pickup if serifs: crisp.nib else: fine.nib fi;
 numeric macron_breadth; macron_breadth:=Vround .2[vair,stem];
  pos[_one](macron_breadth,90); pos[_two](macron_breadth,90);
 x[_one]=x_move+hround(2.5u if monospace:/expansion_factor fi+.5vair);
 top y[_one]r=top y[_two]r=lc_trema_height+o;
 x[_two]=x_move-hround(2.5u if monospace:/expansion_factor fi+.5vair);
 filldraw stroke z[_one]e--z[_two]e;  % bar
 else:
% low_wbar(l+2.5u-.5stem,w-2.5u+.5stem,oo, 9,10);
 x_left:=l+2.5u-.5stem; x_right:=w-2.5u+.5stem; y_move:=oo; _one:=10; _two:=11;
 pickup if serifs: crisp.nib else: fine.nib fi;
 numeric macron_breadth; macron_breadth:=Vround .2[vair,stem];
 pos[_one](macron_breadth,90); pos[_two](macron_breadth,90);
 x[_one]=x_left; x[_two]=x_right;
 top y[_one]r=top y[_two]r=lc_trema_height+o;
 filldraw stroke z[_one]e--z[_two]e;  fi % bar
penlabels(1,2,3,4,5,6,7,8, 9,10); endchar;

iff not specific:%
lhchar "Lowercase Cyrillic letter ya_bar (`roman')";
cyrchar(ya_bar,if serifs: 9.75u# else: 10u#-.5width_adj# fi,x_height#+acc_height#,0); % n_width
italcorr x_height#*slant-serif_fit#+jut#-2u#+.5stem#; %d->x_height+jut
adjust_fit(if serifs:serif_fit# else:0 fi,serif_fit#);
full_h:=h; h:=x_height;
% lowerr_ya;
pickup tiny.nib; pos1(stem',0); pos2(stem',0);
rt x1r=rt x2r=hround(w-2.5u+.5stem'); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
penpos3(vair,90); penpos4(vair,90); penpos5(curve if hefty:-3stem_corr fi,180);
y6r=y7r=hround (if serifs:.52h else:.5h fi-.6[thin_join,vair]/2);
y6l=y7l=y6r+.6[thin_join,vair]; y6=y7=.5[y6l,y6r];%
z3r=top z1; y4=y3; y5=.52[y4r,y6r]+eps;
x7l=x7r=x2; x4+.25u=x6l=x6r; x4=.5w if serifs:+.25u else:-.25u fi;
x5r=hround min(1.25u,2u-.5curve);
x4l:=x4+.125curve; x6l:=x6l+.125curve;
{{interim superness:=2/3[superness,max(superness,sqrt.77superness)];%|2/3[super,more_super]|
   fill stroke z7e..pulled_arc.e(6,5) & pulled_arc.e(5,4)..z3e}};  % lobe
numeric stem[],alpha,right_jut;
right_jut=if serifs:.6jut else:.4tiny fi;
stem1=max(tiny.breadth,hround(fudged.stem-3stem_corr));
lft x9l=hround(l+letter_fit+.3u+right_jut)-eps; bot y9=0;
alpha=diag_ratio(1,.5(stem1-tiny),y1-y9,x9l-x1);
penpos9(alpha*(stem1-tiny),0);
x8=x6l-if serifs:.75u else:.25u fi; y8=y6;
forsuffixes $=l,r: y9'$=0; endfor
z9'r=z9r+penoffset z1-z9 of currentpen+whatever*(z1-z9);
z9'l=z9l+penoffset z9-z1 of currentpen+whatever*(z1-z9);
z8=z9'+whatever*(z1-z9);
penpos8(if serifs: x9'r-x9'l else: stem fi-2stem_corr,0);
fill z8l--diag_end(8l,9'l,1,.5,9'r,8r)--z8r--cycle;  % diagonal
if serifs:
 numeric inner_jut;
 if lft x2l-jut-.5u+1>=rt x9r+jut: inner_jut=jut;
  else: lft x2l-jut-.5u+1=rt x9r+inner_jut; fi
 save slab; slab:=Vround(vair-vair_corr); % lower.slab
 nodish_serif(1,2,a,1/3,.5jut,b,1/3,jut); % upper serif
 slab:=vair; % lower.slab
 dish_serif(2,1,c,1/3,jut,d,1/3,jut); % lower serif
 dish_serif(9,8,g,1/2,right_jut,h,1/3,inner_jut)(dark); fi % lower diagonal serif
%%%%%
the accent
h:=full_h;
% low_bar(.5[x1,x6r-.5curve],0, 10,11);
x_move:=.5[x1,x6r-.5curve]; y_move:=0; _one:=10; _two:=11;
pickup if serifs: crisp.nib else: fine.nib fi;
numeric macron_breadth; macron_breadth:=Vround .2[vair,stem];
pos[_one](macron_breadth,90); pos[_two](macron_breadth,90);
x[_one]=x_move+hround(2.5u if monospace:/expansion_factor fi+.5vair);
top y[_one]r=top y[_two]r=lc_trema_height+o;
x[_two]=x_move-hround(2.5u if monospace:/expansion_factor fi+.5vair);
filldraw stroke z[_one]e--z[_two]e;  % bar
penlabels(0,1,2,3,4,5,6,7,8,9, 10,11); endchar;

lhchar "Lowercase Cyrillic letter otld_bar (otld bar)";
cyrchar(otld_bar,9u#,x_height#+acc_height#,0);
italcorr .7x_height#*slant;
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi); full_h:=h; h:=x_height;
% lower_o;tld
penpos1(vair,90); penpos3(vair',-90); penpos2(curve,180); penpos4(curve,0);
x2r=hround max(.5u,1.25u-.5curve);
x4r=w-x2r; x1=x3=.5w; y1r=h+vround 1.5oo; y3r=-oo;
y2=y4=.5h-vair_corr; y2l:=y4l:=.52h;
penstroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & pulled_arc.e(3,4) & pulled_arc.e(4,1) & cycle;  % bowl
%%%
% oltilde;
if (serifs=true) and (bar#<=.5curve#):
   numeric bar[];
   set_bar_axis;
   x5r=x2l; x6r=x4l;
   y5r=y6r=y2.bh; y5l=y6l=y1.bh; x5r=x5l; x6l=x6r;
   bar2=2/3[bar,fudged.stem];
   penpos7(bar2,45); z7=.5[z5l,z6l];
   fill stroke z6e{-2,-1}..{-2,1}z7e..{-2,-1}z5e;
else:
   bar_stroke(x2,x4);
fi
%%%%%
% the accent
h:=full_h;
% low_bar(.5w,oo, 8,9);
x_move:=.5w; y_move:=oo; _one:=8; _two:=9;
pickup if serifs: crisp.nib else: fine.nib fi;
numeric macron_breadth; macron_breadth:=Vround .2[vair,stem];
pos[_one](macron_breadth,90); pos[_two](macron_breadth,90);
x[_one]=x_move+hround(2.5u if monospace:/expansion_factor fi+.5vair);
top y[_one]r=top y[_two]r=lc_trema_height+o;
x[_two]=x_move-hround(2.5u if monospace:/expansion_factor fi+.5vair);
filldraw stroke z[_one]e--z[_two]e;  % bar
penlabels(1,2,3,4,5,6,7, 8,9); endchar;

lhchar "Lowercase Cyrillic letter y_bar - straight u bar";
cyrchar(y_bar,if serifs: 9.5u# else: 9u# fi,x_height#,desc_depth#);
italcorr x_height#*slant+.25u#;
adjust_fit(serif_fit#,serif_fit#); full_h:=h; h:=x_height;
% lower_y;
numeric left_stem,right_stem,outer_jut,dy,alpha; left_stem=stem-stem_corr;
right_stem=min(hair if hefty:-2stem_corr fi,left_stem); outer_jut=.75jut;
x1l=w-x4r=l+letter_fit+outer_jut+.05u;
x2l=x5l=hround(.5w-.5left_stem); x3r=x5r; y1=y4=h;
y2=y3=y5=0; dy=y1-y2; alpha=((x2l-x1l)++dy)/dy;
penpos1(alpha*left_stem,0); penpos2(alpha*left_stem,0);
penpos3(alpha*right_stem,0); penpos4(alpha*right_stem,0);
penpos5(left_stem,0); penpos6(left_stem,0); x5=x6; y6=-d;
z0=whatever[z1r,z2r]=whatever[z3l,z4l];
if y0>y2+notch_cut: y0:=y2+notch_cut;
  fill z0+.5right{up}...{z4-z3}diag_end(3l,4l,1,1,4r,3r)--z5r
    --diag_end(5r,6r,1,1,6l,5l)--z5l--diag_end(2l,1l,1,1,1r,2r){z2-z1}
    ...{down}z0+.5left--cycle; % diagonals and stem
else: fill z0--diag_end(0,4l,1,1,4r,3r)--z5r
    --diag_end(5r,6r,1,1,6l,5l)--z5l
    --diag_end(2l,1l,1,1,1r,0)--cycle; fi  % diagonals and stem
if serifs: numeric inner_jut; pickup tiny.nib;
 prime_points_inside(1,2); prime_points_inside(4,3); prime_points_inside(6,5);
 if rt x1'r+jut+.5u+1<=lft x4'l-jut: inner_jut=jut;
  else: rt x1'r+inner_jut+.5u+1=lft x4'l-inner_jut; fi
 dish_serif(6',5,e,1/3,jut,f,1/3,jut);	% lower serif
 save slab; slab:=Vround(vair-vair_corr); % lower.slab
 dish_serif(1',2,a,1/3,outer_jut,b,1/2,inner_jut);	   % upper left serif
 dish_serif(4',3,c,.6,inner_jut,d,1/2,outer_jut)(dark);	fi % upper right serif
%%%%%
% the accent
h:=full_h;
% low_bar(.5w,0, 7,8);
x_move:=.5w; y_move:=0; _one:=7; _two:=8;
pickup if serifs: crisp.nib else: fine.nib fi;
numeric macron_breadth; macron_breadth:=Vround .2[vair,stem];
pos[_one](macron_breadth,90); pos[_two](macron_breadth,90);
x[_one]=x_move+hround(2.5u if monospace:/expansion_factor fi+.5vair);
top y[_one]r=top y[_two]r=lc_trema_height+o;
x[_two]=x_move-hround(2.5u if monospace:/expansion_factor fi+.5vair);
filldraw stroke z[_one]e--z[_two]e;  % bar
penlabels(0,1,2,3,4,5,6, 7,8); endchar;

lhchar "Lowercase Cyrillic letter eps_uml - epsilon umlaut";
cyrchar(eps_uml,if serifs:8u# else:7.5u# fi,lc_trema_height#,0);
italcorr x_height#*slant-.2u#;
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
full_h:=h; h:=x_height;
% lower_eps;
numeric right_curve; right_curve=curve-stem_corr; pickup fine.nib;
penpos2(vair,90); penpos3(right_curve-stem_corr,180);
penpos7(right_curve,180); penpos8(vair',-90);
y2r=vround(h+1.5oo); x2=x6l=x6r=x8=.5[w-u,x7]; x7r=hround.6u;
x3r=max(lft x7r+1,hround .8u); y3=.5[y4l,y2l]-eps; y8r=-oo;
set_bar_axis; y4l=y5r=y6r=y2.bh; y6l=y5l=y4r=y1.bh; y5=y6=y0.bh;
pickup fine.nib; z2'=z2; pos2'(vair,90); pos8'(vair',-90); z8'=z8;
if serifs: pos1(hair,0); pos9(hair,0); pos0(flare,0);
 y1=min(bar_height+.5flare+2vair'+2,.9[bar_height,h]-.5flare);
 rt x1r=hround(w-.6u); bulb(2',1,0); % bulb
 rt x9r=hround(w-.5u); y9=max(good.y(.5bar_height-.9),y8l+vair');
 filldraw stroke z8'e{right}..tension.9 and 1..{x9-x8,5(y9-y8)}z9e; % lower bowl
else: pos1(4/7[vair',flare],80); pos9(.6[vair',flare],275);
 rt x1r=hround(w-.6u); top y1r=vround .82[bar_height,top y2r];
 filldraw stroke term.e(2',1,right,.8,4); % upper terminal
 rt x9r=hround(w-.5u);
 y9r=good.y(y9r+1/3bar_height-y9); y9l:=good.y y9l; x9l:=good.x x9l;
 forsuffixes e=l,r: path p.e; p.e=z8'e{right}..tension .9 and 1..z9e;
  if angle direction 1 of p.e>75:
   p.e:=z8'e{right}..tension atleast.9 and 1..{dir 75}z9e; fi endfor
 filldraw stroke p.e; fi % arc and lower terminal
rt x5l=rt x5r=max(min(w-2.2u,
 lft x1l- if serifs:flare else:.5vair fi)-eps,rt x6l+fine);
y7=.5[y6l,y8l]; x4l=x4r=1/3[x5l,x3l];
(x,y8l)=whatever[z8r,z9l]; x8l:=min(x,x8l+.5u);
if not serifs:x4r:=max(x5r,x4r-u); x6r:=max(x5r,x6r-.5u); fi
fill stroke {{interim superness:=hein_super; super_arc.e(2,3)}}
 & pulled_super_arc.e(3,4)(.7superpull); % upper bowl
{{interim superness:=more_super;
 fill stroke z5e..super_arc.e(6,7) & super_arc.e(7,8)}}; % lower bowl
fill z5l{right} if bot y5r>top y5l:..(rt x5l,top y5l)---(rt x5r,bot y5r)..
 else: ... fi {left}z5r--cycle; % bar
%%%%%
% the accent
h:=full_h; lowercase_umlaut(0,0, 10,11,12,13);
penlabels(0,1,2,3,4,5,6,7,8,9, 10,11,12,13); endchar;

lhchar "Lowercase Cyrillic letter l_ldot - el lower dot";
cyrchar(l_ldot,10u# % if not serifs:+.5width_adj# fi % dl_width;n_width
 ,x_height#,desc_depth#);
italcorr x_height#*slant-serif_fit#+jut#-2u#+.5stem#; %d->x_height+jut
adjust_fit(serif_fit# if not serifs:+.5(stem#-u#) fi, %dl_adj
 serif_fit#); %
% lower_l;
pickup tiny.nib; pos1(fudged.stem,0); pos2(fudged.stem,0);
rt x1r=rt x2r=w-hround (2.5u-.5fudged.stem-eps); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; %stem
numeric light_hair,bot_vair,bulb_diam,left_jut;
light_hair=if hefty:.5[vair,fudged.hair] else: fudged.hair fi;
bot_vair=Vround(.5[vair,light_hair]);
bulb_diam=hround 7/8[hair,flare];
left_jut=
   if serifs: max(limit_dist,1.1jut) else: hround (w+serif_fit-rt x2r-.5u) fi;
x3=1/3[w-rt x1r-(1/8left_jut),rt x1r] if not serifs: -.5(stem-u) fi +eps;
if serifs:
 pos3(light_hair,0); pos4(light_hair,-90);
 pos6(bulb_diam,-180); pos5(hair,-180);
 top y3=h; y6-.5bulb_diam=.12desc_depth-eps; z6r=z5r;
 lft x6r=l+letter_fit+hround(.35u-.5);
 x4=max(lft x5r+.5bulb_diam,.4[lft x5r,rt x3r]);
 bot y4r=-1.5oo-eps; {{less_tense; bulb(4,5,6)}}; %bulb
 filldraw stroke z4e{right}
  ..controls (min(15/16[x4,x3],max(x4,lft x6r+1.75bulb_diam))+(x3e-x3),y4e)
  and (x3e,max(y4l,min(y6-.5,1/3h+eps))+1/3(y4e-y4))..{up}z3e; % left tail
else:
 pos3'(vair,90); pos1'(vair,90);
 lft x3'=x3-.5light_hair; rt x1'=x1r; top y3'r=top y1'r=h;
 filldraw stroke z3'e--z1'e; % upper bar
 pickup fine.nib; pos3(light_hair,0); pos4(bot_vair,-90); pos5(bot_vair,-90);
 bot y5r=0; x4=.67[x3l,x5];
 lft x5=l+letter_fit+hround(.35u-.5); bot y4r=bot y5r; y3=y3';
 filldraw stroke z3e{down}..controls (x3e,y5e+.35h)
  and (min(7/8[x4e,x3e],x4e+2light_hair+eps),y4e-eps)..{left}z4e--z5e; fi % left stem
%%%
if serifs:
 x0=x3; y0=0;
 numeric inner_jut; inner_jut=.5(x1l-x3r)+.5crisp+eps;
 save slab; slab:=Vround(vair-vair_corr); % lower.slab
 dish_serif(2,1,a,1/3,jut,b,1/3,jut);          %lower right serif
 slab:=vair; % lower.slab
 nodish_serif(1,2,c,1/3,inner_jut,d,1/3,jut);  %upper right serif
 nodish_serif(3,0,e,1/3,1.05jut,f,1/3,inner_jut); fi % upper left serif
%%%%%
% the accent
% lower_dot;
_one:=7; _two:=8; _center:=.5w;
%
numeric dot_diam#; dot_diam#=max(dot_size#,cap_curve#);
define_whole_blacker_pixels(dot_diam);
pos[_one](dot_diam,0); pos[_two](dot_diam,90);
x[_one]=hround(_center); bot y[_two]l=vround(-d-1);
if 0-oo-top y[_two]r<slab: y[_one]r:=vround(max(y[_two]l+eps,-fine-slab)); fi
x[_one]=x[_two]; y[_one]=vround(.5[y[_two]l,y[_two]r]);
dot([_one],[_two]);  % dot
penlabels(1,2,3,4,5,6,7,8);endchar;

lhchar "Lowercase Cyrillic letter n_ldot - n lower dot";
cyrchar(n_ldot,10u# if not serifs:+.5width_adj# fi,x_height#,desc_depth#); % n_width
italcorr x_height#*slant-serif_fit#+jut#-2u#+.5stem#; %d->x_height+jut
adjust_fit(serif_fit#,serif_fit#);
% lower_n;
pickup tiny.nib; pos1(fudged.stem,0); pos2(fudged.stem,0);
pos3(fudged.stem,0); pos4(fudged.stem,0);
lft x1l=lft x2l=hround(2.5u-.5fudged.stem-eps); 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
bar_stroke(x1,x3); % bar
%%%
if serifs: numeric inner_jut;
 if rt x1r+jut+.5u+1<=lft x3l-jut: inner_jut=jut;
  else: rt x1r+inner_jut+.5u+1=lft x3l-inner_jut; fi
 save slab; slab:=Vround(vair-vair_corr); % lower.slab
 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 rt serif
 slab:=vair; % lower.slab
 dish_serif(2,1,c,1/3,jut,d,1/3,inner_jut);	% lower left serif
 dish_serif(4,3,g,1/3,inner_jut,h,1/3,jut); fi	% lower rt serif
%%%%%
% the accent
% lower_dot;
_one:=7; _two:=8; _center:=.5w;
%
numeric dot_diam#; dot_diam#=max(dot_size#,cap_curve#);
define_whole_blacker_pixels(dot_diam);
pos[_one](dot_diam,0); pos[_two](dot_diam,90);
x[_one]=hround(_center); bot y[_two]l=vround(-d-1);
if 0-oo-top y[_two]r<slab: y[_one]r:=vround(max(y[_two]l+eps,-fine-slab)); fi
x[_one]=x[_two]; y[_one]=vround(.5[y[_two]l,y[_two]r]);
dot([_one],[_two]);  % dot
penlabels(1,2,3,4,5,6,7,8); endchar;

lhchar "Lowercase Cyrillic letter r_brv (looks like p)";
cyrchar(r_brv,10u#+serif_fit#,x_height#+acc_height#,desc_depth#);
italcorr .5x_height#*slant+min(.5curve#-.85u#,-.1u#); %p
adjust_fit(serif_fit#,0); full_h:=h; h:=x_height;
% lower_r;
pickup tiny.nib; pos1(stem',0); pos2(stem,0);
pos0'(stem',0); pos0(stem,0); z0l=z0'l; x0'=x1; x0=x2;
lft x1l=hround(2.5u-.5stem'); top y1=h if serifs: +min(oo,serif_drop) fi;
numeric edge; edge=rt x2r;
pickup fine.nib; pos3(if hefty:thin_join else: hair fi,180);
pos4(vair',90); pos5(curve,0); pos6(vair,-90); penpos7(x3l-x3r,-180);
rt x3l=max(rt x3l-(lft x3r-tiny.lft x2l), 1/3[rt x2,edge]);
y3=1/8[bar_height,x_height];
x4l=w-.5(w-serif_fit)+.5u; top y4r=x_height+oo;
rt x5r=hround min(w-1.35u+.5curve,w-.6u); y5=.5x_height;
x6l=x4l-.2u; bot y6r=-oo;
x7=x3; y7=min(y3,y6+y4-y3+.6vair);
(x,y4r)=whatever[z3l,z4l]; x4r:=min(x,.5[x5r,x4]);
(x',y6r)=whatever[z7l,z6l]; x6r:=min(x',.5[x5r,x6]);
filldraw stroke z3e{up}...{right}z4e&super_arc.e(4,5)
 &super_arc.e(5,6)&z6e{left}...{up}z7e;  % bowl
y0=ypart(((edge,h)--(edge,0))intersectionpoint(z3l{up}...{right}z4l));
pickup tiny.nib; bot y2=-d;
filldraw stroke z1e--z0'e--z0e--z2e;  % stem
pickup crisp.nib; pos8(hair,0); pos7'(stem,0);
z7'=z2; x8l=x7'l; bot y8=0;
filldraw stroke z7'e--z8e;  % point
if serifs:
 sloped_serif.l(1,0',a,1/3,jut,serif_drop);  % upper serif
 dish_serif(2,0,b,1/3,jut,c,1/3,jut); fi  % lower serif
%%%%%
% the accent
h:=full_h; lowercase_breve(.5w,0, 9,10,11); %x3 y3r-h
penlabels(0,1,2,3,4,5,6,7,8, 9,10,11); endchar;

lhchar "Lowercase Cyrillic letter t_lcom - te lower comma";
cyrchar(t_lcom,9u#-width_adj#,x_height#,1.25desc_depth#);
italcorr x_height#*slant-beak_jut#+.35u#; %Gamma->x_height+.65u#
adjust_fit(0,0);
% lower_t;
pickup tiny.nib; pos1(stem,0); pos2(stem,0);
lft x1l=lft x2l=hround(.5w-.5stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
pickup crisp.nib; pos3(vair,90); pos4(hair,0);
top y3r=h; x3=x1; rt x4r=hround(w-.45u); y4=good.y(y3l-beak/1.4)-eps;
arm(3,4,e,beak_darkness,.4beak_jut);  % right arm and beak
pos5(hair,180); x5=w-x4; y5=y4;
arm(3,5,f,beak_darkness,-.4beak_jut);  % left arm and beak
%%%
if serifs:
 save slab; slab:=vair; % lower.slab
 dish_serif(2,1,c,1/3,1.414jut,d,1/3,1.414jut);	% lower serif
 slab:=Vround(vair-vair_corr); % lower.slab
 nodish_serif(1,2,a,1/3,.5jut,b,1/3,.5jut); fi	% upper bracketing
%%%%%
% the accent
%ac_comma(0,0,1.25desc_depth, 6,7,8,9,10);
 x_move:=0; y_move:=0; depth:=1.25desc_depth;
  _zero:=6; _one:=7; _two:=8; _three:=9; _four:=10;
 numeric height,bulb_diam;
 height=if serifs: depth+.5fine-max(.27depth,o+hair) else:.68depth fi;
 bulb_diam=max(fine.breadth,min(dot_size,floor(.56height)));
 if square_dots: pickup fine.nib; pos[_one](vair,0);
  pos[_two](.5[vair,stem],0);
  % comma below letter as sans serif cedilla
   top y[_one]=-o-2; bot y[_two]=-d-o;
   x[_two]=x[_one]-1.25u=.5w+x_move;
  filldraw stroke z[_one]e--z[_two]e;   % diagonal
 else: pickup fine.nib;
  x[_four]-.5bulb_diam=hround(.5w+x_move-.5bulb_diam);
  y[_four]+.5bulb_diam=-d+y_move+height;
  pos[_four](bulb_diam,90);
  pos[_one](vair,90); pos[_two](vair,0); pos[_three](vair,-45);
  z[_one]r=z[_four]r; rt x[_two]r=hround(x[_four]+.5bulb_diam
   +if monospace:.28u / expansion_factor else:.25u fi)+2eps;
  x[_three]=x[_four]-.5u if monospace: /expansion_factor fi;
  y[_two]=1/3[y[_one],y[_three]];
  bot y[_three]r=vround(y[_four]-(height-.5bulb_diam));
  y_:=ypart((z[_one]{right}...z[_two]{down}...z[_three])
   intersectiontimes (z[_four]l{right}..{left}z[_four]r));
  if y_<0: y_:=1; fi
  filldraw z[_four]r{left}..subpath (0,y_)
   of (z[_four]l{right}..{left}z[_four]r)--cycle; % dot
  filldraw stroke z[_one]e{right}...z[_two]e{down}...z[_three]e; fi  % tail
 penlabels([_zero],[_one],[_two],[_three],[_four]);
penlabels(1,2,3,4,5, 6,7,8,9,10); endchar;

lhchar "Lowercase Cyrillic letter ch_ldot - che lower dot";
cyrchar(ch_ldot,10u# if not serifs:+.5width_adj# fi,x_height#,desc_depth#); % n_width
italcorr x_height#*slant-serif_fit#+jut#-2u#+.5stem#; %d->x_height+jut
adjust_fit(serif_fit#,serif_fit#);
% lower_ch;
pickup tiny.nib;
numeric middle_weight; middle_weight=.6[thin_join,vair];
pos1(fudged.stem,0); pos2(fudged.stem,0);
pos3(fudged.stem,0); pos4(fudged.stem,0);
penpos2'(fudged.stem,0); z2'=z2;
penpos5(middle_weight,90); penpos6(middle_weight,90);
penpos6'(middle_weight,90);
lft x1l=lft x2l=hround(2.5u-.5fudged.stem-eps); x3=x4=w-x1;
top y1=top y3=h; bot y2=.3[y6,h]; bot y4=0; x5l=1/3[x1,x3];
y6l=vround(.48h-.5middle_weight if serifs:-.15(.5[hair,.7stem]) fi);
filldraw stroke z1e--z2e; % left stem
filldraw stroke z3e--z4e; % right stem
y5l=y6l; x6=x6'=x3;
if serifs: y6'l=min(3/5h,y6l-hair+1.05stem); fi
if serifs:
 if ((y6'l-y6l)>=middle_weight+1+eps):
  fill stroke z2'e{down}..z5e{right}...{.75(z5-z6)+z6'}z6'e;  % arc
 else:
  fill stroke pulled_arc.e(2',5) & z5e--z6e; fi % arc
 numeric inner_jut; pickup tiny.nib;
 if rt x1r+jut+.5u+1<=lft x3l-jut: inner_jut=jut;
  else: rt x1r+inner_jut+.5u+1=lft x3l-inner_jut; fi
%%%
 save slab; slab:=Vround(vair-vair_corr); % lower.slab
 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
 slab:=vair; % lower.slab
 dish_serif(4,3,g,1/3,inner_jut,h,1/3,jut);	% lower right serif
else: fill stroke pulled_arc.e(2',5) & z5e{right}...{right}z6e; fi % arc
%%%%%
% the accent
_one:=7; _two:=8; _center:=x4;
%
numeric dot_diam#; dot_diam#=max(dot_size#,cap_curve#);
define_whole_blacker_pixels(dot_diam);
pos[_one](dot_diam,0); pos[_two](dot_diam,90);
x[_one]=hround(_center); bot y[_two]l=vround(-d-1);
if 0-oo-top y[_two]r<slab: y[_one]r:=vround(max(y[_two]l+eps,-fine-slab)); fi
x[_one]=x[_two]; y[_one]=vround(.5[y[_two]l,y[_two]r]);
dot([_one],[_two]);  % dot
penlabels(1,2,3,4,5,6, 7,8); endchar;

endinput;

lhchar "Lowercase Cyrillic letter o_lcom - o lower comma";
cyrchar(o_lcom,9u#,x_height#,1.25desc_depth#);
italcorr .7x_height#*slant;
adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
penpos1(vair,90); penpos3(vair',-90); penpos2(curve,180); penpos4(curve,0);
x2r=hround max(.5u,1.25u-.5curve);
x4r=w-x2r; x1=x3=.5w; y1r=h+vround 1.5oo; y3r=-oo;
y2=y4=.5h-vair_corr; y2l:=y4l:=.52h;
penstroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & pulled_arc.e(3,4) & pulled_arc.e(4,1) & cycle;  % bowl
% the accent
%ac_comma(0,-oo,1.25desc_depth, 5,6,7,8,9);
 x_move:=0; y_move:=-oo; depth:=1.25desc_depth;
  _zero:=5; _one:=6; _two:=7; _three:=8; _four:=9;
 numeric height,bulb_diam;
 height=if serifs: depth+.5fine-max(.27depth,o+hair) else:.68depth fi;
 bulb_diam=max(fine.breadth,min(dot_size,floor(.56height)));
 if square_dots: pickup fine.nib; pos[_one](vair,0);
  pos[_two](.5[vair,stem],0);
  % comma below letter as sans serif cedilla
   top y[_one]=-o-2; bot y[_two]=-d-o;
   x[_two]=x[_one]-1.25u=.5w+x_move;
  filldraw stroke z[_one]e--z[_two]e;   % diagonal
 else: pickup fine.nib;
  x[_four]-.5bulb_diam=hround(.5w+x_move-.5bulb_diam);
  y[_four]+.5bulb_diam=-d+y_move+height;
  pos[_four](bulb_diam,90);
  pos[_one](vair,90); pos[_two](vair,0); pos[_three](vair,-45);
  z[_one]r=z[_four]r; rt x[_two]r=hround(x[_four]+.5bulb_diam
   +if monospace:.28u / expansion_factor else:.25u fi)+2eps;
  x[_three]=x[_four]-.5u if monospace: /expansion_factor fi;
  y[_two]=1/3[y[_one],y[_three]];
  bot y[_three]r=vround(y[_four]-(height-.5bulb_diam));
  y_:=ypart((z[_one]{right}...z[_two]{down}...z[_three])
   intersectiontimes (z[_four]l{right}..{left}z[_four]r));
  if y_<0: y_:=1; fi
  filldraw z[_four]r{left}..subpath (0,y_)
   of (z[_four]l{right}..{left}z[_four]r)--cycle; % dot
  filldraw stroke z[_one]e{right}...z[_two]e{down}...z[_three]e; fi  % tail
 penlabels([_zero],[_one],[_two],[_three],[_four]);
penlabels(1,2,3,4, 5,6,7,8,9); endchar;

lhchar "Lowercase Cyrillic letter u_com";
cyrchar(u_com,if serifs:9.5u# else:9u# fi,
	x_height#+1.25acc_height#,desc_depth#); % eng
italcorr x_height#*slant+.25u#;
adjust_fit(serif_fit# if monospace:+\\.5u#,.5u#+ else:,fi\\ serif_fit#);
full_h:=h; h:=x_height;
% lower_u;
numeric left_stem,right_stem,bot_stem,bot_vair,outer_jut;
left_stem=fudged.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=.75jut;
x1l=w-x4r=l+letter_fit+outer_jut+.25u; y1=y4r=h; y2=y3=0; x2l=x3l;
numeric alpha,alpha[]; x9=3u; y9=bot_vair-d-oo;
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*bot_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);
if y0>notch_cut:
 y0:=notch_cut;
 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
else:
 fill z0--diag_end(0,4l,1,1,4r,3r)--z3r--z2l
  --diag_end(2l,1l,1,1,1r,0)--cycle; fi % left and right diagonals
penpos5(alpha*bot_stem,0); z5r=whatever[z3r,z4r]; y5-.5vair=-.5d;
if serifs:
 numeric light_bulb; light_bulb=hround 7/8[hair,flare]; clearpen;
 penpos6(vair,-90); penpos7(hair,-180); penpos8(light_bulb,-180);
 x6=2u; y6r=-d-oo; y8-.5light_bulb=-.85d; x8r=hround .35u;
 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+jut+.5u+1<=lft x4'l-jut: inner_jut=jut;
  else: rt x1'r+inner_jut+.5u+1=lft x4'l-inner_jut; fi
 save slab; slab:=Vround(vair-vair_corr); % lower.slab
 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(bot_vair,-90); x6=2.5u; y6r=-d-oo;
 fill stroke z3e---z5e...{left}z6e;  % arc
 pickup fine.nib; pos6'(bot_vair,-90); z6'=z6;
 pos7(2/3[bot_vair,flare],-85);
 lft x7l=hround u; bot y7r=vround-.96d-oo; y7l:=good.y y7l;
 filldraw stroke term.e(6',7,left,1,4); fi % arc and terminal
%%%%%
% the accent
h:=full_h;
%ac_comma((.5[x1,x4]-.5w),0,1.25acc_height, 10,11,12,13,14)(above);
 x_move:=(.5[x1,x4]-.5w); y_move:=0; depth:=1.25acc_height;
  _zero:=10; _one:=11; _two:=12; _three:=13; _four:=14;
 numeric height,bulb_diam;
 height=if serifs:
  depth+.5fine-max(.27depth,o+hair) else:.68depth fi;
 bulb_diam=max(fine.breadth,min(dot_size,floor(.56height)));
 if square_dots: pickup fine.nib; pos[_one](vair,0);
  pos[_two](.5[vair,stem],0);
  %comma above letter: vertical
   top y[_two]=h+y_move;
   bot y[_one]=vround(y[_two]-height);
   x[_two]=x[_one]=.5w+x_move;
  filldraw stroke z[_one]e--z[_two]e;   % diagonal
 else: pickup fine.nib;
  x[_four]-.5bulb_diam=hround(.5w+x_move-.5bulb_diam);
  y[_four]+.5bulb_diam=h+y_move;
  pos[_four](bulb_diam,90);
  pos[_one](vair,90); pos[_two](vair,0); pos[_three](vair,-45);
  z[_one]r=z[_four]r; rt x[_two]r=hround(x[_four]+.5bulb_diam
   +if monospace:.28u / expansion_factor else:.25u fi)+2eps;
  x[_three]=x[_four]-.5u if monospace: /expansion_factor fi;
  y[_two]=1/3[y[_one],y[_three]];
  bot y[_three]r=vround(y[_four]-(height-.5bulb_diam));
  y_:=ypart((z[_one]{right}...z[_two]{down}...z[_three])
   intersectiontimes (z[_four]l{right}..{left}z[_four]r));
  if y_<0: y_:=1; fi
  filldraw z[_four]r{left}..subpath (0,y_)
   of (z[_four]l{right}..{left}z[_four]r)--cycle; % dot
  filldraw stroke z[_one]e{right}...z[_two]e{down}...z[_three]e; fi  % tail
 penlabels([_zero],[_one],[_two],[_three],[_four]);
penlabels(0,1,2,3,4,5,6,7,8,9, 10,11,12,13,14); endchar;
%
% there is endinput
%%%%%%%%%%%%%%%%%%%
