forked from paveldedik/bc-thesis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fi-logo.mf
1546 lines (1440 loc) · 61 KB
/
fi-logo.mf
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
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%% version 0.01 (94/01/20 -- corrected scaling)
%% version 0.02 (94/01/25 -- 2nd and 3rd order corrections added)
%% version 0.03 (94/01/31 -- dpi values scaled down to 1/100
%% and logo widening limited)
%% version 0.04 (94/02/10 -- color filling overshoot corrected)
mode_setup; font_size 10pt#;
font_identifier:="Faculty of Informatics logo";
font_coding_scheme:="UNSPECIFIED";
if unknown dpi: scantokens ("dpi:=0" &
substring (7, length jobname-2) of jobname & "." &
substring(length jobname-2,length jobname) of jobname);
fi
if length jobname < 9: dpi:=10dpi; fi
if dpi=0:
message "Missing dpi information. Assuming 300.";
dpi:=3;
fi
scaling_factor:=1.13;
mag_dpi:=mag*(3/dpi);
if mag_dpi<1:
taller_letters := 1+(1-mag_dpi)**2;
wider_logo:=1+(1-max(mag_dpi,1/3))**3;
else:
taller_letters:=1;
wider_logo:=1;
fi
u#:=21/36pt#; % unit width from cmsc
%%u#:=scaling_factor*64/11pt#; uu#:=.1u#; % basic units
uu#:=scaling_factor*(36/21)*(64/11)*.1u#; % basic units
barw#:=12uu#; % bar width
aarw#:=13uu#; % bar width
carw#:=11uu#;
darw#:=10uu#;
triw#:=110uu#; % triangle width
gapw#:=5uu#; % gap width
hapw#:=3uu#; % gap width
serif#:=4uu#; % serif width
pen_size#=1/2uu#;
r:= 1/2 (sqrt 3) ;
barww#:= r * barw#;
triww#:= r * triw#;
pair f[]dvips;
path b[];
define_pixels(barw,aarw,carw,darw,triw,gapw,hapw,serif,barww,triww);
define_blacker_pixels(pen_size);
%%beginchar(65,triw#+aarw#,r*triw#+r*carw#,0);
beginchar(65,0,0,0);
"Le silence eternel de ces espace infinis m'effraie. --B.Pascal,1670";
%%x1 = 1/2 triw*wider_logo + aarw ; y1 = 0;
x1 = 2/3aarw*wider_logo ; y1 = -2/3(r*triw)-1/3(r*carw*wider_logo);
x2 = x1 +(1/2 triw);
z2 - z1 = whatever * dir 60;
z4 - z3 = (z2 - z1);
z6 - z5 = (z2 - z1);
z8 - z7 = (z2 - z1);
z3 - z7 = whatever * dir 0;
z3 - z1 = darw*wider_logo * dir 120;
z7 - z5 = darw*wider_logo * dir 120;
z7 - z3 = aarw*wider_logo * dir 180;
z1 - z5 = whatever * dir 0;
showdependencies;
z21 = z4 - (carw*wider_logo * dir 60);
z10 - z1 = whatever * dir 120;
z16 = whatever [z21, z21 + dir 0] = whatever [z5, z5 + dir 120];
z16 - z17 = barw*wider_logo * dir 120;
z10 = whatever [z17, (z17+dir 0)];
z15 = whatever [z5 , z16];
k=darw*wider_logo+hapw;
z15 = z5 + k * dir 120;
z9 = z1 + k * dir 120;
whatever [z9 , z15] = whatever [z1 , z10];
z11 = z9 + carw*wider_logo * dir 60;
z12 = whatever [z10, z10 + dir 0] = whatever [z11, z11 + dir 120];
z18 = whatever [z17, z17 + dir 0] = whatever [z1 , z2];
z19 = whatever [z7 , z8] = whatever [z17 , z18];
z20 = whatever [z12 , z19];
x19 - x20 = serif;
%z21 = whatever [z16, z16 + dir 0] = whatever [z3 , z4];
z22 = whatever [z16 , z21] = whatever [z7 , z8];
z23 = whatever [z16 , z22] = whatever [z20 , z20 + dir 100];
z24 = whatever [z4 , z8] = whatever [z23 , z23 + dir 60];
z25 = whatever [z15 , z9] = whatever [z7 , z22];
z26 = whatever [z11 , z12] =whatever [z7 , z22];
z27 = whatever [z19 , z10]; x27 - x20 = - gapw;
z28 = whatever [z22 , z23]; x28 - x23 = - gapw;
z29 = whatever [z24 , z8]; x29 - x24 = - gapw;
z30 = whatever [z23 , z24] = whatever [z29 , z29 + dir 280];
z31 = whatever [z20 , z23] = whatever [z27 , z27 + dir 60];
z32 = whatever [z4 , z29]; x32 - x4 = - length (z21 - z16);
z33 = 2/3 [z9 , z10];
z34 = whatever [z33, z33 + dir 0] = whatever [z7 , z22];
z35 = whatever [z9 , z10]; x33 - x35 = x3 - x1;
z36 = whatever [z35, z35 + dir 0] = whatever [z5 , z6];
z37 = whatever [z12 , z11]; x37 - x11 = x33 - x9;
z38 = whatever [z37 , z37 + dir 0] = whatever [z7 , z22];
z39 = whatever [z35 , z36]; x39 - x35 = gapw;
z40 = whatever [z33 , z34]; x40 - x33 = gapw;
z41 = whatever [z37 , z38]; x41 - x37 = gapw;
z42 = whatever [z33 , z34]; x34 - x42 = 2gapw;
z43 = whatever [z42 , z42 + dir 280] = whatever [z35 , z39]; %%%
%z44 = whatever [z35 , z36] = whatever [z7 , z22];
z45 = whatever [z37 , z38]; x38 - x45 = 2gapw;
%z46 = whatever [z45 , z45 + dir 280] = whatever [z7 , z22];
z46 = whatever [z45 , z45 + dir 280] = whatever [z43 , z43+ z45-z42];
z47 = whatever [z11 , z12] = whatever [z40 , z41];
z48 = whatever [z11 , z12] = whatever [z35 , z36];
z49 = whatever [z1 , z2] = whatever [z4 , z4 + dir 290];
pickup pencircle scaled (pen_size*wider_logo);
draw z1--z49--z4--z3--z1;
draw z1--z3--z7--z5--z1;
draw z23--z24--z4;
draw z10--z9--z15--z16;
draw z9--z11--z48;
draw z47--z12--z10--z27--z28;
draw z7--z25--z9--z11--z26--z22--z23--z20--z19;
draw z27--z31--z23--z30--z29--z28--z27;
draw z16--z32--z29--z28--z16;
draw z39--z43--z42--z40--z39;
draw z40--z41--z45--z42;
draw z45--z46--z43;
fill z15--z9--z10--z27--z28--z16--cycle;
fill z39--z43--z42--z40--cycle;
fill z7--z3--z4--z24--z23--z22--z26--z11--z9--z25--cycle;
%%%erase draw rt z25 -- lft z9;
b[1]:=z16--z28--z29--z32--cycle;
b[2]:=z9--z10--z12--z47--z40--z39--z48--z11--cycle;
b[3]:=z27--z28--z29--z30--z23--z31--cycle;
b[4]:=z20--z23--z22--z19--cycle;
b[5]:=z1--z3--z4--z49--cycle;
b[6]:=z1--z5--z7--z3--cycle;
b[7]:=z40--z42--z45--z41--cycle;
b[8]:=z42--z45--z46--z43--cycle;
labels(range 1 thru 49);
f[1]dvips:=1/2[z9,z16];
f[2]dvips:=1/2[z1,z7];
endchar;
beginchar(66,0,0,0);
"Faculty of Informatics logo colors";
fill b[1];
fill b[2];
fill b[3];
fill b[4];
fill b[5];
fill b[6];
fill b[7];
fill b[8];
pickup pencircle scaled (pen_size*wider_logo);
undraw b[1];
undraw b[2];
undraw b[3];
undraw b[4];
undraw b[5];
undraw b[6];
undraw b[7];
undraw b[8];
endchar;
% Computer Modern Roman Caps and Small Caps 10 point
if unknown cmbase: input cmbase fi
%%%font_identifier:="CMCSC";
font_size 10pt#;
% first come parameters used to set the uppercase letters
% (including some for lowercase that aren't actually used)
u#:=21/36pt#; % unit width
width_adj#:=0pt#; % width adjustment for certain characters
serif_fit#:=0pt#; % extra sidebar near lowercase serifs
cap_serif_fit#:=5/36pt#; % extra sidebar near uppercase serifs
letter_fit#:=5/36pt#; % extra space added to all sidebars
body_height#:=270/36pt#; % height of tallest characters
asc_height#:=250/36pt#; % height of lowercase ascenders
cap_height#:=246/36pt#; % height of caps
fig_height#:=232/36pt#; % height of numerals
x_height#:=155/36pt#; % height of lowercase without ascenders
math_axis#:=90/36pt#; % axis of symmetry for math symbols
bar_height#:=87/36pt#; % height of crossbar in lowercase e
comma_depth#:=70/36pt#; % depth of comma below baseline
desc_depth#:=70/36pt#; % depth of lowercase descenders
crisp#:=0pt#; % diameter of serif corners
tiny#:=8/36pt#; % diameter of rounded corners
fine#:=7/36pt#; % diameter of sharply rounded corners
thin_join#:=7/36pt#; % width of extrafine details
hair#:=9/36pt#; % lowercase hairline breadth
stem#:=25/36pt#; % lowercase stem breadth
curve#:=30/36pt#; % lowercase curve breadth
ess#:=27/36pt#; % breadth in middle of lowercase s
flare#:=33/36pt#; % diameter of bulbs or breadth of terminals
dot_size#:=38/36pt#; % diameter of dots
cap_hair#:=11/36pt#; % uppercase hairline breadth
cap_stem#:=32/36pt#; % uppercase stem breadth
cap_curve#:=37/36pt#; % uppercase curve breadth
cap_ess#:=35/36pt#; % breadth in middle of uppercase s
rule_thickness#:=.4pt#; % thickness of lines in math symbols
dish#:=1/36pt#; % amount erased at top or bottom of serifs
bracket#:=20/36pt#; % vertical distance from serif base to tangent
jut#:=28/36pt#; % protrusion of lowercase serifs
cap_jut#:=37/36pt#; % protrusion of uppercase serifs
beak_jut#:=10/36pt#; % horizontal protrusion of beak serifs
beak#:=70/36pt#; % vertical protrusion of beak serifs
vair#:=8/36pt#; % vertical diameter of hairlines
notch_cut#:=10pt#; % maximum breadth above or below notches
bar#:=11/36pt#; % lowercase bar thickness
slab#:=11/36pt#; % serif and arm thickness
cap_bar#:=11/36pt#; % uppercase bar thickness
cap_band#:=11/36pt#; % uppercase thickness above/below lobes
cap_notch_cut#:=10pt#; % max breadth above/below uppercase notches
serif_drop#:=4/36pt#; % vertical drop of sloped serifs
stem_corr#:=1/36pt#; % for small refinements of stem breadth
vair_corr#:=1/36pt#; % for small refinements of hairline height
apex_corr#:=0pt#; % extra width at diagonal junctions
o#:=8/36pt#; % amount of overshoot for curves
apex_o#:=8/36pt#; % amount of overshoot for diagonal junctions
slant:=0; % tilt ratio $(\Delta x/\Delta y)$
fudge:=1; % factor applied to weights of heavy characters
math_spread:=0; % extra openness of math symbols
superness:=1/sqrt2; % parameter for superellipses
superpull:=1/6; % extra openness inside bowls
beak_darkness:=11/30; % fraction of triangle inside beak serifs
ligs:=1; % level of ligatures to be included
square_dots:=false; % should dots be square?
hefty:=false; % should we try hard not to be overweight?
serifs:=true; % should serifs and bulbs be attached?
monospace:=false; % should all characters have the same width?
variant_g:=false; % should an italic-style g be used?
low_asterisk:=false; % should the asterisk be centered at the axis?
math_fitting:=false; % should math-mode spacing be used?
% now come replacements used to set the lowercase caps
lower.u#:=16/36pt#; % unit width
lower.width_adj#:=0pt#; % width adjustment for certain characters
lower.cap_serif_fit#:=4/36pt#; % extra sidebar near uppercase serifs
lower.letter_fit#:=2.4/36pt#; % extra space added to all sidebars
lower.body_height#:=200/36pt#; % height of tallest characters
lower.cap_height#:=185/36pt#; % height of caps
lower.x_height#:=116/36pt#; % height of lowercase without ascenders
lower.bar_height#:=65/36pt#; % height of crossbar in lowercase e
lower.comma_depth#:=52/36pt#; % depth of comma below baseline
lower.flare#:=25/36pt#; % diameter of bulbs or breadth of terminals
lower.cap_hair#:=9.1/36pt#; % uppercase hairline breadth
lower.stem#:=21/36pt#; % lowercase stem breadth
lower.cap_stem#:=26/36pt#; % uppercase stem breadth
lower.cap_curve#:=31/36pt#; % uppercase curve breadth
lower.cap_ess#:=28/36pt#; % breadth in middle of uppercase s
lower.cap_jut#:=26/36pt#; % protrusion of uppercase serifs
lower.beak_jut#:=7/36pt#; % horizontal protrusion of beak serifs
lower.beak#:=52/36pt#; % vertical protrusion of beak serifs
lower.slab#:=9.1/36pt#; % serif and arm thickness
lower.cap_bar#:=9.1/36pt#; % uppercase bar thickness
lower.cap_band#:=9.1/36pt#; % uppercase thickness above/below lobes
lower.cap_notch_cut#:=10pt#; % max breadth above/below uppercase notches
lower.o#:=5/36pt#; % amount of overshoot for curves
lower.apex_o#:=4/36pt#; % amount of overshoot for diagonal junctions
lower.fudge:=1; % factor applied to weights of heavy characters
% Caps and Small Caps in Computer Modern Roman
font_coding_scheme:=if ligs=0: "TeX typewriter text"
else: "TeX text without f-ligatures" fi;
%mode_setup;
font_setup;
radius#:=scaling_factor*80u#;
define_pixels(radius);
%beginchar("[",scaling_factor*radius#+cap_height#,
% scaling_factor*radius#+cap_height#,
% scaling_factor*radius#+cap_height#);
%endchar;
%
%beginchar("]",scaling_factor*radius#+cap_height#,
% scaling_factor*radius#+cap_height#,
% scaling_factor*radius#+cap_height#);
%endchar;
let CMCHAR = cmchar;
def cmchar = CMCHAR; enddef;
let ENDCHAR = endchar;
def endchar =
scantokens extra_endchar;
if proofing>0: makebox(proofrule); fi
chardx:=w;
charwd:=0; charht:=0; chardp:=0;
shipit;
if displaying>0: makebox(screenrule); showit; fi
endgroup enddef;
%%%input romanu; % upper case (majuscules)
% Computer Modern Roman upper case:
% These letters were originally coded by D. E. Knuth in November, 1979,
% inspired by the Monotype faces used in {\sl The Art of Computer Programming}.
% Sans serif designs by Richard Southall were added in April, 1982.
% The programs were revised for the new \MF\ conventions in 1985.
% Character codes \0101 through \0132 are generated.
def t_=transformed currenttransform enddef;
width.A:=13u;
def A_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter A";
beginchar(n,13u#,cap_height#,0);
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric left_stem,right_stem,outer_jut,alpha;
right_stem=cap_stem-stem_corr;
left_stem=min(cap_hair if hefty: -3stem_corr fi,right_stem);
outer_jut=.8cap_jut; x1l=w-x4r=l+letter_fit+outer_jut+.5u; y1=y4=0;
x2-x1=x4-x3; x3r=x2r+apex_corr; y2=y3=h+apex_o+apex_oo;
alpha=diag_ratio(2,left_stem,y2-y1,x4r-x1l-apex_corr);
penpos1(alpha*left_stem,0); penpos2(alpha*left_stem,0);
penpos3(alpha*right_stem,0); penpos4(alpha*right_stem,0);
z0=whatever[z1r,z2r]=whatever[z3l,z4l];
if y0<h-cap_notch_cut: y0:=h-cap_notch_cut;
fill z0+.5right{down}...{z4-z3}diag_end(3l,4l,1,1,4r,3r)
--diag_end(4r,3r,1,1,2l,1l)--diag_end(2l,1l,1,1,1r,2r){z2-z1}
...{up}z0+.5left--cycle; % left and right diagonals
else: fill z0--diag_end(0,4l,1,1,4r,3r)--diag_end(4r,3r,1,1,2l,1l)
--diag_end(2l,1l,1,1,1r,0)--cycle; fi % left and right diagonals
penpos5(whatever,angle(z2-z1)); z5=whatever[z1,z2];
penpos6(whatever,angle(z3-z4)); z6=whatever[z3,z4]; y6=y5;
if hefty: y5r else: y5 fi =5/12y0;
y5r-y5l=y6r-y6l=cap_band; penstroke z5e--z6e; % bar line
if serifs: numeric inner_jut; 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(1',2,a,1/2,outer_jut,b,.6,inner_jut)(dark); % left serif
dish_serif(4',3,c,1/2,inner_jut,d,1/3,outer_jut); fi % right serif
penlabels(0,1,2,3,4,5,6); endchar;
enddef;
width.B:=12.5u;
def B_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter B";
beginchar(n,12.5u#,cap_height#,0);
italcorr .75cap_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,0);
numeric left_stem,right_curve,middle_weight;
left_stem=cap_stem-hround 2stem_corr; middle_weight=.6vair+.5;
pickup tiny.nib; pos1(left_stem,0); pos2(left_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5left_stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
penpos3(cap_band,90); penpos4(cap_band,90);
penpos6(middle_weight,-90); penpos7(middle_weight,-90);
penpos8(middle_weight,90); penpos9(middle_weight,90);
penpos5(right_curve-stem_corr,0); penpos10(right_curve,0);
penpos11(cap_band,-90); penpos12(cap_band,-90);
z3r=top z1; y4=y3; y5=.5[y4,y6]; y6=y7; y7l-y8l=vair;
z12r=bot z2; y11=y12; y10=.5[y11,y9]; y8=y9; .5[y7l,y8l]=.52h;
x4=x6; x9=x11=x4+.5u; x7=x8=x1; x9l:=x4+.25u;
x5r=hround(w-1.5u); x10r=hround(w-u);
if serifs: right_curve=cap_curve-stem_corr; x4=.5[x1,w-1.5u];
else: right_curve=cap_curve-3stem_corr; x4=.5[x1,w-2.5u];
x4l:=x4l-.5u; x9l:=x9l-.5u; fi
x6l:=x6l-.5u; x11l:=x11l-.5u;
fill stroke z3e..super_arc.e(4,5) & super_arc.e(5,6)..z7e; % upper lobe
fill stroke z8e..super_arc.e(9,10) & super_arc.e(10,11)..z12e; % lower lobe
if serifs: nodish_serif(1,2,a,1/3,cap_jut,b,1/3,.5cap_jut); % upper serif
nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi % lower serif
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6,7,8,9,10,11,12); endchar;
enddef;
if serifs: width.C:=13u;
else: width.C:=11.5u;
fi;
def C_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter C";
if serifs: beginchar(n,13u#,cap_height#,0);
italcorr cap_height#*slant-.5u#;
adjust_fit(0,0);
pickup fine.nib; pos1(cap_hair,0); pos2(cap_band,90);
pos3(cap_curve,180); pos4(cap_band,270); pos5(hair,360);
rt x1r=rt x5r=hround(w-u); lft x3r=hround u; x2=x4=.55[x3,x1];
top y2r=h+o; bot y4r=-o; y3=.5[y2,y4];
bot y1=min(vround max(.6h,x_height-.5vair),bot y2l-eps);
y5=max(good.y .95(h-y1),y4l+eps);
(x2l',y2l)=whatever[z2r,z1l]; x2l:=min(x2l',x2l+.5u);
(x4l',y4l)=whatever[z4r,z5l]; x4l:=min(x4l',x4l+.5u);
filldraw stroke z1e{x2-x1,10(y2-y1)}
...pulled_arc.e(2,3) & pulled_arc.e(3,4)...{up}z5e; % arc
pos6(.3[fine.breadth,cap_hair],0); x6r=x1r; top y6=h+o;
x1r-x1'=2cap_curve-fine; y1'=y1;
path upper_arc; upper_arc=z1{x2-x1,10(y2-y1)}..z2{left};
numeric t; t=xpart(upper_arc intersectiontimes (z6l--z1'));
filldraw z1r--z6r--z6l--subpath(t,0) of upper_arc--cycle; % barb
else: beginchar(n,11.5u#,cap_height#,0);
italcorr cap_height#*slant-.5u#;
adjust_fit(0,0);
pickup fine.nib; pos1(1.2flare,80); pos2(slab,90);
pos3(cap_curve,180); pos4(slab,270); pos5(flare,275);
rt x1r=hround(w-1.1u); x2=x4=.5w+1.25u;
lft x3r=hround max(u,2u-.5cap_curve); rt x5r=hround(w-.9u);
top y1r=vround .95h+o; top y2r=h+o; y3=.5h;
bot y4r=-o; bot y5r=vround .08h-o; y5l:=good.y y5l; x5l:=good.x x5l;
filldraw stroke rterm.e(2,1,right,.9,4) & super_arc.e(2,3)
& super_arc.e(3,4) & term.e(4,5,right,.8,4); fi % arc and terminals
math_fit(-.3cap_height#*slant-.5u#,.5ic#);
penlabels(1,1',2,3,4,5,6); endchar;
enddef;
width.D:=13.5u;
def D_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter D";
beginchar(n,13.5u#,cap_height#,0);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,0);
pickup tiny.nib; pos1(cap_stem',0); pos2(cap_stem',0);
lft x1l=lft x2l=hround max(2u,3u-.5cap_stem'); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
penpos3(cap_band,90); penpos4(cap_band,90);
penpos5(cap_curve-stem_corr,0);
penpos6(cap_band,-90); penpos7(cap_band,-90);
z3r=top z1; y4=y3; y5=.51[y4,y6]; y6=y7;
z7r=bot z2; x4=x6=.5w+.25u; x5r=hround(w-u);
x4l:=x6l:=x4-.25cap_curve;
fill stroke z3e..pulled_arc.e(4,5) & pulled_arc.e(5,6)..z7e; % lobe
if serifs: nodish_serif(1,2,a,1/3,cap_jut,b,1/3,.5cap_jut); % upper serif
nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi % lower serif
math_fit(0,ic#-.5u#); penlabels(1,2,3,4,5,6,7); endchar;
enddef;
width.E:=12u-width_adj;
def E_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter E";
beginchar(n,12u#-width_adj#,cap_height#,0);
italcorr cap_height#*slant-beak_jut#-.5u#;
adjust_fit(cap_serif_fit#,0);
h:=vround(h-stem_corr);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5cap_stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
pickup crisp.nib; pos3(slab,90); pos4(hair,0);
top y3r=h; x3=x1; rt x4r=hround(w-u); y4=good.y(y3l-beak)-eps;
arm(3,4,e,beak_darkness,beak_jut); % upper arm and beak
pos5(cap_bar,-90); pos6(hair,0);
top y5l=vround(.52[y2,y1]+.5cap_bar); x5=x1;
pos0(cap_bar,90); pos7(hair,0);
z0=z5; x6=x7; y6-y5l=y0l-y7;
if serifs: rt x6r=hround(w-4.4u+.5hair); y6=good.y(y5l+.6beak)+eps;
rt x9r=hround(w-.5u);
else: rt x6r=hround(w-1.5u); y6=y5l+eps; rt x9r=hround(w-.75u); fi
arm(5,6,f,beak_darkness,0); arm(0,7,g,beak_darkness,0); % middle arm and serif
pos8(slab if not serifs:+2stem_corr fi,-90); pos9(hair,0);
bot y8r=0; x8=x2; y9=good.y(y8l+7/6beak)+eps;
arm(8,9,h,beak_darkness,1.5beak_jut); % lower arm and beak
if serifs: nodish_serif(1,2,a,1/3,cap_jut,b,1/3,.5cap_jut); % upper serif
nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi % lower serif
math_fit(0,.5ic#); penlabels(0,1,2,3,4,5,6,7,8,9); endchar;
enddef;
width.F:=11.5u-width_adj;
def F_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter F";
beginchar(n,11.5u#-width_adj#,cap_height#,0);
italcorr cap_height#*slant-beak_jut#-.25u#;
adjust_fit(cap_serif_fit#,0);
h:=vround(h-stem_corr);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5cap_stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
pickup crisp.nib; pos3(slab,90); pos4(hair,0);
top y3r=h; x3=x1; rt x4r=hround(w-.75u); y4=good.y(y3l-beak)-eps;
arm(3,4,e,beak_darkness,beak_jut); % upper arm and beak
pos5(cap_bar,-90); pos6(hair,0);
top y5l=vround(.5[y2,y1]+.5cap_bar); x5=x1;
pos0(cap_bar,90); pos7(hair,0);
z0=z5; x6=x7; y6-y5l=y0l-y7;
if serifs: rt x6r=hround(w-4u+.5hair); y6=good.y(y5l+.6beak)+eps;
rt x9r=hround(w-.5u);
else: rt x6r=hround(w-1.5u); y6=y5l+eps; rt x9r=hround(w-.75u); fi
arm(5,6,f,beak_darkness,0); arm(0,7,g,beak_darkness,0); % middle arm and serif
if serifs: nodish_serif(1,2,a,1/3,cap_jut,b,1/3,.5cap_jut); % upper serif
dish_serif(2,1,c,1/3,cap_jut,d,1/3,1.25cap_jut); fi % lower serif
math_fit(0,ic#-2.5u#); penlabels(0,1,2,3,4,5,6,7,8,9); endchar;
enddef;
if serifs: width.G:=14u;
else: width.G:=12u; fi;
def G_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter G";
if serifs: beginchar(n,14u#,cap_height#,0);
italcorr cap_height#*slant-1.5u#-.5cap_serif_fit#;
adjust_fit(0,.5cap_serif_fit#);
pickup tiny.nib; pos0(cap_stem,0); pos7(cap_stem,0);
rt x0r=hround(w-2u); y0=good.y(.1[bar_height,x_height]+1); x7=x0;
pickup fine.nib;
if hefty: bot y7=0; pos5(cap_stem,0); x5=x0; top y5=tiny.top y0;
else: pos5(cap_hair,0); pos8(cap_stem,0);
y7=.5bar_height; z5l=z8l; z8=z7; x9=x8r; bot y9=0;
filldraw z8l{down}..{4(x9-x8),y9-y8}z9--z8r--cycle; fi % spur
pos1(cap_hair,0); pos2(cap_band,90);
pos3(cap_curve,180); pos4(cap_band,270);
rt x1r=hround(w-2u); lft x3r=hround u; x2=x4=.55[x3,x1];
top y2r=h+o; bot y4r=-o; y3=.5[y2,y4];
bot y1=min(vround max(.6h,x_height-.5vair),bot y2l-eps);
(x2l',y2l)=whatever[z2r,z1l]; x2l:=min(x2l',x2l+.5u);
(x4l',y4l)=whatever[z4r,z5l]; x4l:=min(x4l',x4l+.5u);
filldraw stroke z1e{x2-x1,10(y2-y1)}
...pulled_arc.e(2,3) & pulled_arc.e(3,4)...z5e{up}; % arc
pos6(.3[fine.breadth,cap_hair],0); x6r=x1r; top y6=h+o;
x1r-x1'=2cap_curve-fine; y1'=y1;
path upper_arc; upper_arc=z1{x2-x1,10(y2-y1)}..z2{left};
numeric t; t=xpart(upper_arc intersectiontimes (z6l--z1'));
filldraw z1r--z6r--z6l--subpath(t,0) of upper_arc--cycle; % barb
pickup tiny.nib; filldraw stroke z0e--z7e; % stem
dish_serif(0,7,a,1/3,max(cap_jut,2.25u),b,1/3,1.25u); % serif
math_fit(-.3cap_height#*slant-.5u#,ic#);
else: beginchar(n,12u#,cap_height#,0);
italcorr cap_height#*slant-.5u#;
adjust_fit(0,0);
pickup fine.nib; pos1(1.2flare,80); pos2(slab,90);
pos3(cap_curve,180); pos4(slab,270); pos5(flare,270);
rt x1r=hround(w-1.35u); x2=x4=.5w+u;
lft x3r=hround max(u,2u-.5cap_curve); rt x5l=hround(w-1.2u);
top y1r=vround .93h+o; top y2r=h+o; y3=.5h;
bot y4r=-o; bot y5r=vround .07h-o;
filldraw stroke rterm.e(2,1,right,.9,4)&super_arc.e(2,3)
& super_arc.e(3,4) & term.e(4,5,right,1,4); % arc and terminals
pos0(stem,0); pos7(stem,0);
z7r=z5r; x0=x7; top y0=1+vround .35[bar_height,x_height];
filldraw stroke z0e--z7e; % stem
pos8(cap_bar,90); pos9(cap_bar,90);
z0r=z9r; y8=y9; lft x8=hround x4;
filldraw stroke z8e--z9e; % bar
math_fit(-.3cap_height#*slant-.5u#,.5ic#); fi
penlabels(0,1,1',2,3,4,5,6,7,8,9); endchar;
enddef;
width.H:=13u+width_adj;
def H_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter H";
beginchar(n,13u#+width_adj#,cap_height#,0);
italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(cap_serif_fit#,cap_serif_fit#);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
pos3(cap_stem,0); pos4(cap_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5cap_stem); x3=x4=w-x1;
top y1=top y3=h; bot y2=bot y4=0;
filldraw stroke z1e--z2e; % left stem
filldraw stroke z3e--z4e; % right stem
penpos5(cap_bar,90); penpos6(cap_bar,90);
x5=x1; x6=x3; y5=y6=.52h;
fill stroke z5e--z6e; % bar
if serifs: numeric inner_jut;
if rt x1r+cap_jut+.5u+1<=lft x3l-cap_jut: inner_jut=cap_jut;
else: rt x1r+inner_jut+.5u+1=lft x3l-inner_jut; fi
dish_serif(1,2,a,1/3,cap_jut,b,1/3,inner_jut); % upper left serif
dish_serif(2,1,c,1/3,cap_jut,d,1/3,inner_jut); % lower left serif
dish_serif(3,4,e,1/3,inner_jut,f,1/3,cap_jut); % upper left serif
dish_serif(4,3,g,1/3,inner_jut,h,1/3,cap_jut); fi % lower left serif
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6); endchar;
enddef;
width.I:=max(6u,4u+cap_stem);
def I_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter I";
beginchar(n,max(6u#,4u#+cap_stem#),cap_height#,0);
italcorr cap_height#*slant-.25u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
lft x1l=lft x2l=hround(.5w-.5cap_stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
if serifs: dish_serif(1,2,a,1/3,1.05cap_jut,b,1/3,1.05cap_jut); % upper serif
dish_serif(2,1,c,1/3,1.05cap_jut,d,1/3,1.05cap_jut); fi % lower serif
math_fit(0,.5ic#); penlabels(1,2); endchar;
enddef;
width.J:=9u;
def J_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter J";
beginchar(n,9u#,cap_height#,0);
italcorr cap_height#*slant-cap_serif_fit#
+.75cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(0,cap_serif_fit#);
pickup tiny.nib; pos1(cap_stem',0); pos2(cap_stem',0);
top y1=h; rt x1r=hround(w-2u); x2=x1; y2=.21h;
if serifs: pos3(vair,-90); pos4(cap_hair,-180);
pos5(flare+(cap_stem-stem),-180);
bot y3r=-o; x3=.5[x4,x2]; y5=1/6h; rt x5l=hround 2.75u; z5r=z4r;
filldraw stroke z1e--z2e&super_arc.e(2,3); % stem and arc
dish_serif(1,2,a,1/3,1.3cap_jut,b,1/3,.75cap_jut); % serif
pickup tiny.nib; bulb(3,4,5); % bulb
else: filldraw stroke z1e--z2e; % stem
pickup fine.nib; pos3(cap_stem',0); z3=z2;
pos4(flare,angle(6.5u,-h)); pos5(1.1flare,-100);
bot y4r=-o; x4r=.5[x5r,x3r]; lft x5r=hround.75u; bot y5r=vround.06h-o;
filldraw stroke z3e{down}....term.e(4,5,left,1,4); fi % arc and terminal
math_fit(0,.5ic#-.5u#); penlabels(1,2,3,4,5); endchar;
enddef;
width.K:=13.5u;
def K_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter K";
beginchar(n,13.5u#,cap_height#,0);
italcorr cap_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric right_jut,stem[],alpha[];
if serifs: right_jut=.6cap_jut;
else: right_jut=.4tiny; fi
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
stem2=max(tiny.breadth,fudged.cap_stem-3stem_corr);
stem1=max(tiny.breadth,fudged.hair if hefty:-3stem_corr fi);
top y3=h; rt x3r=hround(r-letter_fit-u-right_jut);
bot y6=0; rt x6r=hround(r-letter_fit-.75u-right_jut);
x4=x1; y4=1/3h;
alpha1=diag_ratio(1,.5(stem1-tiny),y3-y4,x3r-x4);
penpos3(alpha1*(stem1-tiny),0); penpos4(whatever,-90);
alpha2=diag_ratio(1,.5(stem2-tiny),y1-y6,x6r-x1);
penpos6(alpha2*(stem2-tiny),0);
forsuffixes $=l,r: y3'$=h; y6'$=0; z4$=z3'$+whatever*(z3-z4);
z5$=z6'$+whatever*(z1-z6)=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 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
fill z5l--diag_end(5l,6'l,.5,1,6'r,5r)--z5r--cycle; % lower diagonal
if serifs: numeric inner_jut;
if rt x2r+cap_jut+.5u+1<=lft x6l-cap_jut: inner_jut=cap_jut;
else: rt x2r+cap_jut+.5u+1=lft x6l-inner_jut; fi
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); % lower stem serif
dish_serif(3,4,e,2/3,1.2cap_jut,f,1/2,right_jut)(dark); % upper diagonal serif
dish_serif(6,5,g,1/2,inner_jut,h,1/3,right_jut)(dark);fi % lower diagonal serif
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6); endchar;
enddef;
width.L:=11u-width_adj;
def L_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter L";
beginchar(n,11u#-width_adj#,cap_height#,0);
adjust_fit(cap_serif_fit#,0);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
lft x1l=lft x2l=hround max(2u,3u-.5cap_stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
pickup crisp.nib; pos3(slab,-90); pos4(hair,0);
bot y3r=0; x3=x2; y4=y3l+7/6beak+eps; rt x4r=hround(w-.75u);
arm(3,4,e,1.2beak_darkness,beak_jut); % lower arm and beak
if serifs: dish_serif(1,2,a,1/3,cap_jut,b,1/3,1.25cap_jut); % upper serif
nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi % lower serif
math_fit(0,u#); penlabels(1,2,3,4); endchar;
enddef;
width.M:=16u+width_adj;
def M_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter M";
beginchar(n,16u#+width_adj#,cap_height#,0);
italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric stem[]; % thicknesses of the four strokes
stem1=hround(fudged.hair+stem_corr);
stem2=hround(fudged.cap_stem-4stem_corr);
stem3=hround(fudged.hair-stem_corr);
stem4=hround(fudged.cap_stem-3stem_corr);
if stem4<stem1: stem4:=stem1; fi
pickup tiny.nib; pos1(stem1,0); pos2(stem1,0);
pos3(stem4,0); pos4(stem4,0);
x1=x2; x3=x4; x1l=w-x3r; rt x3r=hround min(w-2u,w-3u+.5stem4);
top y1=top y3=h; bot y2=bot y4=0;
filldraw stroke z1e--z2e; % left stem
filldraw stroke z3e--z4e; % right stem
penpos5(stem2,0); penpos6(stem2,0); penpos7(stem3,0); penpos8(stem3,0);
x5l=x1; x6l=x7l; x8=lft x3l; x6-x5=x8-x7; y5=y8=h; y6=y7;
if hefty: y6=if monospace: vround 1/3h else: o fi;
numeric upper_notch,lower_notch;
upper_notch=h-cap_notch_cut; lower_notch=y6+cap_notch_cut;
x1'=rt x1r; z1'=whatever[z5l,z6l]; x3'=lft x3l; z3'=whatever[z7r,z8r];
z0=whatever[z5r,z6r]=whatever[z7l,z8l];
fill z5l..
if y1'<upper_notch: {right}(x1'+1,upper_notch){down}... fi
{z6-z5}diag_in(5l,6l,1,6r)..diag_out(7l,1,7r,8r){z8-z7}
if y3'<upper_notch: ...{up}(x3'-1,upper_notch){right} fi
..z8r--diag_out(8r,1,8l,7l){z7-z8}
if y0<=lower_notch: ..{z7-z8}z0{z5-z6}..
else: ...{down}(x0+.5,lower_notch)--(x0-.5,lower_notch){up}... fi
{z5-z6}diag_in(6r,5r,1,5l)--cycle; % diagonals
else: y6=0; z0=whatever[z5r,z6r]=whatever[z7l,z8l];
fill z5l..{z6-z5}diag_in(5l,6l,1,6r)..diag_out(7l,1,7r,8r){z8-z7}
..z8r--diag_out(8r,1,8l,7l){z7-z8}..{z7-z8}z0{z5-z6}
..{z5-z6}diag_in(6r,5r,1,5l)--cycle; fi % diagonals
if serifs: serif(1,2,a,1/3,-cap_jut); % upper left serif
dish_serif(2,1,b,1/2,cap_jut,c,1/2,cap_jut)(dark); % lower left serif
serif(3,4,d,1/3,cap_jut); % upper right serif
dish_serif(4,3,e,1/3,cap_jut,f,1/3,cap_jut); fi % lower right serif
math_fit(0,max(.5ic#-.5u#,0));
penlabels(0,1,1',2,3,3',4,5,6,7,8); endchar;
enddef;
width.N:=13u+width_adj;
def N_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter N";
beginchar(n,13u#+width_adj#,cap_height#,0);
italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric thin_stem; thin_stem=hround(fudged.hair+stem_corr);
pickup tiny.nib; pos1(thin_stem,0); pos2(thin_stem,0);
pos3(thin_stem,0); pos4(thin_stem,0);
pickup tiny.nib; top y1=top y3=h; bot y2=bot y4=0;
x1=x2; x3=x4; x1l=w-x3r;
rt x3r=hround min(w-2u,w-3u+.5fudged.cap_stem);
filldraw stroke z1e--z2e; % left stem
filldraw stroke z3e--z4e; % right stem
if hefty: penpos5(fudged.cap_stem,0); penpos6(fudged.cap_stem,0);
x5l=x1; x6r=x4; y5=h; y6=0;
numeric upper_notch,lower_notch;
upper_notch=h-cap_notch_cut; lower_notch=cap_notch_cut;
x1'=rt x1r; z1'=whatever[z5l,z6l]; x4'=lft x4l; z4'=whatever[z5r,z6r];
fill z5l..
if y1'<upper_notch: {right}(x1'+1,upper_notch){down}... fi
{z6-z5}diag_in(5l,6l,1,6r)--z6r..
if y4'>lower_notch: {left}(x4'-1,lower_notch){up}... fi
{z5-z6}diag_in(6r,5r,1,5l)--cycle; % diagonal
else: penpos5(whatever,0); penpos6(whatever,90);
z5l=z1l; z6l=z4l;
z7=z6l+(max(eps,cap_stem-3stem_corr-tiny),0) rotated (angle(z5l-z6l)-90);
z5r=z7+whatever*(z5l-z6l); z6r=z7+whatever*(z5l-z6l);
filldraw stroke z5e..z6e; fi % diagonal
if serifs: if hefty: serif(1,2,a,1/3,-cap_jut); % upper left serif
else: serif(5,6,a,1/3,-cap_jut); fi % upper left serif
dish_serif(2,1,b,1/2,cap_jut,c,1/2,cap_jut)(dark); % lower left serif
dish_serif(3,4,e,1/2,cap_jut,f,1/2,cap_jut)(dark); fi % upper right serif
math_fit(0,max(.5ic#-.5u#,0)); penlabels(1,1',2,3,4,4',5,6,7); endchar;
enddef;
width.O:=14u-width_adj;
def O_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter O";
beginchar(n,14u#-width_adj#,cap_height#,0);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,0);
penpos1(vair',90); penpos3(vround(vair+1.5vair_corr),-90);
penpos2(cap_curve,180); penpos4(cap_curve,0);
if monospace: x2r=hround 1.5u;
interim superness:=sqrt superness; % make |"O"|, not |"0"|
else: x2r=hround u; fi
x4r=w-x2r; x1=x3=.5w; y1r=h+o; y3r=-o;
y2=y4=.5h-vair_corr; y2l:=y4l:=.52h;
penstroke pulled_super_arc.e(1,2)(.5superpull)
& pulled_super_arc.e(2,3)(.5superpull)
& pulled_super_arc.e(3,4)(.5superpull)
& pulled_super_arc.e(4,1)(.5superpull) & cycle; % bowl
math_fit(-.3cap_height#*slant-.5u#,ic#-.5u#); penlabels(1,2,3,4); endchar;
enddef;
width.P:=12u;
def P_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter P";
beginchar(n,12u#,cap_height#,0);
italcorr .75cap_height#*slant-.5u#;
adjust_fit(cap_serif_fit#,0);
pickup tiny.nib; penpos1(cap_stem'-tiny,0); penpos2(cap_stem-tiny,0);
pos0(cap_stem',0); pos0'(cap_stem,0);
lft x1l=hround max(2u,3u-.5cap_stem'); top y1=h; bot y2=0;
x1l=x2l=x0l=x0'l; y0=y0'=y7;
penpos3(cap_band,90); penpos4(cap_band,90);
penpos5(cap_curve if hefty:-3stem_corr fi,0);
penpos6(.5[vair,cap_band],-90); penpos7(.5[vair,cap_band],-90);
z3r=top z1; y4=y3; y5=.5[y4l,y6l]; y6=y7;
x7=x2; y7l=vround .5h; x4=x6=.5w+.75u; x5r=hround(w-u);
x4l:=x6l:=x4-.25cap_curve;
filldraw stroke z1e--z0e--z0'e--z2e; % stem
fill stroke z3e..pulled_arc.e(4,5) & pulled_arc.e(5,6)..z7e; % lobe
if serifs: nodish_serif(1,0,a,1/3,cap_jut,b,1/3,.5cap_jut); % upper serif
dish_serif(2,0',c,1/3,cap_jut,d,1/3,cap_jut); fi % lower serif
math_fit(0,ic#-2.5u#); penlabels(0,1,2,3,4,5,6,7); endchar;
enddef;
width.Q:=14u-width_adj;
def Q_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter Q";
beginchar(n,14u#-width_adj#,cap_height#,comma_depth#);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,0);
numeric light_curve; light_curve=cap_curve-hround stem_corr;
penpos1(vair',90); penpos3(vair',-90);
penpos2(light_curve,180); penpos4(light_curve,0);
if monospace: x2r=hround 1.5u;
interim superness:=sqrt superness; % make |"Q"| like |"O"|
else: x2r=hround u; fi
x4r=w-x2r; x1=x3=.5w; y1r=h+o; y2=y4=.5h-vair_corr; y3r=-o;
penstroke pulled_super_arc.e(1,2)(.5superpull)
& pulled_super_arc.e(2,3)(.5superpull)
& pulled_super_arc.e(3,4)(.5superpull)
& pulled_super_arc.e(4,1)(.5superpull) & cycle; % bowl
pickup tiny.nib;
if hefty: penpos5(1.2(.5[cap_bar,light_curve]),0); penpos6(1.2light_curve,0);
x5=.5w; x6r=hround(w-1.5u);
y5=vround .28h; y6=-d;
fill diag_end(6r,5r,.25,1,5l,6l)--diag_end(5l,6l,.5,1,6r,5r)--cycle; % tail
else: pos3'(vair,270); pos5(vair,180); pos6(vair,90);
pos7(cap_curve,85); penpos8(eps,180);
z3'=z3; x6=x3; top y6r=vround(.2h+.5vair);
lft x5r=hround(.5w-1.25u-.5vair); y5=.5[y3,y6];
bot y7l=-d; x7l=2/3[x6,x8]; y8=0; rt x8=hround(x4r+.1u);
filldraw stroke z3'e{left}...z5e{up}...z6e{right}
..z7e{right}...z8e{up}; fi % tail
math_fit(-.3cap_height#*slant-.5u#,ic#);
penlabels(1,2,3,4,5,6,7,8); endchar;
enddef;
width.R:=if serifs: 12u+.5max(2u,cap_curve) else: 12.5u-.5width_adj fi;
def R_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter R";
beginchar(n,if serifs: 12u#+.5max(2u#,cap_curve#)
else:12.5u#-.5width_adj# fi,cap_height#,0);
italcorr .75cap_height#*slant- if serifs: 1.75 else: .5 fi\\ u#;
adjust_fit(cap_serif_fit#,0);
pickup tiny.nib; pos1(cap_stem',0); pos2(cap_stem',0);
lft x1l=lft x2l=hround max(2u,3u-.5cap_stem'); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
penpos3(cap_band,90); penpos4(cap_band,90);
penpos5(cap_curve if hefty:-3stem_corr fi,0);
penpos6(vair,-90); penpos7(vair,-90);
z3r=top z1; y4=y3; y5=.5[y4l,y6l]; y6=y7;
x7=x2; y7l=vround(.5h+.5vair); x4=x6;
if serifs: x4=.5w-.5u; x5r=hround(w-2.25u);
else: x4=.5w+.5u; x5r=hround(w-u); fi
x4l:=x6l:=x4-.125cap_curve;
fill stroke z3e..pulled_arc.e(4,5) & pulled_arc.e(5,6)..z7e; % lobe
if serifs: pos6'(vair,-90); pos0(cap_stem,180);
pos8(cap_curve,180); pos9(vair,-90); pos10(hair,0);
z6'=z6; lft x0r=lft x8r=hround(x5-2/3u-.5cap_curve);
y8=1/3[y2,y7]; y0=3/5[y2,y7]; x9=.5[x8l,x10r];
bot y9r=-o; rt x10r=hround(w-.05u); y10=1/4[y2,y7];
filldraw stroke z6'e{right}..z0e---z8e....z9e{right}..z10e{up}; % tail
nodish_serif(1,2,a,1/3,cap_jut,b,1/3,.5cap_jut); % upper serif
dish_serif(2,1,c,1/3,cap_jut,d,1/3,cap_jut); % lower serif
else: penpos8(cap_stem-2stem_corr,0); penpos9(cap_stem,0);
x8=x6+.5u; y8=y6; x9r=hround(w-.5u); y9=0;
fill z8l--diag_end(8l,9l,.5,1,9r,8r)--z8r--cycle; fi % tail
math_fit(0,.75ic#); penlabels(0,1,2,3,4,5,6,7,8,9,10); endchar;
enddef;
width.S:=10u;
def S_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter S";
beginchar(n,10u#,cap_height#,0);
italcorr cap_height#*slant-u#;
adjust_fit(0,0);
numeric theta; theta=90-angle(50u,h); slope:=-h/50u; % angle at middle
numeric s_slab; s_slab=if serifs:slab else:vround .2[slab,cap_stem] fi;
numeric ess'; ess'=max(fine.breadth,cap_ess);
pickup fine.nib; pos2(max(fine.breadth,s_slab-vround vair_corr),-90);
pos0(ess',theta); pos7(s_slab,-90);
x2+x7=2x0=w; x7-x2=if serifs: u else: 0 fi; top y2l=h+o; bot y7r=-o;
y0=.52h; lft x3l=hround u; rt x6r=hround(w-u);
x3r-x3l=x6r-x6l=hround .5[s_slab,ess']-fine;
ellipse_set(2l,3l,4l,0l); ellipse_set(2r,3r,4r,0r); y3=y3r;
ellipse_set(7l,6l,5l,0l); ellipse_set(7r,6r,5r,0r); y6=y6r;
filldraw stroke super_arc.e(2,3) & z3e{down}
..z4e---z5e..z6e{down} & super_arc.e(6,7); % main stroke
if serifs: pos1(hair,180); pos8(hair,180);
rt x1l=hround(w-1.5u); lft x8r=hround u;
bot y1=vround 2/3h+1; top y8=vround 1/3h-1;
filldraw stroke z1e{x2-x1,10(y2-y1)}....{left}z2e; % upper arc
filldraw stroke z7e{left}....{up}z8e; % lower arc
path upper_arc, lower_arc;
upper_arc=z1{x2-x1,10(y2-y1)}....{left}z2;
lower_arc=z7{left}....{up}z8;
pos10(.3[fine.breadth,cap_hair],0); pos9(.3[fine.breadth,cap_hair],0);
x10r=x1l; top y10=top y2l; x9l=x8r; bot y9=bot y7r;
x1l-x1'=x8'-x8r=1.6cap_curve-fine; y1'=y1; y8'=y8;
numeric t; t=xpart(upper_arc intersectiontimes(z10l--z1'));
filldraw z1l--z10r--z10l--subpath(t,0) of upper_arc--cycle; % upper barb
t:=xpart(lower_arc intersectiontimes(z9r--z8'));
filldraw z8r--z9l--z9r--subpath(t,1) of lower_arc--cycle; % lower barb
else: pos1(1.2flare,-100); pos8(1.2flare,-100);
x1l=good.x(x1l+w-1.75u-rt x1); lft x8r=hround .8u;
top y1l=vround .93h+o; bot y8r=vround .1h-o;
filldraw stroke term.e(2,1,right,.9,4); % upper arc and terminal
filldraw stroke term.e(7,8,left,1,4); fi % lower arc and terminal
math_fit(0,.5ic#); penlabels(0,1,1',2,3,4,5,6,7,8,8',9,10); endchar;
enddef;
width.T:=13u-width_adj;
def T_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter T";
beginchar(n,13u#-width_adj#,cap_height#,0);
italcorr cap_height#*slant-beak_jut#-.25u#;
adjust_fit(0,0);
h:=vround(h-2stem_corr);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
lft x1l=lft x2l=hround(.5w-.5cap_stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
pickup crisp.nib; pos3(slab,90); pos4(hair,0);
top y3r=h; x3=x1; rt x4r=hround(w-.65u); y4=good.y(y3l-beak)-eps;
arm(3,4,e,beak_darkness,.7beak_jut); % right arm and beak
pos5(hair,180); x5=w-x4; y5=y4;
arm(3,5,f,beak_darkness,-.7beak_jut); % left arm and beak
if serifs: dish_serif(2,1,c,1/3,1.414cap_jut,d,1/3,1.414cap_jut); % lower serif
nodish_serif(1,2,a,1/3,.5cap_jut,b,1/3,.5cap_jut); fi % upper bracketing
math_fit(-.75cap_height#*slant,ic#-2.5u#); penlabels(1,2,3,4,5,6); endchar;
enddef;
width.U:=13u+0.5width_adj;
def U_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter U";
beginchar(n,13u#+.5width_adj#,cap_height#,0);
italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
if monospace: adjust_fit(cap_serif_fit#-.5u#,cap_serif_fit#-.5u#)
else: adjust_fit(cap_serif_fit#,cap_serif_fit#) fi;
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
pos2'(cap_stem,180); z2'=z2;
pos3(cap_band,-90);
pos4(cap_hair,0); pos5(cap_hair,0);
x1=x2; x3=.5[x1,x5]; x4=x5; x1l=w-x5r;
top y1=top y5=h; y2=y4=1/3h; bot y3r=-o;
lft x1l=hround max(2u,3u-.5cap_stem);
filldraw stroke z1e--z2e; % left stem
filldraw stroke pulled_arc.e(2',3)
& pulled_arc.e(3,4)&z4e--z5e; % arc and right stem
if serifs: dish_serif(1,2,a,1/3,cap_jut,b,1/3,cap_jut); % left serif
dish_serif(5,4,c,1/2,cap_jut,d,1/2,cap_jut)(dark); fi % right serif
math_fit(-cap_serif_fit#-.3cap_height#*slant-min(cap_height#*slant,u#),
max(.5ic#-.5u#,0)); penlabels(1,2,3,4,5); endchar;
enddef;
width.V:=13u;
def V_(expr n, rotation_angle, moved_a, moved_b)=
currenttransform:=identity yscaled taller_letters rotated rotation_angle shifted(moved_a,moved_b);
cmchar "The letter V";
beginchar(n,13u#,cap_height#,0);
italcorr cap_height#*slant+.25u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric left_stem,right_stem,outer_jut,alpha;
left_stem=cap_stem-stem_corr;
right_stem=min(cap_hair if hefty:-2stem_corr fi,left_stem);
outer_jut=.75cap_jut; x1l=w-x4r=l+letter_fit+outer_jut+.25u; y1=y4=h;
x2-x1=x4-x3; x2l+apex_corr=x3l; y2=y3=-apex_o;
alpha=diag_ratio(2,right_stem,y1-y2,x4r-x1l-apex_corr);
penpos1(alpha*left_stem,0); penpos2(alpha*left_stem,0);
penpos3(alpha*right_stem,0); penpos4(alpha*right_stem,0);