%
% lgt2loi.mf
%
%% Cyrillic font container with T2 encoding beta-support
%
% This file is future part of lxfonts package
% Version 3.4 // 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:
%
% Italic Cyrillic letters 0--127 for T2 encoding
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% List of letternames and their codes in T2
%
%                X2      T2A  T2B  T2C
%
% ae            "61  a   "ac   -    -    Ligature AE
% tshe          "62  b   "a2   -    -    Tshe
% dje           "63  c   "a3   -    -    Dje
% abh_ch        "64  d    -    -   "b1   Abkhasian che (same as lower e with hook)
% abh_ch_dsc    "65  e    -    -   "b2   Abkhasian che descender
% k_vcrs        "66  f   "ab   -    -    Ka vertically crossed
% k_hcrs        "67  g    -    -   "ab   Ka horisontally crossed
% l_dsc         "68  h    -   "aa  "aa   El with descender
% lat_i         "69  i    -    -    -    Latin letter I (goes first for LH font)
% lat_j         "6a  j    -    -    -    Je - Latin letter J
% lje           "6b  k   "a7  "a8   -    Lje
% m_dsc         "6c  l    -    -   "a8   Em with descender
% nje           "6d  m   "bb  "b9   -    Nje
% abh_ha        "6e  n    -    -   "b7   Abkhasian kha
% p_tl          "6f  o    -    -   "a0   Pe with tail
%
% r_dsc         "70  p    -    -   "a5   Er with descender
% lat_q         "71  q    -    -    -    Latin letter Q
% t_dsc         "72  r    -    -   "a2   Te with descender
% lat_s         "73  s   "af   -    -    Dze - Latin letter S
% tetse         "74  t    -    -   "a1   Ligature Te-Tse
% dzhe          "75  u   "b6   -   "b6   Dzhe
% ch_vcrs       "76  v   "b7   -    -    Che vertically crossed
% lat_w         "77  w    -    -    -    Latin letter W
% yat           "78  x    -    -    -    Yat
% b_yus         "79  y    -    -    -    Big Yus
% izh           "7a  z    -    -    -    Izhitsa
%
% n_ltl         "1d       -    -   "b9   En with left tail
% delta         "1f       -   "a6   -    Delta
% m_tl           -        -    -   "ae   Em with tail
% r_gcrs         -        -    -   "a6   Er grave crossed
% s_acrs         -        -    -   "b1   Es acute crossed
% g_crsdsc       -        -   "a0   -    Ghe crossed with descender
% h_hcrs         -        -   "b4   -    Kha horisontally crossed
%
% semisn         -        -    -   "b3   Semi Soft Sign
% i_shdsc        -        -    -   "b4   I Short with descender
% r_tl           -        -    -   "bb   Er with tail
%

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

