summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/fonts/source/lh/specific/lgcyrcu.mf
blob: 38047b59c77fba2eb715f6f59f17bd96caa9cec4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
%
% lgcyrcu.mf
%
%% Cyrillic font container with T2 encoding beta-support
%
% This file is future part of lxfonts package
% Version 3.5 // Patchlevel=1
% (c) O.Lapko
%
% This package is freeware product 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 all this package as well) and to save it under the same name.
%
% Content:
%
% Lowercase Cyrillic letters common for couple of encodings
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% List of letternames and their codes in T2 & Ko
%
%                X2      T2A  T2B  T2C  T2D  X2S    LH  WNCYR
%
% LJE           "4b  K  !"87  "88   -    -    -     -    "01   Lje
%
%                X2      T2A  T2B  T2C
%
% K_vcrs        "46  F   "8b   -    -    Ka vertically crossed
% K_hcrs        "47  G    -    -   "8b   Ka horisontally crossed
% L_dsc         "48  H    -   "8a  "8a   El with descender
%
% ZH_dsc        "85  "85  "85   -    Zhe with descender
% K_dsc         "89  "89  "89  "89   Ka with descender
% K_beak        "8a  "8a   -    -    Ka with reversed beak
% L_tl          "8c   -   "8c   -    El with tail
%

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

begingroup

