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
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% mfmacros.mf - macros used in drawing the MFLOGO font.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
let elif = elseif;
ygap#:=(ht#/13.5u#)*xgap#; % vertical adjustment
ho#:=o#; % horizontal overshoot
leftstemloc#:=2.5u#+s#; % position of left stem
barheight#:=.45ht#; % height of bar lines
xheight# := 0.45[barheight#,ht#]; % Height of come characters
py#:=.9px#; % vertical pen thickness
dot_pen_width# := 3/2 px#; % A fatter pen used when drawing dots etc.
dot_pen_height# := 3/2 py#;
define_pixels(s,u);
define_whole_pixels(xgap);
define_whole_vertical_pixels(ygap);
define_blacker_pixels(px,py,dot_pen_height,dot_pen_width);
pickup pencircle xscaled px yscaled py;
logo_pen := savepen;
pickup pencircle xscaled dot_pen_width yscaled dot_pen_height;
dot_pen := savepen;
define_good_x_pixels(leftstemloc);
define_good_y_pixels(barheight,xheight);
define_corrected_pixels(o);
define_horizontal_corrected_pixels(ho);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def beginlogochar(expr code, unit_width) =
beginchar(code,unit_width*u#+2s#,ht#,0pt#);
pickup logo_pen enddef;
numeric digit_width#; digit_width# = 10u#;
def beginlogodigit(expr code) =
beginchar(code, digit_width# + 2s#, ht#, 0pt#); % matched by |endchar|
"Numeral " & code;
pickup logo_pen
enddef;
def nextcode =
begingroup
if unknown next_charcode:
next_charcode := 0;
elif next_charcode <= 32:
next_charcode := next_charcode + 1
else: message("Too many fancy symbols!");
next_charcode := 128
fi;
next_charcode
endgroup
enddef;
% Given 4 points z$1,...,z$4 define intermediate points z$1',...,z$4'
% on a superelipse (z$1...z$4 clockwise from top; z$1' from topright)
% and z$[]dir and 'dir are the corresponding directions
%
def super_points(suffix $) =
z$5 = z$1; % hackette
for i = 1,3:
z$[i]' = ( 4/5[ x$[i],x$[i+1] ], 4/5[ y$[i+1],y$[i] ] );
z$[i]dir = (x$[i+1] - x$[i],0);
z$[i]'dir = z$[i+1] - z$[i];
endfor
for i = 2,4:
z$[i]' = ( 4/5[ x$[i+1],x$[i] ], 4/5[ y$[i],y$[i+1] ] );
z$[i]dir = (0, y$[i+1] - y$[i]);
z$[i]'dir = z$[i+1] - z$[i];
endfor
enddef;
def super_arc(suffix $)(suffix list_hd)(text list_tl) =
z$list_hd{z$list_hd.dir}
forsuffixes @ = list_tl:
... {z$.@dir}z$.@
endfor
enddef;
def super_half(suffix i,j,k) =
draw z.i{0,y.j-y.i}
... (.8[x.j,x.i],.8[y.i,y.j]){z.j-z.i}
... z.j{x.k-x.i,0}
... (.8[x.j,x.k],.8[y.k,y.j]){z.k-z.j}
... z.k{0,y.k-y.j} enddef;
def half_super(suffix i,j,k) =
draw z.i{x.j-x.i,0}
... (.8[x.i,x.j],.8[y.j,y.i]){z.j-z.i}
... z.j{0,y.k-y.i}
... (.8[x.k,x.j],.8[y.j,y.k]){z.k-z.j}
... z.k{x.k-x.j,0}
enddef;
def qtr_super(suffix i,j) =
draw z.i{x.j-x.i,0} ... (.8[x.i,x.j],.8[y.j,y.i]){z.j-z.i}
enddef;
def sixpoints =
x1 = x2 = x3 = leftstemloc; % Points on left stem
x4 = x5 = x6 = w - x1; % on right stem
top y1 = top y4 = h + o; % Points at top of letter
y2 = y5 = barheight; % points on the bar
bot y3 = bot y6 = -o; % points at bottom of letter
enddef;
|