iff knuthian_ae:%
lhchar "Italic Cyrillic letter ae - ligature ae";
cyrchar(ae,13u#,x_height#,0);
italcorr max(1/3x_height#*slant,x_height#*slant+.5(.2[hair#,stem#])-u#);
adjust_fit(if monospace:-u#,-u# else: 0,0 fi); pickup fine.nib;
forsuffixes $=hair,stem: shaved$:=mfudged$; save $; $=shaved$; endfor
%numeric heavy_hair; heavy_hair=hround .2[hair,stem];%defined in lxpseudo
numeric light_stem; light_stem=hround .75[hair,stem];
pos0(vair,-90); pos1(heavy_hair,0); pos2(vair,90);
pos3(light_stem,180); pos4(vair,270); pos5(hair,320);
x0=rt x3l; rt x1r=hround(w-1.5u+.5heavy_hair); x2=x4=.5(w+6u);
lft x3r=hround(.5w-.5light_stem); x5r=good.x(w-.5u); x6=x5;
y0=y3=y6=bar_height; y1=.5[y0,y2]; top y2r=h+oo; bot y4r=-oo;
top y5l=vround(.5bar_height+.5); path p; p=z4{right}..z5..z6;
filldraw stroke z0e{right}...z1e{up}...pulled_arc.e(2,3)
 & pulled_arc.e(3,4)...{direction 1 of p}z5e;  % arc of e
pos7(light_stem,0); pos8(light_stem,0);
x7=x8=x3; y7+.5light_stem=h+oo; y8-.5light_stem=-oo;
pos7'(vair,-225); pos11(curve,-180); z7'=z7;
pos12(vair,-90); pos3'(hair,0); z3'=z3;
lft x11r=hround(1.5u-.5curve); x12=.5[x11,x3];
y11=.3[y12,y7]; bot y12r=-oo;
filldraw stroke z7'e{3(x11-x7),y11-y7}...pulled_arc.e(11,12)
 & pulled_arc.e(12,3');  %  bowl of a
filldraw z7l---z8l..z8r---z7r..cycle;  % stem
penlabels(0,1,2,3,4,5,6,7,8,11,12); endchar;

iff not knuthian_ae: % borrowed from ec
lhchar "Italic Cyrillic letter ae - ligature ae";
cyrchar(ae,13u#,x_height#,0);
italcorr max(1/3x_height#*slant,x_height#*slant+.5(.2[hair#,stem#])-u#);
adjust_fit(if monospace:-u#,-u# else: 0,0 fi); pickup fine.nib;
forsuffixes $=hair,stem: shaved$:=mfudged$; save $; $=shaved$; endfor
numeric light_stem; light_stem=hround .75[hair,stem];
pos0(vair,-90); pos1(heavy_hair,0); pos2(vair,90);
pos3(light_stem,180); pos4(vair,270); pos5(hair,320);
x0=rt x3l; rt x1r=hround(w-1.5u+.5heavy_hair); x2=x4=.5(w+6u);
lft x3r=hround(.5w-.5light_stem); x5r=good.x(w-.5u); x6=x5;
y0=y3=y6=bar_height; y1=.5[y0,y2]; top y2r=h+oo; bot y4r=-oo;
top y5l=vround(.5bar_height+.5); path p; p=z4{right}..z5..z6;
filldraw stroke z0e{right}...z1e{up}...pulled_arc.e(2,3)
 & pulled_arc.e(3,4)...{direction 1 of p}z5e;  % arc of e
pos7(light_stem,0);
x7=x3; y7+.5light_stem=h+oo;
pos7'(vair,-225); pos10(vair,-270);
pos11(curve,-180); z7'=z7;
pos12(vair,-90); pos3'(hair,0); z3'=z3;
lft x11r=hround(1.5u-.5curve); x10=x12=.5[x11,x3];
top y10r=h+oo; y11=.52h; bot y12r=-oo;
filldraw stroke pulled_arc.e(3',10) & pulled_arc.e(10,11)
 & pulled_arc.e(11,12) & pulled_arc.e(12,3');  %  bowl of a
filldraw z7l---z3r..z3l---z7r..cycle;  % stem
penlabels(0,1,2,3,4,5,6,7,10,11,12); endchar;

lhchar "Italic Cyrillic letter abh_ch - lower e hook";
cyrchar(abh_ch,8u#,x_height#,0);
italcorr max(1/3x_height#*slant,x_height#*slant+.5(.2[hair#,stem#])-u#);
adjust_fit(max(2u#,1.5u#+.5flare#),0);
% ital_e;
pickup fine.nib; %numeric heavy_hair; heavy_hair=hround .2[hair,stem];%defined in lxpseudo
pos0(vair,-90); pos1(heavy_hair,0); pos2(vair,90);
pos3(curve,180); pos4(vair,270); pos5(hair,320);
x0=rt x3l; rt x1r=hround(w-1.5u+.5heavy_hair); x2=x4=.5(w+u);
lft x3r=hround(1.5u-.5curve); x5r=good.x(w-eps); x6=x5;
y0=y3=y6=bar_height; y1=.5[y0,y2]; top y2r=h+oo; bot y4r=-oo;
top y5l=vround .5bar_height; path p; p=z4{right}..z5..z6;
filldraw stroke z0e{right}...z1e{up}...pulled_arc.e(2,3)
 & pulled_arc.e(3,4)...{direction 1 of p}z5e;  % arc
% bulb
y7=y3; x7=x3r; pos7(vair,-90); y9=.5[y3,y2];
lft x9r=l+letter_fit+hround (.5u-.5); %l+.5u;
pos9(flare,-180); z8r=z9r; pos8(hair,-180);
cyrbulb(7,8,9);
penlabels(1,2,3,4,5,6,7,8,9); endchar;

lhchar "Italic Cyrillic letter abh_ch_dsc - lower e hook ogonek";
cyrchar(abh_ch_dsc,8u#,x_height#,desc_depth#);
italcorr max(1/3x_height#*slant,x_height#*slant+.5(.2[hair#,stem#])-u#);
adjust_fit(max(2u#,1.5u#+.5flare#),0);
% ital_e;
pickup fine.nib;
%numeric heavy_hair; heavy_hair=hround .2[hair,stem];%defined in lxpseudo
pos0(vair,-90); pos1(heavy_hair,0); pos2(vair,90);
pos3(curve,180); pos4(vair,270); pos5(hair,320);
x0=rt x3l; rt x1r=hround(w-1.5u+.5heavy_hair); x2=x4=.5(w+u);
lft x3r=hround(1.5u-.5curve); x5r=good.x(w-eps); x6=x5;
y0=y3=y6=bar_height; y1=.5[y0,y2]; top y2r=h+oo; bot y4r=-oo;
top y5l=vround .5bar_height; path p; p=z4{right}..z5..z6;
filldraw stroke z0e{right}...z1e{up}...pulled_arc.e(2,3)
 & pulled_arc.e(3,4)...{direction 1 of p}z5e;  % arc
% bulb
y7=y3; x7=x3r; pos7(vair,-90); y9=.5[y3,y2];
lft x9r=l+letter_fit+hround (.5u-.5); %l+.5u;
pos9(flare,-180); z8r=z9r; pos8(hair,-180);
cyrbulb(7,8,9);
% descender-ogonek
 path p.r; p.r=pulled_arc.r(3,4)...{direction 1 of p}z5r;
 def the_pen=
     if known ogonek_pen: ogonek_pen else: fine fi
 enddef;
 ogonek_breadth:=xvair;
 numeric tt; % the time...
 tt=if hefty: 2.8 else: 2.6 fi+eps;
 join_angle=angle((direction tt of p.r) rotated 180);
 ogonek_pos=point tt of p.r+.5(the_pen-fine)*
    unitvector((direction tt of p.r) rotated 90)-(ogonek_breadth-the_pen,0);
easy_ogonek(the_pen,10,11,12); % ogonek
penlabels(1,2,3,4,5,6,7,8,9, 10,11,12); endchar;

lhchar "Italic Cyrillic letter k_vcrs - ka vcrossed";
cyrchar(k_vcrs,10u#,x_height#,0); %k+2u
italcorr x_height#*slant;
adjust_fit(if monospace:-1.5u# else: 0 fi,0);
pickup fine.nib; x2-.5stem=hround(2.5u-.5stem);
%ihalfstem;
if monospace:
 pos2(stem,0); top y2=h;
else:
 x0=0; hook_in(0,1,2); fi % opening hook
z2'=z2; pos2'(stem,0); x11=x2'; y11-.5stem=-oo; pos11(stem,0);
filldraw circ_stroke z11e--z2'e;  % left stem
pos3(vair,90); pos3'(vair,90); x3=x11; y3=y3'=bar_height; x3'=.5[x11,x7];
pos4(vair,90); x4=w-2u; top y4r=x_height+oo;
pos5(hair,0); pos6(flare,0);
rt x5r=hround(w-.5u); y5+.5flare=vround(bot y4l-.03x_height);
pos7(stem,0); pos8(vair,90); pos9(hair,180);
x9+.5hair=hround(w+.5hair-eps); y9=1/3x_height;
lft x7l=hround(w-2.75u-.5stem); y7=1/2y3; x8=w-1.2u; bot y8l=-oo;
filldraw stroke z3e{right}--z3'e{right}..{right}z4e;  % upper diagonal
bulb(4,5,6);  % bulb
filldraw stroke z3e{right}--z3'e{right}...z7e{down}
 ...z8e{right}...{up}z9e;  % lower diagonal
% vcross
pickup fine.nib; numeric middle_weight;
middle_weight=max(fine.breadth,.6[thin_join,vair]);
pos10(middle_weight,0); pos12(middle_weight,0);
lft x10l=lft x12l=hround(max(x3',.5[x3,x3'])-.5middle_weight+eps);
top y12-bot y10=.5x_height; .52[y10,y12]=y3;
filldraw stroke z10e--z12e;
penlabels(1,2,3,4,5,6,7,8,9); endchar;

lhchar "Italic Cyrillic letter k_hcrs - ka hcrossed";
cyrchar(k_hcrs,8u#,asc_height#,0);
italcorr x_height#*slant;
adjust_fit(0,0);
% ital_k;long stem
pickup tiny.nib; pos1(stem,0); pos2(stem,0); x1=x2;
lft x1l=hround(1.5u-.5stem); top y1=h; y2-.5stem=-oo;
filldraw circ_stroke z2e--z1e;  % left stem
sloped_serif.l(1,2,a,1/3,jut,serif_drop);  % serif
pickup fine.nib; pos3(vair,90); x3=x1; y3=bar_height;
pos4(vair,90); x4=w-2u; top y4r=x_height+oo;
filldraw stroke z3e{right}..{right}z4e;  % upper diagonal
pos5(hair,0); pos6(flare,0);
rt x5r=hround(w-.5u); y5+.5flare=vround(bot y4l-.03x_height);
bulb(4,5,6);  % bulb
pos7(stem,0); pos8(vair,90); pos9(hair,180);
x9+.5hair=hround(w+.5hair-eps); y9=1/3x_height;
lft x7l=hround(w-2.75u-.5stem); y7=1/2y3; x8=w-1.2u; bot y8l=-oo;
filldraw stroke z3e{right}...z7e{down}
 ...z8e{right}...{up}z9e;  % lower diagonal
% hcross
pickup crisp.nib; numeric outer_jut;
outer_jut=max(limit_dist,1.1jut);
pos10(bar,90); pos11(bar,90);
top y11r=top y10r=vround (min(.5[x_height,h]+.5bar,h-max(bracket,1.2slab))-eps);
x11=x1r+1.15outer_jut; lft x10=hround-.75u;
filldraw stroke z10e--z11e; % cross bar
penlabels(1,2,3,4,5,6,7,8,9, 10,11); endchar;

lhchar "Italic Cyrillic letter l_dsc - el descender";
cyrchar(l_dsc,9u#,x_height#,desc_depth#);
italcorr 1/3x_height#*slant+.5hair#+.5u#;
adjust_fit(.5u#,.1u#); %iserif_adj
% ital_l;dsc
pickup fine.nib;
pos1(vair,-90); pos2(stem,180); pos3(hair,0); pos10(stem,0);
pos4(vair,-90); pos5(hair,-180); pos6(flare,-180);
top y1l=h+oo; x1=.5[x3,x2];
x3=3u; y3=.35h;
y6-.5flare=.1h; lft x6r=-.25u; z5r=z6r;
bot y4r=-oo; x4=max(.4[lft x6r,rt x3r],lft x6r+.5flare-eps);
y10=.8h; lft x10l=lft x7l=hround(w-2.5u-.5stem); z10=z2;
bulb(4,5,6); % bulb
filldraw stroke pulled_arc.e(4,3)
 & super_arc.e(3,1) & super_arc.e(1,2); % left stem
pos8(vair,90); pos9(vair,180); pos7(stem,0);
x9=w; y9=y7=.4bar_height; x8=.5[x7,x9]; bot y8l=-oo;
filldraw circ_stroke z7e{-.5u,-x_height}...z8e{right}...{up}z9e; %closing hook
filldraw stroke z10e--z7e;  % stem tail
%%%
% italic descender/ogonek
if is_ogonek:
   def the_pen=
       if known ogonek_pen: ogonek_pen else: fine fi
   enddef;
   path p.l;
   p.l=z7l{-.5u,-x_height}...z8l{right}...{up}z9l;
   ogonek_breadth:=xvair;
   ogonek_pos=point .9 of p.l;
   easy_ogonek(the_pen,11,12,13); % ogonek
else:
   i_serif(9,x);
fi
penlabels(1,1',2,3,4,5,6,7,8,9,10, 11,12,13); endchar;

lhchar "Italic Cyrillic letter m_dsc - m descender";
cyrchar(m_dsc,13u#,x_height#,desc_depth#);
italcorr 1/3x_height#*slant+.5hair#+.5u#; %u
adjust_fit(if monospace:-.5u# else:.5u# fi, %wbulb_adj
 .1u#); %iserif_adj
%ital_m;dsc
pickup fine.nib;
pos1(hair,0); pos6(stem,0);
pos2(hair,0); pos3(vair,-90); pos4(hair,-180); pos5(flare,-180);
x1=x2=3u; y2=.35h; top y1=h; bot y3r=-oo; lft x5r=-.25u; z4r=z5r;
x3=min(lft x5r+flare,lft x2l-eps); y5-.5flare=.1h;
bulb(3,4,5); % bulb
filldraw stroke pulled_arc.e(3,2) & z2e--z1e; % left stem
rt x7r=hround(w-2.5u+.5stem); %!!! x9=w; hook_out(7,8,9); % closing hook
pos7(stem,0); pos8(vair,90); pos9(vair,180); %!!!
x9=w; y9=y7=.4bar_height; x8=.5[x7,x9]; bot y8l=-oo;
filldraw circ_stroke z7e{-.5u,-x_height}...z8e{right}...{up}z9e; % closing hook
x6=x7; top y6=h;
filldraw stroke z6e--z7e; % right stem
% diagonals;m
numeric stem[]; % thicknesses of the strokes
stem1=hround(fudged.stem-stem_corr);
stem2=min(stem1,hround(fudged.hair-stem_corr));
penpos10(stem1,0); penpos11(stem1,0); penpos12(stem2,0); penpos13(stem2,0);
x10l=lft x1l; x11l=x12l; x13l=lft x7l; x11-x10=x13-x12;
y10=y13=top y6; y11=y12;
if hefty:
 y11=if monospace: vround 1/3h-.5stem1 else: oo fi;
 numeric upper_notch,lower_notch;
 upper_notch=h-notch_cut; lower_notch=y11+notch_cut;
 x1'=rt x1r; z1'=whatever[z10l,z11l];
 x6'=lft x6l; z6'=whatever[z12r,z13r];
 z0=whatever[z10r,z11r]=whatever[z12l,z13l];
 fill z10l..
  if y1'<upper_notch: {right}(x1'+1,upper_notch){down}... fi
  {z11-z10}diag_in(10l,11l,1,11r)..diag_out(12l,1,12r,13r){z13-z12}
  if y6'<upper_notch: ...{up}(x6'-1,upper_notch){right} fi
  ..z13r--diag_out(13r,1,13l,12l){z12-z13}
  if y0<=lower_notch: ..{z12-z13}z0{z10-z11}..
   else: ...{down}(x0+.5,lower_notch)--(x0-.5,lower_notch){up}... fi
  {z10-z11}diag_in(11r,10r,1,10l)--cycle;  % diagonals
else:
 y11=0; z0=whatever[z10r,z11r]=whatever[z12l,z13l];
 fill z10l..{z11-z10}diag_in(10l,11l,1,11r)..diag_out(12l,1,12r,13r){z13-z12}
  ..z13r--diag_out(13r,1,13l,12l){z12-z13}..{z12-z13}z0{z10-z11}
  ..{z10-z11}diag_in(11r,10r,1,10l)--cycle; fi  % diagonals
% italic descender/ogonek
if is_ogonek:
   def the_pen=
       if known ogonek_pen: ogonek_pen else: fine fi
   enddef;
   path p.l;
   p.l=z7l{-.5u,-x_height}...z8l{right}...{up}z9l;
   ogonek_breadth:=xvair;
   ogonek_pos=point .9 of p.l;
   easy_ogonek(the_pen,14,15,16); % ogonek
else:
   i_serif(9,x);
fi
penlabels(1,2,3,4,5,6,7,8,9,10,11,12,13, 14,15,16);
endchar;

lhchar "Italic Cyrillic letter abh_ha - Abkhasian ha";
cyrchar(abh_ha,9.25u#+width_adj#,x_height#,desc_depth#);
italcorr .7x_height#*slant+.5curve#-u# if math_fitting:-.5u# fi;
adjust_fit(if monospace:0,0 else: -.35u#,-.35u# fi); %o
pickup fine.nib;
numeric right_curve,mid_curve;
right_curve=.7[.7[thin_join,vair],curve] if hefty:-stem_corr fi;
mid_curve=.5[.7[thin_join,vair],curve] if hefty:-2stem_corr fi;
penpos1(vair,90); penpos3(vair',-90);
penpos2(curve,180); penpos4(right_curve,0);
interim superness:=more_super; x2r=hround u;
x4r=w-x2r; x1=x3=x6=.5w; y1r=h+vround 1.5oo; y3r=-oo;
y2=y4=.5h-vair_corr; y2l:=.52h;
y7=-1/3d; rt x7=hround(w-.5u); penpos7(.7[thin_join,vair],270);
y6=.5y5r; penpos6(mid_curve,180);
x5=if serifs:.5[x6,x4]else:.5[x6,x4]fi;
y5r=.5[y4,y1]; penpos5(.7[thin_join,vair],90);
fill stroke pulled_super_arc.e(1,2)(.5superpull)
 & pulled_super_arc.e(2,3)(.5superpull)
 & pulled_super_arc.e(3,4)(.5superpull) % 3/4 bowl
 & pulled_super_arc.e(4,5)(.25superpull)
 & pulled_super_arc.e(5,6)(.75superpull)
 & pulled_super_arc.e(6,7)(.5superpull); % 6/4 bowl
fill z7l--z7r{right}..{up}
 if fine.top y7r>fine.bot y7l:
    (fine.rt x7,y7)
 else:
    (fine.rt x7,fine.top y7r)--(fine.rt x7,fine.bot y7l)
 fi
 {up}..{left} cycle;
z1'=z1; z4'=z4; pos1'(vair,90); pos4'(.75[.7[thin_join,vair],curve],0);
forsuffixes e=l,r: path quarta.e;
quarta.e=pulled_super_arc.e(1',4')(.5superpull); endfor
numeric quart;
quart=min(
      ypart(quarta.r intersectiontimes ((0,top y5r+vair)--(w,top y5r+vair))),
      ypart(quarta.r intersectiontimes ((rt x5,0)--(rt x5,h))));
filldraw stroke subpath (0,.67) of quarta.e; %quart
penlabels(1,2,3,4,5,6,7); endchar;

lhchar "Italic Cyrillic letter p_tl - pe tail";
cyrchar(p_tl,13u#,x_height#,desc_depth#); %13.5
italcorr (-.3x_height#+bar_height#)*slant; %o:.7h-(h-bar_height)
adjust_fit(if monospace:-1.5u#,-1.5u# else: 0,0 fi);
pickup fine.nib;
numeric shaved_stem; shaved_stem=mfudged.stem; save stem; stem=shaved_stem;
pos2(stem,0); x1=x2;
if monospace:
 pos1(stem,0); lft x1l=hround(2.5u-.5stem); top y1=h;
else:
 x0=0; lft x2l=hround(2.5u-.5stem);
 hook_in(0,a,1); fi  % opening hook
y2-.5stem=-oo; filldraw circ_stroke z2e--z1e;  % left stem
x4+.5stem=hround(7u+.5stem); ital_arch(2,3,4);  % left arch
pos5(stem,0); y5=y2; x5=x4;
filldraw circ_stroke z5e--z4e;  % middle stem
% hook(4);
pos3'(vair,90); x3'=x4; y3'=bar_height;
lft x7l=hround(w-1.5u-.5stem); y7=.45y3'; pos7(stem,0);
pos9(vair,-90); pos10(hair,-180); pos11(flare,-180); pos8(stem,0); x8=x7;
bot y8=-1/3d; bot y9r=-d-oo; y11-.5flare=-vround.9d;
x9=w-11/3u; lft x10r=min(x7-4u,lft x10r+x9-x10l+4u-eps);
filldraw stroke z3'e{right}...z7e{down}---z8e...{left}z9e;
bulb(9,10,11);  % bulb
penlabels(0,a,1,2,3,4,5,6,7,8,9,10,11); endchar;

lhchar "Italic Cyrillic letter r_dsc (looks like p)";
cyrchar(r_dsc,if monospace: 9u# else: 9.25u# fi,x_height#, % rusw
 max(1.6desc_depth#,paren_depth#));%r_ddepth
italcorr .7x_height#*slant+.5curve#-u# if math_fitting:-.5u# fi; %p
adjust_fit(0,if monospace:0 else:-.35u# fi);
full_d:=d; d:=vround min(desc_depth,max(vair+slab+oo+1+eps,full_d-max(.4desc_depth,.55beak)-slab));%r_dscs
% ital_r;
pickup fine.nib;
x0=0; x2-.5stem=hround(2.5u-.5stem); hook_in(0,1,2);  % opening hook
pos4(hair,-180); pos5(vair,-90); pos6(curve,0); pos7(vair,90);
x4=x2; rt x6r=hround(w-1.5u+.5curve); x5=x7=.5[x4,x6];
bot y5r=-oo; top y7r=h+oo; y4=y6=.5[y5,y7];
filldraw stroke super_arc.e(4,5) & pulled_arc.e(5,6)
 & pulled_arc.e(6,7) & super_arc.e(7,4);  % bowl
pickup tiny.nib; pos2'(stem,0); pos3(stem,0);
z2=z2'; x3=x2; bot y3=-d; filldraw stroke z2'e--z3e;  % stem
%%%
if is_ogonek:
   dish_serif(3,2',a,1/3,.75jut,b,1/3,jut);  % serif
fi
%%%
% r_descender/ogonek
if is_ogonek:
   d:=d+desc_depth;
   def the_pen=
       if known ogonek_pen: ogonek_pen else: fine fi
   enddef;
   ogonek_breadth:=xvair;
   ogonek_pos=(x3,y3+.5the_pen) if not is_egyptian: +(.5xvair,0) fi;
   ogonek_move=bot y3;
   easy_ogonek(the_pen,8,9,10); % ogonek
   chardp:=d/hppp;
else:
   d:=full_d;
   numeric right_jut; right_jut=1.414jut;
   r_serif(3,2',o,1/3,.75jut,p,1/3,beak_darkness,right_jut,.35beak_jut); % lower left serif
fi
penlabels(0,1,2,3,4,5,6,7, 8,9,10); endchar;

lhchar "Italic Cyrillic letter lat_q";
cyrchar(lat_q,8u#,x_height#,desc_depth#);
italcorr x_height#*slant+.5stem#-u#;
adjust_fit(0,0); pickup fine.nib;
pos0(hair,0); pos1(vair,90); pos2(curve,180); pos3(vair,270);
x0=x4; x1=x3=.5[x0,x2]; lft x2r=hround(1.5u-.5curve);
x4+.5stem=hround(w-1.5u+.5stem)+eps;
top y1r=h+oo; bot y3r=-oo; y0=y2=.5[y1,y3];
filldraw stroke super_arc.e(0,1) & pulled_arc.e(1,2)
 & pulled_arc.e(2,3) & super_arc.e(3,0);  % bowl
pickup tiny.nib; pos4(stem,0); pos5(stem,0);
x4=x5; x6=x5r; top y6=h+oo; bot y4=-d;
y5=ypart(((x4l,0)--(x4l,y6))intersectionpoint super_arc.r(0,1));
filldraw z6{2(x5l-x6),y5-y6}...z5l---z4l--z4r--cycle;  % stem
dish_serif(4,5,a,1/3,jut,b,1/3,jut);  % serif
penlabels(0,1,2,3,4,5,6,7,8); endchar;

lhchar "Italic Cyrillic letter t_dsc - te descender";
cyrchar(t_dsc,15u#,x_height#,desc_depth#);
italcorr 1/3x_height#*slant+.5hair#+.5u#;
adjust_fit(if monospace:-1.5u# else: 0 fi,.1u#); %lstem_adj&iserif_adj
% ital_t;
begingroup
pickup fine.nib; numeric shaved_stem; shaved_stem=mfudged.stem;
save stem; stem=shaved_stem; pos2(stem,0); x1=x2;
% left stem_hook;
if monospace:
 pos1(stem,0); lft x1l=hround(2.5u-.5stem); top y1=h;
else:
 x0=0; lft x2l=hround(2.5u-.5stem);
 hook_in(0,a,1); fi % opening hook
y2-.5stem=-oo; filldraw circ_stroke z2e--z1e;  % left stem
x4+.5stem=hround(.5w+.5stem); ital_arch(2,3,4);  % left arch
pos5(stem,0); y5=y2; x5=x4;
filldraw circ_stroke z5e--z4e;  % middle stem
x7+.5stem=hround(w-2.5u+.5stem); ital_arch(5,6,7);  % right arch
x8=x7-.25u; x9=w; y8=1/4x_height; y9=.4bar_height;
x8'=.5[x8,x9]-.25u; bot y8'l=-oo;
pos8(stem,0); pos8'(vair,90); pos9(vair,180);
filldraw stroke z7e{down}..{-u,-x_height}z8e...z8'e{right}...{up}z9e; % hook (7,8,9)(skewed)
endgroup;
% italic descender/ogonek
if is_ogonek:
   def the_pen=
       if known ogonek_pen: ogonek_pen else: fine fi
   enddef;
   path p.l;
   p.l=z8l{-u,-x_height}...z8'l{right}...{up}z9l;
   ogonek_breadth:=xvair;
   ogonek_pos=point .9 of p.l;
   easy_ogonek(the_pen,10,11,12); % ogonek
else:
   z10=z9; pos10(hair,180);
   i_serif(10,x);
fi
penlabels(0,a,1,2,3,4,5,6,7,8,9, 10,11,12); endchar;

lhchar "Italic Cyrillic letter tetse - ligature tetse";
cyrchar(tetse,10.75u#,x_height#,desc_depth#);
italcorr 1/3x_height#*slant+.5hair#+.5u#;
adjust_fit(max(2u#,u#+stem#),.1u#); %iserif_adj
pickup fine.nib; interim superness:=more_super;
x0=0; x2=x3; top y2=h; pos3(stem,-180); lft x3r=hround(2.5u-.5stem);
pos2'(stem,-180); z2'=z2; pos4(vair,-90); pos5(hair,0); x4=.5[x3,x5];
pos6(stem,0); rt x6r=hround(w-2.5u+.5stem);
x5=x6=x7; y3=.7[y4,y5]; bot y4r=-oo; y5=.57h; y6+.5stem=h;
filldraw stroke
 z2'e--super_arc.e(3,4)...{up}z5e; % left stem and arc
x9=w; y9=y7=.4bar_height; x8=.5[x7,x9]; bot y8l=-oo;
pos8(vair,90); pos9(vair,180); pos7(stem,0);
filldraw circ_stroke z6e--z7e;  % right stem
filldraw circ_stroke z7e{-.5u,-x_height}...z8e{right}...{up}z9e; % hook(7,8,9)
% italic descender
i_serif(9,x);
% italic beak
pickup fine.nib;
pos10(stem,180); pos11(stem,180); pos12(vair,90); pos13(vair,90);
lft x10r=l+letter_fit  if monospace:-.5stem else:+.25u fi;
y10-.5stem=2/3x_height-.5fine;
x13=0.6[x3,x7]; top y13r=top y12r=x_height; x11=x10; y11=bot y12l-.25flare;
x12-.25flare=rt x10l; x12r:=lft x10r+(top y12r-y11);
filldraw circ_stroke z10e{up}--z11e{up}...z12e{right}--z13e; % ital_beak;
penlabels(0,1,2,3,4,5,6,7,8,9,10,11,12,13); endchar;

lhchar "Italic Cyrillic letter ch_vcrs - che vcrossed";
cyrchar(ch_vcrs,9.5u#,x_height#,0);
italcorr 1/3x_height#*slant+.5hair#+.5u#;
adjust_fit(0,0);
% ital_ch;
pickup fine.nib; interim superness:=more_super;
x2=x3; pos3(stem,-180); lft x3r=hround(2.5u-.5stem);
% left shstem;
if monospace:
 pos0(vair,90); x0=good.x .5[0,x2]; top y0l=h; y2=2/3h; pos2(stem,0);
 filldraw stroke z2e{u,x_height}...{left}z0e; % terminal
else:
 x0=0;  hook_in(0,1,2)(skewed); fi % opening hook
pos2'(stem,-180); z2'=z2;
pos4(vair,-90); pos5(hair,0); x4=.5[x3,x5];
pos6(stem,0); rt x6r=hround(w-2.5u+.5stem);
x5=x6=x7; x9=w; hook_out(7,8,9);  % closing hook
bot y4r=.75bar_height; y5=.75h; y3=min(y2-eps,.7[y4,y5]); y6+.5stem=h;
filldraw stroke z2'e...super_arc.e(3,4)...{up}z5e; % left stem and arc
filldraw circ_stroke z6e--z7e;  % right stem
%%%
% vcross
pickup fine.nib; numeric middle_weight;
middle_weight=max(fine.breadth,.6[thin_join,vair]);
pos10(middle_weight,0); pos11(middle_weight,0);
lft x10l=lft x11l=hround (x4-.5middle_weight);
top y11-bot y10=.5x_height; .5[y10,y11]=y4;
filldraw stroke z10e--z11e;
penlabels(0,1,2,3,4,5,6,7,8,9, 10,11); endchar;

lhchar "Italic Cyrillic letter lat_w";
cyrchar(lat_w,12u#,x_height#,0);
italcorr x_height#*slant;
adjust_fit(if monospace:-1.5u#,-u# else: 0,0 fi);
pickup fine.nib; interim superness:=more_super; begingroup
forsuffixes $=hair,stem: shaved$:=mfudged$; save $; $=shaved$; endfor
x0=0; x2=x3+.25u; pos3(stem,-180); lft x3r=hround(2.5u-.5stem);
if monospace:
 pos1(vair,90); x1=good.x .5[x0,x2]; top y1r=h; y2=2/3h; pos2(stem,0);
 filldraw stroke z1e{right}...{-u,-x_height}z2e;
else:
 hook_in(0,1,2)(skewed); fi  % opening hook
pos2'(stem,-180); z2'=z2;
pos4(vair,-90); pos5(hair,0);
x4=.6[x2,x5]; x5=x6=x7; pos6(stem,-180); pos7(stem,-180);
y3=.7[y4,y5]; bot y4r=-oo; y5=.57h;
rt x6l=hround(rt x6l+.5w+.75u-x6); y6+.5stem=h; y7=y3;
pos8(vair,-90); pos9(hair,0);
x8=w-2.75u; rt x9r=hround(w-.5u); bot y8r=-oo; y9=y5;
filldraw stroke z2'e{-u,-x_height}
 ...super_arc.e(3,4)...{up}z5e; % left stem and arc
filldraw circ_stroke z6e..super_arc.e(7,8)...{up}z9e;  % middle stem and arc
v_bulb(9,10);  % closing bulb
endgroup;
penlabels(0,1,2,3,4,5,6,7,8,9,10); endchar;

lhchar "Italic Cyrillic letter n_ltl - en with left tail";
cyrchar(n_ltl,10u#,x_height#,desc_depth#);
italcorr 1/3x_height#*slant+.5hair#+.5u#; %u
adjust_fit(0,0);
pickup fine.nib; x2=x3; pos3(stem,0); lft x3l=hround(2.5u-.5stem);
%ihalfstemx;
if monospace:
 pos2(stem,0); top y2=h;
else:
 x0=0; hook_in(0,1,2); fi % opening hook
y3-.5stem=-oo;
filldraw stroke z3e--z2e; % left stem
x10=x3l; y10=y11=bar_height; pos10(vair,90); pos11(vair,90);
pos6(stem,0); rt x6r=hround(w-2.5u+.5stem); y6+.5stem=h;
x7=x6; x9=w; hook_out(7,8,9); % closing hook
z7'=z7; pos7'(stem,0); x11=x6l;
filldraw circ_stroke z6e--z7'e; % right stem
filldraw stroke z10e--z11e; % bar
%%%
pos12(vair,-90); pos13(hair,-180); pos14(flare,-180); pos5(stem,0);
x5=x3; bot y5=-1/3d; bot y12r=-d-oo; y14-.5flare=-vround.9d;
%x6=w-11/3u; lft x7r=min(x4-4u,lft x7r+x6-x7l+5u-eps);
%x12=(x3+2.5u-.5stem)-10/3u; lft x13r=min(x3-10/3u,lft x13r+x12-x13l+13/3u-eps);%!!!
x12=(x3+2.5u-.5stem)-9/3u; lft x14r=min(x3-8/3u,lft x13r+x12-x13l+11/3u-eps);%!!!
%filldraw circ_stroke z3e--z5e{down}...{left}z12e; % right stem and hook
 forsuffixes e=l,r:
 z12'e=((0,y14)--(w,y14)) intersectionpoint
	(z5e{down}...{left}z12e); endfor
 if lft x12'l>rt x14l+max(1,hround(1/3vair+.5)):
    filldraw stroke z3e--z5e{down}...{left}z12e; % right stem and hook
 else:
    x12'l:=min(rt x14l+max(1,1/3vair+.5),rt x12'r-vair)+.5fine-eps;
    filldraw z3r--z5r{down}...{left}z12r--z12l{right}
             ..z12'l{up}..{up}z3l--cycle;
 fi
bulb(12,13,14);  % bulb
penlabels(0,1,2,3,4,5,6,7,8,9,10); endchar;

iff serifs:
lhchar "Lowercase Cyrillic letter delta - Lowercase Greek delta";
cyrchar(delta,8u#,asc_height#,0);
italcorr .9asc_height#*slant+.5hair#-1.5u#;
adjust_fit(0,0); pickup fine.nib;
x0=-u; y0=1.1h;
numeric light_flare; light_flare=2/3[vair,flare];
x1=w-2u-.5light_flare; y1=h-.5light_flare;
numeric theta; theta=angle (z1-z0);
pos1(light_flare,theta-90); pos2(.2[vair,light_flare],-90); pos3(vair,theta);
x2=x3+u; y2=h;
x4=x6=.5w+.5u; top y8r=x_height+oo; z4=z8;
pos6(vair,-90); pos7(stem,-180); pos8(vair,-270);
pos4(stem,angle(z4-z0)+90); pos5(stem,30);
z3=.5[.5[z1,z4],z0];
y5+.1x_height=y7=.5[y6,y8]; bot y6=-oo;
lft x7r=hround(1.4u-.5stem); rt x5r=hround(w-u);
filldraw stroke z1e{z0-z1e}....z2e....z3e{(z0-z1)rotated 90}
 ...z4e{z4e-.8[z4,z0]}
 ....z5e{down}...pulled_arc.e(6,7) & pulled_arc.e(7,8);  % hook and bowl
filldraw z1r{z1r-z0}...z1l{z0-z1l}--cycle; % bulb
math_fit(-.3x_height#*slant+.5curve#-u#,.7x_height#*slant-.5u#);
penlabels(0,1,2,3,4,5,6,7,8); endchar;

lhchar "Italic Cyrillic letter m_tl - m tail";
cyrchar(m_tl,12u#,x_height#,desc_depth#);
italcorr 1/3x_height#*slant+.5hair#+.5u#; %u
adjust_fit(if monospace:-.5u#,-u# else:.5u#,0 fi); %wbulb_adj
%ital_m;tl
pickup fine.nib;
pos1(hair,0); pos2(hair,0); pos3(vair,-90); pos4(hair,-180);
pos5(flare,-180); pos6(stem,0);
x1=x2=3u; top y1=h; y2=.35h; bot y3r=-oo; lft x5r=-.25u; z4r=z5r;
x3=min(lft x5r+flare,lft x2l-eps); y5-.5flare=.1h;
bulb(3,4,5); % bulb
filldraw stroke pulled_arc.e(3,2) & z2e--z1e; % left stem
pos7(stem,0); lft x7l=hround(w-1.5u-.5stem); %!!! % x9=w; hook_out(7,8,9); %!!! % closing hook
x6=x7; top y6=h;
%filldraw stroke z6e--z7e; %!!! % right stem
% diagonals;m
numeric stem[]; % thicknesses of the strokes
stem1=hround(fudged.stem-stem_corr);
stem2=min(stem1,hround(fudged.hair-stem_corr));
penpos10(stem1,0); penpos11(stem1,0); penpos12(stem2,0); penpos13(stem2,0);
x10l=lft x1l; x11l=x12l; x13l=lft x7l; x11-x10=x13-x12;
y10=y13=top y6; y11=y12;
if hefty: y11=if monospace: vround 1/3h-.5stem1 else: oo fi;
 numeric upper_notch,lower_notch;
 upper_notch=h-notch_cut; lower_notch=y11+notch_cut;
 x1'=rt x1r; z1'=whatever[z10l,z11l];
 x6'=lft x6l; z6'=whatever[z12r,z13r];
 z0=whatever[z10r,z11r]=whatever[z12l,z13l];
 fill z10l..
  if y1'<upper_notch: {right}(x1'+1,upper_notch){down}... fi
  {z11-z10}diag_in(10l,11l,1,11r)..diag_out(12l,1,12r,13r){z13-z12}
  if y6'<upper_notch: ...{up}(x6'-1,upper_notch){right} fi
  ..z13r--diag_out(13r,1,13l,12l){z12-z13}
  if y0<=lower_notch: ..{z12-z13}z0{z10-z11}..
   else: ...{down}(x0+.5,lower_notch)--(x0-.5,lower_notch){up}... fi
  {z10-z11}diag_in(11r,10r,1,10l)--cycle;  % diagonals
else: y11=0; z0=whatever[z10r,z11r]=whatever[z12l,z13l];
 fill z10l..{z11-z10}diag_in(10l,11l,1,11r)..diag_out(12l,1,12r,13r){z13-z12}
  ..z13r--diag_out(13r,1,13l,12l){z12-z13}..{z12-z13}z0{z10-z11}
  ..{z10-z11}diag_in(11r,10r,1,10l)--cycle; fi  % diagonals
% hook;
pos8(vair,-90); pos9(hair,-180); pos9'(flare,-180);
bot y7=-1/3d; bot y8r=-d-oo; y9'-.5flare=-vround.9d;
x8=w-11/3u; lft x9r=min(x7-4u,lft x9r+x8-x9l+5u-eps);
filldraw stroke z6e--z7e{down}...{left}z8e;
bulb(8,9,9');  % bulb
penlabels(1,2,3,4,5,6,7,8,9,10,11,12,13); endchar;

lhchar "Italic Cyrillic letter r_gcrs - r grave crossed";
cyrchar(r_gcrs,if monospace:9u#else:9.25u#fi,x_height#,desc_depth#); % the Russian width
italcorr .7x_height#*slant+.5curve#-u# if math_fitting:-.5u# fi; %p
adjust_fit(0,if monospace:0 else:-.35u#fi);
% ital_r;
pickup fine.nib;
x0=0; x2-.5stem=hround(2.5u-.5stem); hook_in(0,1,2);  % opening hook
pos4(hair,-180); pos5(vair,-90); pos6(curve,0); pos7(vair,90);
x4=x2; rt x6r=hround(w-1.5u+.5curve); x5=x7=.5[x4,x6];
bot y5r=-oo; top y7r=h+oo; y4=y6=.5[y5,y7];
filldraw stroke super_arc.e(4,5) & pulled_arc.e(5,6)
 & pulled_arc.e(6,7) & super_arc.e(7,4);  % bowl
pickup tiny.nib; pos2'(stem,0); pos3(stem,0);
z2=z2'; x3=x2; bot y3=-d; filldraw stroke z2'e--z3e;  % stem
dish_serif(3,2',a,1/3,.75jut,b,1/3,jut);  % serif
%%%%%
path p; numeric unbalance,outer_jut;
p=z5{(x6,y5)-z5}...superness[(x5,y6),(x6,y5)]{z6-z5}...{z6-(x6,y5)}z6;
z8=point1.25 of p;
numeric unbalance,outer_jut;
unbalance=if monospace: 1 else: 1.1 fi;
% some funny fonts have an extremally small |jut|:
outer_jut=.5stem+if serifs: max(limit_dist,if hefty: .8 fi\\ jut) else: 1.7u fi;
put_cyrcross(x8,(y8-bar_height),-outer_jut,-unbalance*outer_jut);
%%%
penlabels(0,1,2,3,4,5,6,7, 8); endchar;

lhchar "Italic Cyrillic letter s_acrs - s acute crossed";
cyrchar(s_acrs,8u#,x_height#,0);
italcorr if math_fitting:1/3x_height#*slant else:x_height#*slant-u# fi; %c
adjust_fit(if monospace:0 else:-.35u#fi,0);
% ital_s;
pickup fine.nib; pos0(flare,0); pos1(hair,0); pos2(vair,90);
pos3(curve,180); pos4(vair,270); pos5(hair,320);
x2=x4=.5(w+u); rt x1r=max(rt x2,hround(w-u))+eps;
lft x3r=hround(1.5u-.5curve); x5r=good.x(w-eps); x6=x5;
y1=.5[bar_height,h]; top y2r=h+oo; bulb(2,1,0);  % bulb
bot y4r=-oo; y3=.5[y2,y4]; top y5l=vround .5bar_height; y6=bar_height;
path p; p=z4{right}..z5..z6;
filldraw stroke pulled_arc.e(2,3)
 & pulled_arc.e(3,4)...{direction 1 of p}z5e;  % arc
%%%%%
pair outer_point; path p; numeric unbalance,outer_jut;
outer_point=superness[(x4r,y3r),(x3r,y4r)];
p=z3{(x3,y4)-z3}
 ...superpull[superness[(x4,y3),(x3,y4)],outer_point]{z4-z3}...{z4-(x3,y4)}z4;
z7=point.75 of p;
unbalance=.95; %if monospace: 1 else: 1.1 fi;
% some funny fonts have an extremally small |jut|:
outer_jut=.5stem+if serifs: max(limit_dist,if hefty: .8 fi\\ jut) else: 1.7u fi;
put_cyrcross(x7,(y7-bar_height),unbalance*outer_jut,outer_jut);
%%%
penlabels(0,1,2,3,4,5,6, 7); endchar;

lhchar "Italic Cyrillic letter g_crsdsc - ghe hcrossed descender";
cyrchar(g_crsdsc,6.25u#,x_height#,desc_depth#);
italcorr max(1/3x_height#*slant,x_height#*slant+.5(.2[hair#,stem#])-u#); %e
adjust_fit(if monospace:u#,u# else: 0.5u#,0.5u# fi);
% ital_g;
pickup fine.nib; x0l=hround eps; x0'=x0; x5r=good.x(w-eps); x6=x5;
x2=.5w+2u; x3=.5w-2u; x1=x4=x7=.5[x3l,x2r]; y7=.5[y2,y3];
h-y0=y5; top y5l=vround .5bar_height; y6=bar_height; y0'=h-bar_height;
h-y2=y3=1/4x_height; h-y1=y4; bot y4r=-oo;
pos0(hair,320); pos1(vair,270); pos2(stem,180);
pos3(stem,180); pos4(vair,270); pos5(hair,320); pos7(stem,135);
path p,p_; p=z0'..z0..z1{right}; p_=z4{right}..z5..z6;
filldraw stroke z0e{direction 1 of p}
 ...z1e{right}...{down}z2e...z7e...z3e{down}...z4e{right}
 ...{direction 1 of p_}z5e; % main stroke
%%%
% italic descender/ogonek
if is_ogonek:
   def the_pen=
       if known ogonek_pen: ogonek_pen else: fine fi
   enddef;
   p_.r=z3r{down}...z4r{right}...{direction 1 of p_}z5e;
   ogonek_breadth:=xvair;
   numeric tt; % the time...
   tt=if hefty: 2.8 else: 2.6 fi;
   join_angle=angle((direction tt of p_.r) rotated 180);
   ogonek_pos=point tt of p_.r+.5(the_pen-fine)*
       unitvector((direction tt of p_.r) rotated 90);
   easy_ogonek(the_pen,10,11,12); % ogonek
else:
   z10=z5; pos10(hair,180); i_serif(10,x);
fi
% hstroke
bar_stroke(x0l+.05u,w-(x0l+.05u));
penlabels(0,1,2,3,4,5,6,7,8,9, 10,11,12); endchar;

lhchar "Italic Cyrillic letter h_hcrs - kha (looks like x)";
cyrchar(h_hcrs,if monospace:6.5u# else:7.5u# fi+max(1.5u#,flare#), % !rusw
 x_height#,0);
italcorr max(1/3x_height#*slant+.5hair#+.5u#,x_height#*slant+.25u#); %x
adjust_fit(if monospace: 0,0 else:0.25u#,0.25u#fi);
% ital_h;
pickup fine.nib; pos0(hair,180); pos1(vair,90); pos2(stem,0);
pos3(stem,-180); pos4(vair,-90); pos5(hair,0);
y0=y2=2/3h; y3=y5=1/3h; top y1r=h+oo; bot y4r=-oo;
rt x2r=hround(.5w+.5stem-eps); x2=x3;
x0-.5hair=hround-.5hair; x5+.5hair=hround(w+.5hair-eps);
x1=.5[x0,x2]; x4=.5[x3,x5];
filldraw stroke z0e{up}...pulled_arc.e(1,2); % opening hook
filldraw z2l--z3r--z3l--z2r--cycle;  % stem
filldraw stroke pulled_arc.e(3,4)...{up}z5e;  % closing hook
pos3'(hair,180); pos6(hair,180); pos7(vair,90); pos8(hair,0); pos9(flare,0);
x3'l=x6l=x3l; y3'=y3; y6=3/4h; x7=.5[x8,x2]; top y7r=h+oo;
rt x8r=hround(w-.25u); y8+.5flare=vround(bot y7l-.03x_height);
filldraw stroke z3'e---z6e...{right}z7e; bulb(7,8,9);  % upper link and bulb
pos2'(hair,0); pos16(hair,0); pos17(vair,-90);
pos18(hair,-180); pos19(flare,-180);
x2'l=x16l=x2l; y2'=y2; y16=1/4h; x17=.5[x18,x3]; bot y17r=-oo;
lft x18r=hround.25u; y18-.5flare=vround(top y17l+.03x_height);
filldraw stroke z2'e---z16e...{left}z17e; bulb(17,18,19); % lower link and bulb
%%%
% hstroke
bar_stroke(u,w-u); % bar
penlabels(0,1,2,3,4,5,6,7,8,9,16,17,18,19, 10,11); endchar;

lhchar "Italic Cyrillic letter semisn - semi soft sign";
cyrchar(semisn,if monospace: 9u# else: 9u# fi,x_height#+acc_height#,0);
italcorr .7x_height#*slant+.5curve#-u# if math_fitting:-.5u# fi;
adjust_fit(if monospace:.5u#,.5u# else:0,0 fi); pickup tiny.nib;
pos1(stem,0); pos2(stem,0); x1=x2;
lft x1l=hround(2.5u-.5stem); top y1=h; y2=.6bar_height;
filldraw stroke z1e--z2e;  % stem
sloped_serif.l(1,2,a,1/3,jut,serif_drop);  % serif
pickup fine.nib; pos2'(stem,-180); pos3(vair,-90);
pos4(curve,0); pos5(vair,90); pos0(hair,180);
z0=z2=z2'; x3=x5=.5[x2,x4]; rt x4r=hround(w-u+.5curve);
bot y3r=-oo; top y5r=1.2bar_height+oo; y4=y2;
filldraw stroke pulled_arc.e(2',3) & pulled_arc.e(3,4)
 & pulled_arc.e(4,5) & super_arc.e(5,0);  % bowl
pos31(bar,90); pos32(bar,90);
lft x31=hround 1/3u if serifs:-serif_fit fi; x32=w-2.5u;
y31=y32=vround x_height+eps;
filldraw stroke z31e--z32e;
penlabels(0,1,2,3,4,5,31,32); endchar;

lhchar "Italic Cyrillic letter i_shdsc - short i with descender";
cyrchar(i_shdsc,10u#,x_height#+acc_height#,desc_depth#);
italcorr 1/3x_height#*slant+.5hair#+.5u#; %u
adjust_fit(0,.1u#); %iserif_adj
full_h:=h; h:=x_height;
% ital_c;
pickup fine.nib; interim superness:=more_super;
x2=x3+.25u; pos3(stem,-180); lft x3r=hround(2.5u-.5stem);
% left shstem;
if monospace:
 pos0(vair,90); x0=good.x .5[0,x2]; top y0l=h; y2=2/3h;
 pos2(stem,0); filldraw stroke z2e{u,x_height}...{left}z0e; % terminal
else:
 x0=0; hook_in(0,1,2)(skewed); fi % opening hook
pos2'(stem,-180); z2'=z2;
pos4(vair,-90); pos5(hair,0); x4=.5[x3,x5];
pos6(stem,0); rt x6r=hround(w-2.5u+.5stem);
x5=x6=x7; y3=.7[y4,y5]; bot y4r=-oo; y5=.57h; y6+.5stem=h;
filldraw stroke z2'e{-u,-x_height}
 ...super_arc.e(3,4)...{up}z5e; % left stem and arc
x9=w; y9=y7=.4bar_height; x8=.5[x7,x9]; bot y8l=-oo;
pos8(vair,90); pos9(vair,180); pos7(stem,0);
filldraw circ_stroke z6e--z7e;  % right stem
filldraw circ_stroke z7e{-.5u,-x_height}...z8e{right}...{up}z9e; % closing hook
% italic descender/ogonek
if is_ogonek:
   def the_pen=
       if known ogonek_pen: ogonek_pen else: fine fi
   enddef;
   path p.l;
   p.l=z7l{-.5u,-x_height}...z8l{right}...{up}z9l;
   ogonek_breadth:=xvair;
   ogonek_pos=point .9 of p.l;
   easy_ogonek(the_pen,17,18,19); % ogonek
else:
   i_serif(9,x);
fi
% the accent
h:=full_h; cbreve(.5w,0, 10,11,12,13,14,15,16);
penlabels(0,1,2,3,4,5,6,7,8,9, 10,11,12,13,14,15,16); endchar;

lhchar "Italic Cyrillic letter r_tl (looks like p)";
cyrchar(r_tl,if monospace: 9u# else: 9.25u# fi,x_height#, % rusw
        max(1.6desc_depth#,paren_depth#));%r_ddepth
italcorr .7x_height#*slant+.5curve#-u# if math_fitting:-.5u# fi; %p
adjust_fit(0,if monospace:0 else:-.35u# fi);
full_d:=d; d:=vround min(desc_depth,max(vair+slab+oo+1+eps,full_d-max(.4desc_depth,.55beak)-slab));%r_dscs
% ital_r;
pickup fine.nib;
x0=0; x2-.5stem=hround(2.5u-.5stem); hook_in(0,1,2);  % opening hook
pos4(hair,-180); pos5(vair,-90); pos6(curve,0); pos7(vair,90);
x4=x2; rt x6r=hround(w-1.5u+.5curve); x5=x7=.5[x4,x6];
bot y5r=-oo; top y7r=h+oo; y4=y6=.5[y5,y7];
filldraw stroke super_arc.e(4,5) & pulled_arc.e(5,6)
 & pulled_arc.e(6,7) & super_arc.e(7,4);  % bowl
pickup tiny.nib; pos2'(stem,0); pos3(stem,0);
z2=z2'; x3=x2; bot y3=-d; filldraw stroke z2'e--z3e;  % stem
%%%
dish_serif(3,2',a,1/3,.75jut,b,1/3,jut);  % serif
%%%
% tail_part(2);%!!!
_zero:=2;
_one:=8; _two:=9; _three:=10; _four:=11; _five:=12;
_six:=13; _seven:=14; _eight:=15; _nine:=16;
%
pickup tiny.nib;
numeric bulb_diam;
bulb_diam=max(currentbreadth+eps,
        min(full_d-d-.18desc_depth-1-eps,hround 7/8[hair,flare]));%!!!
y[_one]l=y[_two]l=vround min(if serifs:-.5d else: -d+vair fi,-oo-.6[thin_join,vair]-eps);%!!!
y[_one]r-y[_one]l=y[_two]r-y[_two]l=.6[thin_join,vair];%!!!
penpos[_three](max(currentbreadth+eps,curve if hefty:-3stem_corr fi),0);
y[_three]=.5[y[_one]r,-full_d];%!!!
x[_two]l=x[_two]r=w-4.75u; x[_one]l=x[_one]r=x[_zero];
x[_three]r=hround(w-1.5u); x[_two]l:=x[_four]l:=x[_two]r-.25curve;%!!!
{{interim superness:=more_super;
 fill stroke super_arc.e([_three],[_two])..z[_one]e}};  % lobe
if serifs:
 z[_five]=z[_three]; pos[_five](curve if hefty:-3stem_corr fi,0);
 pos[_six](vair,-90); bot y[_six]r=-full_d-oo; %!!!
 y[_seven]-.5flare=-full_d+.15desc_depth;%!!!
 pos[_seven](hair,-180); pos[_eight](bulb_diam,-180);
 rt x[_eight]l=max(lft x[_zero]l-jut+bulb_diam,
  floor x[_three]-2.5u if monospace: / expansion_factor fi);%!!!
 z[_seven]r=z[_eight]r;
 x[_six]=max(rt x[_eight]l,.6[x[_five],x[_seven]r]);
 (x,y[_six]r)=whatever[z[_six]l,z[_five]l];
 x[_six]r:=max(x,.5[x[_seven]r,x[_six]]);
 filldraw stroke super_arc.e([_five],[_six]);
 bulb([_six],[_seven],[_eight]); % bulb
else:
 pickup fine.nib; z[_five]=z[_three];
 pos[_five](max(fine.breadth,curve if hefty:-3stem_corr fi),0);
 pos[_nine](vair',-90); pos[_six](.6[vair',flare],-105);
 rt x[_six]r=x[_three]-3.5u; bot y[_six]r=-full_d;%!!!
 bot y[_nine]r=-full_d-oo; x[_nine]=.35[x[_six]r,x[_three]r];%!!!
 filldraw stroke super_arc.e([_five],[_nine])
  & term.e([_nine],[_six],left,.75,4); fi
%%%
penlabels(0,1,2,3,4,5,6,7, 8,9,10,11,12,13,14,15,16); endchar;

endinput;
%end of file