def is_egyptian =
% |false| for most of the CM fonts, except funny fonts;
% |true| for the CC fonts
 (serifs and (1.4max(fine#,crisp#, tiny#)<slab#) and (1.6slab#>stem#))
%added
 or (vair#>.5stem#)
enddef;

lhchar "Uppercase Russian letter LJE (`concrete' form)";
cyrchar(LJE,13.5u#,cap_height#,0); %N_width#
if is_small_cap: getcharcode(lje); fi
adjust_fit(if serifs: .8(flare#+(cap_stem#-stem#))-.5u#
              else:   cap_serif_fit# fi,
 4u#-.5width_adj#);% usftsn_adj;usftsnwd-.25u-.5width_adj
% upper_spec_l;
numeric bulb_diam; bulb_diam=flare+(cap_stem-stem);
numeric left_stem,right_stem,outer_jut,alpha;
right_stem=cap_stem-stem_corr;
left_stem=max(tiny.breadth+eps,min(cap_hair if hefty:-3stem_corr fi,right_stem));
outer_jut=.8cap_jut; x1l=w-x4r=outer_jut+if serifs:.5 fi u; y1=y4=0; x2-x1=x4-x3;
if serifs: x3l=x2r+((x1r-x4l)*(slab/(h-slab))) %+2apex_corr;
 if not is_egyptian:-.25left_stem fi;
else: x3r= x2r+apex_corr; fi
y2=y3=h if not serifs:+apex_o+apex_oo fi;
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);
if serifs:
 fill stroke z3e--z4e; % right stem
 pickup tiny.nib;
 penpos5(left_stem,-90); pos5'(left_stem,-90); z5'=z5;
 pos8(cap_hair,-180); pos9(bulb_diam,-180);
 y9=if is_egyptian: 0.12h else: 1/6h-max(0,flare-stem-2vair_corr-.5) fi;
 lft x9r=l+letter_fit+hround(.5u-.5);
 y5r=-o; x5=max(lft x9r+.5bulb_diam,.5[x9r,x1r]);
 y6l=y9+bulb_diam-hair;
 numeric t; t=1-slant;
 z7r=(max(.75[x1,x1r],x9+if is_egyptian: (if is_small_cap: 2.25 else: 2.667 fi
                            +max(-2slant,.5slant))*hair
                         else: if is_bold:.75 fi bulb_diam+1.35hair fi),
        y7l-t*7/8left_stem);
 z7l=(x7r-2/3(x1r-x1l),if is_egyptian: .35[y5l,y5] else: y5 fi);%y5l);
 z6r=(x7r,y1)+whatever*((x1r,y1)-z2r); y6r-y6l=t*(y5r-y5l);
 x6r-x6l=1/2(x1r-x1l);
 fill stroke z2e{z1e-z6e}.. controls z6e and z7e ..z5e;
 {{less_tense; cyrbulb(5',8,9)}};  % arc and bulb
 numeric inner_jut,left_jut,fit; pickup tiny.nib;
 x10r=x3r; top y10=h; pos10(max(currentbreadth+eps,alpha*right_stem),0); x4:=x4r;
 left_jut=cap_jut+left_stem;
 serif(10,4,c,0,-left_jut); % upper  serif
 pickup tiny.nib;
 prime_points_inside(1,2); prime_points_inside(4,3);
 if rt x1'r+cap_jut+.5u+1<=lft x4'l-cap_jut: inner_jut=cap_jut;
  else: rt x1'r+inner_jut+.5u+1=lft x4'l-inner_jut; fi
 dish_serif(4',3,d,1/2,inner_jut,e,1/3,outer_jut); % right serif
else: 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 fi % left and right diagonals
%%%%%
% now the b part
w:=w+4u-.5width_adj;%usftsnwd-.5u-.5width_adj
% usftsn_bowl(4)LJE;
_zero:=4;
_one:=11; _two:=12; _three:=13; _four:=14; _five:=15;
%
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=z[_zero]; y[_four]=y[_five];%!!!
z[_one]l=whatever[z3,z4]; %x[_one]l=x[_one]=x[_one]r;%!!!
y[_three]=.5[y[_four],y[_two]];
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[.5[x2,x4],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[.5[x2,x4],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
%%%%%
penlabels(0,2,6,3,4,5,7,8,9,10); endchar;

lhchar "Uppercase Russian letter K_vcrs (`concrete' form)";
cyrchar(K_vcrs,15u# if not serifs:+.5width_adj# fi, % N_width+1.5u
 cap_height#,0);
if is_small_cap: getcharcode(k_vcrs); fi
italcorr cap_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
% upperc_k;
pickup tiny.nib; pos1(fudged.cap_stem,0); pos2(fudged.cap_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5fudged.cap_stem);
top y1=h; bot y2=0;
pickup tiny.nib; filldraw stroke  z1e--z2e; % stem
if serifs: dish_serif(1,2,a,1/3,cap_jut,b,1/3,cap_jut);  % upper stem serif
 dish_serif(2,1,c,1/3,cap_jut,d,1/3,cap_jut); fi % lower stem serif
% Kv_cbowl;
  pos10(stem1,0); y10=y1; x10=hround max(w-11.5u,w-10.5u-.5fudged.cap_stem);
% K_cbowl
numeric right_jut,stem[],alpha[]; pickup tiny.nib;
right_jut=if serifs:.6cap_jut else:.4tiny fi;
stem1=max(tiny.breadth,fudged.hair if hefty:-3stem_corr fi);
stem2=max(tiny.breadth,fudged.cap_stem-3stem_corr);
rt x3r=hround(r-letter_fit-u-right_jut);
rt x6r=hround(r-letter_fit-.75u-right_jut);
y4=1/3h; top y3=h; bot y6=0; x4=x10;%!!!
penpos3(alpha1*(stem1-tiny),0); penpos4(whatever,-90);
alpha1=diag_ratio(1,.5(stem1-tiny),y3-y4,x3r-x4);
penpos6(alpha2*(stem2-tiny),0);
alpha2=diag_ratio(1,.5(stem2-tiny),y10-y6,x6r-x10);%!!!
if serifs: y6'l=max(cap_hair,.5stem);
 z6'r=z6'l+whatever*dir(angle(y10-y6,x6r-x10));%!!!
 else: y6'l=y6'r=0; fi
forsuffixes $=l,r: y3'$=h; z4$=z3'$+whatever*(z3-z4);
  z5$=z6'$+whatever*(z10-z6)=z3'$+whatever*(z3-z4); endfor
z5=.5[z5l,z5r];
z3'r=z3r+penoffset z3-z4 of currentpen+whatever*(z3-z4);
% we have also |z3'l=z3l+penoffset z4-z3 of currentpen+whatever*(z3-z4)|;\]
z6'r=z6r+penoffset z10-z6 of currentpen+whatever*(z10-z6);%!!!
z6'l=z6l+penoffset z6-z10 of currentpen+whatever*(z10-z6);%!!!
fill z5r--diag_end(5r,3'r,1,.5,3'l,5l)--z5l--cycle;  % upper diagonal
if serifs: pickup if is_egyptian: crisp else: fine fi nib;
 rt x7=rt x6r+right_jut;
 if is_egyptian: y7l=0; penpos7(slab,90);
 else: y7=-o; penpos7(max(fine.breadth+eps,cap_hair-fine),90); fi
 fill z5l
  if is_egyptian: ---z6'l...{z6r-z6l}(.35[x6l,x7l],y7l)--
     else:{z6'l-.5[z5,z5l]}...{z6r-z6l} fi
   z7l..(rt x7l,top y7l)--(rt x7r,bot y7r)..z7r
  if is_egyptian: --(.5[x6r,x7r],y7r){z6l-z6r}...z6'r---
     else: {z6l-z6r}...{.5[z5,z5l]-z6'l} fi
   z5r--cycle; % lower diagonal
 numeric up_inner_jut;
 if rt x1r+cap_jut+.5u+1<=lft x3l-1.2cap_jut: up_inner_jut=1.2cap_jut;
  else: rt x1r+cap_jut+.5u+1=lft x3l-up_inner_jut; fi
 dish_serif(3,4,e,2/3,up_inner_jut,f,1/2,right_jut)(dark); % upper diagonal serif
else: fill z5'l--diag_end(5'l,6'l,.5,1,6'r,5'r)--z5'r--cycle;  fi% lower diagonal
%%%
_one:=12; _two:=13; _three:=14; _four:=15;
 pickup fine.nib; pos[_one](vair,90); pos[_two](vair,90);
 y[_one]=y[_two]=y5l; x[_one]=x1; rt x[_two]=x5r;
 filldraw stroke z[_one]e--z[_two]e; % middle cross
%%%
% vcross
pickup crisp.nib; pos[_three](bar,0); pos[_four](bar,0);
lft x[_three]l=lft x[_four]l=hround max(rt x1r+1,max(x5l-bar+eps,.5[rt x1r,x5l]));
top y[_four]-bot y[_three]=.5cap_height; .52[y[_three],y[_four]]=y[_one];
filldraw stroke z[_three]e--z[_four]e; % cross bar
%%%%%
penlabels(1,2,3,4,5,6,7,10); endchar;

lhchar "Uppercase Russian letter K_hcrs (`concrete' form)";
cyrchar(K_hcrs,13.5u#,cap_height#,0); %EN_width#
if is_small_cap: getcharcode(k_hcrs); fi
italcorr cap_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
% upperc_k;
pickup tiny.nib; pos1(fudged.cap_stem,0); pos2(fudged.cap_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5fudged.cap_stem);
top y1=h; bot y2=0;
pickup tiny.nib; filldraw stroke  z1e--z2e; % stem
if serifs: dish_serif(1,2,a,1/3,cap_jut,b,1/3,cap_jut);  % upper stem serif
 dish_serif(2,1,c,1/3,cap_jut,d,1/3,cap_jut); fi % lower stem serif
% K_cbowl
numeric right_jut,stem[],alpha[]; pickup tiny.nib;
right_jut=if serifs:.6cap_jut else:.4tiny fi;
stem1=max(tiny.breadth,fudged.hair if hefty:-3stem_corr fi);
stem2=max(tiny.breadth,fudged.cap_stem-3stem_corr);
rt x3r=hround(r-letter_fit-u-right_jut);
rt x6r=hround(r-letter_fit-.75u-right_jut);
y4=1/3h; top y3=h; bot y6=0; x4=x1;
penpos3(alpha1*(stem1-tiny),0); penpos4(whatever,-90);
alpha1=diag_ratio(1,.5(stem1-tiny),y3-y4,x3r-x4);
penpos6(alpha2*(stem2-tiny),0);
alpha2=diag_ratio(1,.5(stem2-tiny),y1-y6,x6r-x1);
forsuffixes $=l,r: y3'$=h; z4.$=z3'$+whatever*(z3-z4);
 z5.$=z6'$+whatever*(z1-z6)=whatever[z3,z4]; endfor
if serifs: y6'l=max(cap_hair,.5stem);
 z6'r=z6'l+whatever*dir(angle(y1-y6,x6r-x1));
 else: y6'l=y6'r=0; fi
z5=.5[z5l,z5r];
z3'r=z3r+penoffset z3-z4 of currentpen+whatever*(z3-z4);
% we have also |z3'l=z3l+penoffset z4-z3 of currentpen+whatever*(z3-z4)|;\]
z6'r=z6r+penoffset z1-z6 of currentpen+whatever*(z1-z6);
z6'l=z6l+penoffset z6-z1 of currentpen+whatever*(z1-z6);
fill z4r--diag_end(4r,3'r,1,.5,3'l,4l)--z4l--cycle;  % upper diagonal
if serifs: pickup if is_egyptian: crisp else: fine fi nib;
 rt x7=rt x6r+right_jut;
 if is_egyptian: y7l=0; penpos7(slab,90);
 else: y7=-o; penpos7(max(fine.breadth+eps,cap_hair-fine),90); fi
 fill z5l
  if is_egyptian: ---z6'l...{z6r-z6l}(.35[x6l,x7l],y7l)--
     else:{z6'l-.5[z5,z5l]}...{z6r-z6l} fi
   z7l..(rt x7l,top y7l)--(rt x7r,bot y7r)..z7r
  if is_egyptian: --(.5[x6r,x7r],y7r){z6l-z6r}...z6'r---
     else: {z6l-z6r}...{.5[z5,z5l]-z6'l} fi
   z5r--cycle; % lower diagonal
 numeric up_inner_jut;
 if rt x1r+cap_jut+.5u+1<=lft x3l-1.2cap_jut: up_inner_jut=1.2cap_jut;
  else: rt x1r+cap_jut+.5u+1=lft x3l-up_inner_jut; fi
 dish_serif(3,4,e,2/3,up_inner_jut,f,1/2,right_jut)(dark); % upper diagonal serif
else: fill z5'l--diag_end(5'l,6'l,.5,1,6'r,5'r)--z5'r--cycle;  fi% lower diagonal
%%%
% hcross
_one:=12; _two:=13;
pickup crisp.nib; numeric outer_jut;
outer_jut=if serifs: max(limit_dist,if not is_egyptian: 1.1 fi cap_jut) else: 1.8u fi;
pos[_one](bar,90); pos[_two](bar,90);
top y[_one]r=top y[_two]r=vround (min(.35[x_height,h]+.5bar,h-max(bracket,1.2slab))-eps);
if serifs and is_egyptian:
   rt x[_one]=tiny.rt x1r+cap_jut; lft x[_two]=tiny.lft x1l-cap_jut;
else:
   x[_one]=x1r+1.15outer_jut; x[_two]=hround 1/3u-cap_serif_fit;
fi
filldraw stroke z[_one]e--z[_two]e; % cross bar
%%%%%
penlabels(1,2,3,4,5,6,7); endchar;

lhchar "Uppercase Russian letter L_dsc (`concrete' form)";
cyrchar(L_dsc,13.5u#,cap_height#, %N_width#
 if is_ogonek: desc_depth# else: cap_sbeak# fi); %udesc/og_depth
if is_small_cap: getcharcode(l_dsc); fi
adjust_fit(if serifs: .8(flare#+(cap_stem#-stem#))-.5u#
              else:   cap_serif_fit# fi,
 cap_serif_fit# if (serifs=false) or (is_ogonek=false):+.5(cap_stem#-u#) fi); %ZhDL_adj
% upper_spec_l;
numeric bulb_diam; bulb_diam=flare+(cap_stem-stem);
numeric left_stem,right_stem,outer_jut,alpha;
right_stem=cap_stem-stem_corr;
left_stem=max(tiny.breadth+eps,min(cap_hair if hefty:-3stem_corr fi,right_stem));
outer_jut=.8cap_jut; x1l=w-x4r=outer_jut+if serifs:.5 fi u; y1=y4=0; x2-x1=x4-x3;
if serifs: x3l=x2r+((x1r-x4l)*(slab/(h-slab))) %+2apex_corr;
 if not is_egyptian:-.25left_stem fi;
else: x3r= x2r+apex_corr; fi
y2=y3=h if not serifs:+apex_o+apex_oo fi;
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);
if serifs:
 fill stroke z3e--z4e; % right stem
 pickup tiny.nib;
 penpos5(left_stem,-90); pos5'(left_stem,-90); z5'=z5;
 pos8(cap_hair,-180); pos9(bulb_diam,-180);
 y9=if is_egyptian: 0.12h else: 1/6h-max(0,flare-stem-2vair_corr-.5) fi;
 lft x9r=l+letter_fit+hround(.5u-.5);
 y5r=-o; x5=max(lft x9r+.5bulb_diam,.5[x9r,x1r]);
 y6l=y9+bulb_diam-hair;
 numeric t; t=1-slant;
 z7r=(max(.75[x1,x1r],x9+if is_egyptian: (if is_small_cap: 2.25 else: 2.667 fi
                            +max(-2slant,.5slant))*hair
                         else: if is_bold:.75 fi bulb_diam+1.35hair fi),
        y7l-t*7/8left_stem);
 z7l=(x7r-2/3(x1r-x1l),if is_egyptian: .35[y5l,y5] else: y5 fi);%y5l);
 z6r=(x7r,y1)+whatever*((x1r,y1)-z2r); y6r-y6l=t*(y5r-y5l);
 x6r-x6l=1/2(x1r-x1l);
 fill stroke z2e{z1e-z6e}.. controls z6e and z7e ..z5e;
 {{less_tense; cyrbulb(5',8,9)}};  % arc and bulb
 numeric inner_jut,left_jut,fit; pickup tiny.nib;
 x10r=x3r; top y10=h; pos10(max(currentbreadth+eps,alpha*right_stem),0); x4:=x4r;
 left_jut=cap_jut+left_stem;
 serif(10,4,c,0,-left_jut); % upper  serif
 pickup tiny.nib;
 prime_points_inside(1,2); prime_points_inside(4,3);
 if rt x1'r+cap_jut+.5u+1<=lft x4'l-cap_jut: inner_jut=cap_jut;
  else: rt x1'r+inner_jut+.5u+1=lft x4'l-inner_jut; fi
  if is_ogonek:
    dish_serif(4',3,d,1/2,inner_jut,e,1/3,outer_jut); % right serif
  fi
else: 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 fi % left and right diagonals
% uppercase descender/saam tail
numeric right_jut;
right_jut=
      if serifs: max(limit_dist,1.1cap_jut) else: hround (r-rt x2r-.65u) fi;
if unic:
   %saam tail
    serif(4',3,v,1/3,-cap_jut);
    siam_serif(4',3,w,1/3,right_jut);
else:
   r_serif(4',3,x,1/3,cap_jut,y,1/3,beak_darkness,right_jut,beak_jut); % lower right descender
fi
%%%%%
penlabels(0,2,6,3,4,5,7,8,9,10); endchar;

lhchar "Uppercase Russian letter ZH_dsc (`concrete' form)";
cyrchar(ZH_dsc,13.5u#,cap_height#,  %N_width#
 if is_ogonek: desc_depth# else: cap_sbeak# fi); %udesc/og_depth
if is_small_cap: getcharcode(zh_dsc); fi
italcorr cap_height#*slant+.25u#;
adjust_fit(w#-2max(2u#+.5cap_stem#,3u#)+cap_serif_fit#,
 cap_serif_fit# if (serifs=false) or (is_ogonek=false):+.5(cap_stem#-u#) fi); %ZhDL_adj
% upperc_zh;
if odd((r-l)-fudged.cap_stem): change_width; fi % symmetric & all three equal
pickup tiny.nib; pos1(fudged.cap_stem,0); pos2(fudged.cap_stem,0);
lft x1l=lft x2l=hround (.5[l,r]-.5fudged.cap_stem)-eps; % middle stem point
top y1=h; bot y2=0;
pickup tiny.nib; filldraw stroke  z1e--z2e; % stem
if serifs: dish_serif(1,2,a,1/3,cap_jut,b,1/3,cap_jut);  % upper stem serif
 dish_serif(2,1,c,1/3,cap_jut,d,1/3,cap_jut); fi % lower stem serif
% K_cbowl
numeric right_jut,stem[],alpha[]; pickup tiny.nib;
right_jut=if serifs:.6cap_jut else:.4tiny fi;
stem1=max(tiny.breadth,fudged.hair if hefty:-3stem_corr fi);
stem2=max(tiny.breadth,fudged.cap_stem-3stem_corr);
rt x3r=hround(r-letter_fit-u-right_jut);
rt x6r=hround(r-letter_fit-.75u-right_jut);
y4=1/3h; top y3=h; bot y6=0; x4=x1;
penpos3(alpha1*(stem1-tiny),0); penpos4(whatever,-90);
alpha1=diag_ratio(1,.5(stem1-tiny),y3-y4,x3r-x4);
penpos6(alpha2*(stem2-tiny),0);
alpha2=diag_ratio(1,.5(stem2-tiny),y1-y6,x6r-x1);
forsuffixes $=l,r: y3'$=h; z4.$=z3'$+whatever*(z3-z4);
 z5.$=z6'$+whatever*(z1-z6)=whatever[z3,z4]; endfor
if serifs: y6'l=max(cap_hair,.5stem);
 z6'r=z6'l+whatever*dir(angle(y1-y6,x6r-x1));
 else: y6'l=y6'r=0; fi
z5=.5[z5l,z5r];
z3'r=z3r+penoffset z3-z4 of currentpen+whatever*(z3-z4);
% we have also |z3'l=z3l+penoffset z4-z3 of currentpen+whatever*(z3-z4)|;\]
z6'r=z6r+penoffset z1-z6 of currentpen+whatever*(z1-z6);
z6'l=z6l+penoffset z6-z1 of currentpen+whatever*(z1-z6);
fill z4r--diag_end(4r,3'r,1,.5,3'l,4l)--z4l--cycle;  % upper diagonal
if serifs: pickup if is_egyptian: crisp else: fine fi nib;
 rt x7=rt x6r+right_jut;
 if is_egyptian: y7l=0; penpos7(slab,90);
 else: y7=-o; penpos7(max(fine.breadth+eps,cap_hair-fine),90); fi
 fill  z5l
  if is_egyptian: ---z6'l...{z6r-z6l}(.35[x6l,x7l],y7l)--
     else:{z6'l-.5[z5,z5l]}...{z6r-z6l} fi
   z7l..(rt x7l,top y7l)--(rt x7r,bot y7r)..z7r
  if is_egyptian: --(.5[x6r,x7r],y7r){z6l-z6r}...z6'r---
     else: {z6l-z6r}...{.5[z5,z5l]-z6'l} fi
   z5r--cycle; % lower diagonal
 numeric up_inner_jut;
 if rt x1r+cap_jut+.5u+1<=lft x3l-1.2cap_jut: up_inner_jut=1.2cap_jut;
  else: rt x1r+cap_jut+.5u+1=lft x3l-up_inner_jut; fi
 dish_serif(3,4,e,2/3,up_inner_jut,f,1/2,right_jut)(dark); % upper diagonal serif
else: fill z5'l--diag_end(5'l,6'l,.5,1,6'r,5'r)--z5'r--cycle;  fi% lower diagonal
%%%
% mirror
pickup tiny.nib;
forsuffixes $ = 3l,3,3r,3'l,3'r,4l,4,4r,5l,5,5r,6l,6,6r,6'l,6'r,7l,7r:
 x.m$=l+(r-x$); y.m$=y$; endfor;
fill z.m4r--diag_end(.m4r,.m3'r,1,.5,.m3'l,.m4l)--z.m4l--cycle;  % upper diagonal
if serifs: pickup if is_egyptian: crisp else: fine fi nib;
 fill  z.m5l
  if is_egyptian: ---z.m6'l...{z.m6r-z.m6l}(.35[x.m6l,x.m7l],y.m7l)--
     else:{z.m6'l-.5[z.m5,z.m5l]}...{z.m6r-z.m6l} fi
   z.m7l..(lft x.m7l,top y.m7l)--(lft x.m7r,bot y.m7r)..z.m7r
  if is_egyptian: --(.5[x.m6r,x.m7r],y.m7r){z.m6l-z.m6r}...z.m6'r---
     else: {z.m6l-z.m6r}...{.5[z.m5,z.m5l]-z.m6'l} fi
   z.m5r--cycle; % lower diagonal
 z8l=z.m3r; z8r=z.m3l; z9l=z.m4r; z9r=z.m4l; z8=.5[z8l,z8r]; z9=.5[z9l,z9r];
 dish_serif(8,9,g,1/2,right_jut,h,2/3,up_inner_jut)(dark); % upper diagonal serif
else: fill z.m5'l--diag_end(.m5'l,.m6'l,.5,1,.m6'r,.m5'r)--z.m5'r--cycle; % lower diagonal
fi
%%%%%
% uppercase descender/ogonek
if is_ogonek:
   def the_pen=if known ogonek_pen: ogonek_pen
       elseif serifs: tiny elseif is_bold: fisp else: fine fi
   enddef;
   % |diag_end| refers to |tiny| pen, hence |tiny| in the following equation:
   ogonek_pos=(x6 if not serifs: l if is_bold: +.75tiny fi\\ fi,.5the_pen)
       if serifs and not is_egyptian: +(.5xvair,0) fi;
   easy_ogonek(the_pen,11,12,13); % ogonek
else:
   if not serifs:
      right_jut:=max(right_jut,hround (r-rt x6r-.65u)); fi
    if serifs:
          pickup crisp.nib;
    else:
          pickup pencircle scaled (3/5[fine,crisp]+eps);
    fi
    numeric bracket_height,light_stem; pair downward;
    bracket_height=bracket;
    light_stem=hround (max(tiny.breadth,fudged.hair if hefty:-4stem_corr fi));
    % for cyr_serif always |y$|<|y$$|
    if (y6>y1): errmessage ("`cyr_serif' placed only on the bottom"); fi
    downward=z6-z1;
    y.q0=min(y6+.5bracket_height,y1)+eps;
    top y.q1-slab-eps=bot y.q4+eps=tiny.bot y6;
    if y.q1>y.q0: y.q0:=y.q1+eps; fi
    bot y.q2=bot y.q3=vround(-d);
    y.q5=y.q1; y.q6=y.q0;
    z.q5=whatever[z6,z1]; z.q6=whatever[z6,z1];
       z.q0-penoffset downward of currentpen =
           z6r-penoffset downward of pen_[tiny.nib]-whatever*downward;
       rt x.q1=hround (tiny.rt x6r+right_jut)+eps;
       if x.q6>x.q0-eps: x.q6:=x.q0-eps; fi
       rt x.q2=lft x.q3+light_stem+eps=hround (rt x.q1+beak_jut)+eps;
       x.q4=x6-.5(fudged.stem-3stem_corr-tiny)-eps;
    pair corner,beak_corner;
    ypart corner=y.q1; corner=z.q0+whatever*downward;
    ypart beak_corner=y.q4; beak_corner=z.q3+whatever*(z.q1-z.q2);
       filldraw z.q6--z.q5
           ...(beak_darkness+eps)[beak_corner,.5[z.q3,z.q4]]
           ...{z.q2-z.q1}z.q3--z.q2--z.q1{-right_jut,0}
           ...(1/3+eps)[corner,.5[z.q1,z.q0]]{z.q0-z.q1}
           ...{z1-z6}z.q0--cycle; % descender
    labels (.q0,.q1,.q2,.q3,.q4,.q5,.q6);
%
fi
penlabels(1,2,3,4,5,6,7); endchar;

lhchar "Uppercase Russian letter K_dsc (`concrete' form)";
cyrchar(K_dsc,13.5u#,cap_height#, %EN_width#
 if is_ogonek: desc_depth# else: cap_sbeak# fi); %udesc/og_depth
if is_small_cap: getcharcode(k_dsc); fi
italcorr cap_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,
 cap_serif_fit# if (serifs=false) or (is_ogonek=false):+.5(cap_stem#-u#) fi); %ZhDL_adj
% upperc_k;
pickup tiny.nib; pos1(fudged.cap_stem,0); pos2(fudged.cap_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5fudged.cap_stem);
top y1=h; bot y2=0;
pickup tiny.nib; filldraw stroke  z1e--z2e; % stem
if serifs: dish_serif(1,2,a,1/3,cap_jut,b,1/3,cap_jut);  % upper stem serif
 dish_serif(2,1,c,1/3,cap_jut,d,1/3,cap_jut); fi % lower stem serif
% K_cbowl
numeric right_jut,stem[],alpha[]; pickup tiny.nib;
right_jut=if serifs:.6cap_jut else:.4tiny fi;
stem1=max(tiny.breadth,fudged.hair if hefty:-3stem_corr fi);
stem2=max(tiny.breadth,fudged.cap_stem-3stem_corr);
rt x3r=hround(r-letter_fit-u-right_jut);
rt x6r=hround(r-letter_fit-.75u-right_jut);
y4=1/3h; top y3=h; bot y6=0; x4=x1;
penpos3(alpha1*(stem1-tiny),0); penpos4(whatever,-90);
alpha1=diag_ratio(1,.5(stem1-tiny),y3-y4,x3r-x4);
penpos6(alpha2*(stem2-tiny),0);
alpha2=diag_ratio(1,.5(stem2-tiny),y1-y6,x6r-x1);
forsuffixes $=l,r: y3'$=h; z4.$=z3'$+whatever*(z3-z4);
 z5.$=z6'$+whatever*(z1-z6)=whatever[z3,z4]; endfor
if serifs: y6'l=max(cap_hair,.5stem);
 z6'r=z6'l+whatever*dir(angle(y1-y6,x6r-x1));
 else: y6'l=y6'r=0; fi
z5=.5[z5l,z5r];
z3'r=z3r+penoffset z3-z4 of currentpen+whatever*(z3-z4);
% we have also |z3'l=z3l+penoffset z4-z3 of currentpen+whatever*(z3-z4)|;\]
z6'r=z6r+penoffset z1-z6 of currentpen+whatever*(z1-z6);
z6'l=z6l+penoffset z6-z1 of currentpen+whatever*(z1-z6);
fill z4r--diag_end(4r,3'r,1,.5,3'l,4l)--z4l--cycle;  % upper diagonal
if serifs: pickup if is_egyptian: crisp else: fine fi nib;
 rt x7=rt x6r+right_jut;
 if is_egyptian: y7l=0; penpos7(slab,90);
 else: y7=-o; penpos7(max(fine.breadth+eps,cap_hair-fine),90); fi
 fill z5l
  if is_egyptian: ---z6'l...{z6r-z6l}(.35[x6l,x7l],y7l)--
     else:{z6'l-.5[z5,z5l]}...{z6r-z6l} fi
   z7l..(rt x7l,top y7l)--(rt x7r,bot y7r)..z7r
  if is_egyptian: --(.5[x6r,x7r],y7r){z6l-z6r}...z6'r---
     else: {z6l-z6r}...{.5[z5,z5l]-z6'l} fi
   z5r--cycle; % lower diagonal
 numeric up_inner_jut;
 if rt x1r+cap_jut+.5u+1<=lft x3l-1.2cap_jut: up_inner_jut=1.2cap_jut;
  else: rt x1r+cap_jut+.5u+1=lft x3l-up_inner_jut; fi
 dish_serif(3,4,e,2/3,up_inner_jut,f,1/2,right_jut)(dark); % upper diagonal serif
else: fill z5'l--diag_end(5'l,6'l,.5,1,6'r,5'r)--z5'r--cycle;  fi% lower diagonal
%%%
% uppercase descender/ogonek
if is_ogonek:
   def the_pen=if known ogonek_pen: ogonek_pen
       elseif serifs: tiny elseif is_bold: fisp else: fine fi
   enddef;
   % |diag_end| refers to |tiny| pen, hence |tiny| in the following equation:
   ogonek_pos=(x6 if not serifs: l if is_bold: +.75tiny fi\\ fi,.5the_pen)
       if serifs and not is_egyptian: +(.5xvair,0) fi;
   easy_ogonek(the_pen,11,12,13); % ogonek
else:
   if not serifs:
      right_jut:=max(right_jut,hround (r-rt x6r-.65u)); fi
    if serifs:
          pickup crisp.nib;
    else:
          pickup pencircle scaled (3/5[fine,crisp]+eps);
    fi
    numeric bracket_height,light_stem; pair downward;
    bracket_height=bracket;
    light_stem=hround (max(tiny.breadth,fudged.hair if hefty:-4stem_corr fi));
    % for cyr_serif always |y$|<|y$$|
    if (y6>y1): errmessage ("`cyr_serif' placed only on the bottom"); fi
    downward=z6-z1;
    y.q0=min(y6+.5bracket_height,y1)+eps;
    top y.q1-slab-eps=bot y.q4+eps=tiny.bot y6;
    if y.q1>y.q0: y.q0:=y.q1+eps; fi
    bot y.q2=bot y.q3=vround(-d);
    y.q5=y.q1; y.q6=y.q0;
    z.q5=whatever[z6,z1]; z.q6=whatever[z6,z1];
       z.q0-penoffset downward of currentpen =
           z6r-penoffset downward of pen_[tiny.nib]-whatever*downward;
       rt x.q1=hround (tiny.rt x6r+right_jut)+eps;
       if x.q6>x.q0-eps: x.q6:=x.q0-eps; fi
       rt x.q2=lft x.q3+light_stem+eps=hround (rt x.q1+beak_jut)+eps;
       x.q4=x6-.5(fudged.stem-3stem_corr-tiny)-eps;
    pair corner,beak_corner;
    ypart corner=y.q1; corner=z.q0+whatever*downward;
    ypart beak_corner=y.q4; beak_corner=z.q3+whatever*(z.q1-z.q2);
       filldraw z.q6--z.q5
           ...(beak_darkness+eps)[beak_corner,.5[z.q3,z.q4]]
           ...{z.q2-z.q1}z.q3--z.q2--z.q1{-right_jut,0}
           ...(1/3+eps)[corner,.5[z.q1,z.q0]]{z.q0-z.q1}
           ...{z1-z6}z.q0--cycle; % descender
    labels (.q0,.q1,.q2,.q3,.q4,.q5,.q6);
%
fi
%%%%%
penlabels(1,2,3,4,5,6,7); endchar;

lhchar "Uppercase Russian letter K_beak (`concrete' form)";
cyrchar(K_beak,13.5u#,cap_height#,0); %EN_width#
if is_small_cap: getcharcode(k_beak); fi
italcorr cap_height#*slant-.5u#;
adjust_fit(min(4.5u#-.5cap_stem#,3.5u#)-.5width_adj#, % Beak_adj
 cap_serif_fit#);
% upperc_k;beak
pickup tiny.nib; pos1(fudged.cap_stem,0); pos2(fudged.cap_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5fudged.cap_stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
if serifs:
 nodish_serif(1,2,a,1/3,cap_jut,b,1/3,cap_jut); %!!! upper stem serif
 dish_serif(2,1,c,1/3,cap_jut,d,1/3,cap_jut); fi % lower stem serif
% K_cbowl
numeric right_jut,stem[],alpha[]; pickup tiny.nib;
right_jut=if serifs:.6cap_jut else:.4tiny fi;
stem1=max(tiny.breadth,fudged.hair if hefty:-3stem_corr fi);
stem2=max(tiny.breadth,fudged.cap_stem-3stem_corr);
rt x3r=hround(r-letter_fit-u-right_jut);
rt x6r=hround(r-letter_fit-.75u-right_jut);
y4=1/3h; top y3=h; bot y6=0; x4=x1;
penpos3(alpha1*(stem1-tiny),0); penpos4(whatever,-90);
alpha1=diag_ratio(1,.5(stem1-tiny),y3-y4,x3r-x4);
penpos6(alpha2*(stem2-tiny),0);
alpha2=diag_ratio(1,.5(stem2-tiny),y1-y6,x6r-x1);
forsuffixes $=l,r: y3'$=h; z4.$=z3'$+whatever*(z3-z4);
 z5.$=z6'$+whatever*(z1-z6)=whatever[z3,z4]; endfor
if serifs: y6'l=max(cap_hair,.5stem);
 z6'r=z6'l+whatever*dir(angle(y1-y6,x6r-x1));
 else: y6'l=y6'r=0; fi
z5=.5[z5l,z5r];
z3'r=z3r+penoffset z3-z4 of currentpen+whatever*(z3-z4);
% we have also |z3'l=z3l+penoffset z4-z3 of currentpen+whatever*(z3-z4)|;\]
z6'r=z6r+penoffset z1-z6 of currentpen+whatever*(z1-z6);
z6'l=z6l+penoffset z6-z1 of currentpen+whatever*(z1-z6);
fill z4r--diag_end(4r,3'r,1,.5,3'l,4l)--z4l--cycle;  % upper diagonal
if serifs: pickup if is_egyptian: crisp else: fine fi nib;
 rt x7=rt x6r+right_jut;
 if is_egyptian: y7l=0; penpos7(slab,90);
 else: y7=-o; penpos7(max(fine.breadth+eps,cap_hair-fine),90); fi
 fill z5l
  if is_egyptian: ---z6'l...{z6r-z6l}(.35[x6l,x7l],y7l)--
     else:{z6'l-.5[z5,z5l]}...{z6r-z6l} fi
   z7l..(rt x7l,top y7l)--(rt x7r,bot y7r)..z7r
  if is_egyptian: --(.5[x6r,x7r],y7r){z6l-z6r}...z6'r---
     else: {z6l-z6r}...{.5[z5,z5l]-z6'l} fi
   z5r--cycle; % lower diagonal
 numeric up_inner_jut;
 if rt x1r+cap_jut+.5u+1<=lft x3l-1.2cap_jut: up_inner_jut=1.2cap_jut;
  else: rt x1r+cap_jut+.5u+1=lft x3l-up_inner_jut; fi
 dish_serif(3,4,e,2/3,up_inner_jut,f,1/2,right_jut)(dark); % upper diagonal serif
else: fill z5'l--diag_end(5'l,6'l,.5,1,6'r,5'r)--z5'r--cycle;  fi% lower diagonal
%%%
% upper left beak
_one:=10; _two:=11;
pickup crisp.nib;
top y[_one]r=h; x[_one]=x1; pos[_one](slab,90); pos[_two](hair,180);
lft x[_two]r=l+letter_fit+hround.65u; y[_two]=good.y(y[_one]l-beak)-eps;
arm([_one],[_two],q,beak_darkness,-.7beak_jut);
%%%%%
penlabels(1,2,3,4,5,6,7); endchar;

lhchar "Uppercase Russian letter L_tl (`concrete' form)";
cyrchar(L_tl,13.5u#,cap_height#,desc_depth#); %N_width#
if is_small_cap: getcharcode(l_tl); fi
adjust_fit(if serifs: .8(flare#+(cap_stem#-stem#))-.5u#
              else:   cap_serif_fit# fi,
 -.8cap_jut#+if serifs:.5 fi u#); %Lcon_tl
% upper_spec_l;
numeric bulb_diam; bulb_diam=flare+(cap_stem-stem);
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=outer_jut+if serifs:.5 fi u; y1=y4=0; x2-x1=x4-x3;
if serifs: x3l=x2r+((x1r-x4l)*(slab/(h-slab))) %+2apex_corr;
 if not is_egyptian:-.25left_stem fi;
else: x3r= x2r+apex_corr; fi
y2=y3=h if not serifs:+apex_o+apex_oo fi;
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);
numeric t; t=slab+bracket;
forsuffixes e=l,r: z54e=(((0,t)--(w,t)) intersectionpoint (z4e--z3e)); endfor;
if serifs:
 fill stroke z3e--z54e; %!!! right stem
 pickup tiny.nib;
 penpos5(left_stem,-90); pos5'(left_stem,-90); z5'=z5;
 pos8(cap_hair,-180); pos9(bulb_diam,-180);
 y9=if is_egyptian: 0.12h else: 1/6h-max(0,flare-stem-2vair_corr-.5) fi;
 lft x9r=l+letter_fit+hround(.5u-.5);
 y5r=-o; x5=max(lft x9r+.5bulb_diam,.5[x9r,x1r]);
 y6l=y9+bulb_diam-hair;
 numeric t; t=1-slant;
 z7r=(max(.75[x1,x1r],x9+if is_egyptian: (if is_small_cap: 2.25 else: 2.667 fi
                            +max(-2slant,.5slant))*hair
                         else: if is_bold:.75 fi bulb_diam+1.35hair fi),
        y7l-t*7/8left_stem);
 z7l=(x7r-2/3(x1r-x1l),if is_egyptian: .35[y5l,y5] else: y5 fi);%y5l);
 z6r=(x7r,y1)+whatever*((x1r,y1)-z2r); y6r-y6l=t*(y5r-y5l);
 x6r-x6l=1/2(x1r-x1l);
 fill stroke z2e{z1e-z6e}.. controls z6e and z7e ..z5e;
 {{less_tense; cyrbulb(5',8,9)}};  % arc and bulb
 numeric inner_jut,left_jut,fit; pickup tiny.nib;
 x10r=x3r; top y10=h; pos10(alpha*right_stem,0); x4:=x4r;
 left_jut=cap_jut+left_stem;
 serif(10,4,c,0,-left_jut); % upper  serif
 pickup tiny.nib;
 prime_points_inside(1,2); prime_points_inside(4,3);
 if rt x1'r+cap_jut+.5u+1<=lft x4'l-cap_jut: inner_jut=cap_jut;
  else: rt x1'r+inner_jut+.5u+1=lft x4'l-inner_jut; fi
 %dish_serif(4',3,d,1/2,inner_jut,e,1/3,outer_jut); %!!! right serif
else: z0=whatever[z1r,z2r]=whatever[z3l,z4l];
 if y0<h-notch_cut: y0:=h-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--z54l--z54r--diag_end(2l,1l,1,1,1r,0)--cycle; fi fi %!!! left and right diagonals
%%%%%
% L_tail(4);X_tail
_zero:=4;
_one:=11; _two:=12; _three:=13; _four:=14;
%
% X_
pickup fine.nib;
stem3=hround (max(fine.breadth,.5[stem1,x[_zero]r-x[_zero]l]));
x[_one]'r=x[_zero]r;
penpos[_one]'(stem3,0); pos[_one](stem3,0); z[_one]=z[_one]';
bot y[_one]=max(-1/3d-eps,-d+if serifs: vair'else: slab fi);
(x[_one]'l,y54')=whatever[z4l,z4l+dir angle(z4l-if serifs:z1l else:z34'fi)];
z54'=(x[_one]'l,y54');
fill z54l{z4r-z1r}
        ..controls (z54')..
        {down}z[_one]'l--z[_one]'r{up}
        ..controls (z4r)..
        {z1r-z4r}z54r--cycle; %link
% _X
if serifs:
 numeric bulb_diam;
 bulb_diam=max(currentbreadth+eps,min(.82d-1-eps,flare+(cap_stem-stem)));
 pos[_two](vair',-90); pos[_three](hair,-180);
 pos[_four](bulb_diam,-180);
 x[_two]=.5[x[_one],x[_three]r];
 bot y[_two]r=-d-oo; y[_three]-.5bulb_diam=vround max(-.85d,y[_two]r+eps)+eps;
 z[_three]r=z[_four]r;
 rt x[_four]l=floor x[_one]-2.5u if monospace: / expansion_factor fi;%!!!
 filldraw stroke pulled_arc.e([_one],[_two]);%!!!
 bulb([_two],[_three],[_four]); % bulb
else:
 pos[_two](slab,-90); pos[_three](flare,-105);
 rt x[_three]r=x[_one]-4u; bot y[_three]r=-d;%!!!
 bot y[_two]r=-d-o; x[_two]=.4[x[_three]r,x[_one]r];%!!!
 filldraw stroke super_arc.e([_one],[_two])%!!!
  & term.e([_two],[_three],left,.8,4); fi
%%%
penlabels(0,2,6,3,4,5,7,8,9,10); endchar;

endgroup;

endinput;
%end of file