summaryrefslogtreecommitdiff
path: root/fonts/wnri/grampunc.mf
blob: 0453a0bdcd402b0c4cdbbcd0b12d0b41bdcdfbc6 (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
%
% Washington Romanized Indic accent driver
%
% Macros to draw punctuation characters. Partly based on comlig.mf 
% of Computer Modern miscellaneous punctuation and free accents
%

cmchar "close quote";
newchar(closequote,7u#+max(2u#,dot_size#),asc_height#,0);
italcorr asc_height#*slant+dot_size#-4.1u#;
adjust_fit(0,0);
x1-.5dot_size=hround .6u; y2+.5dot_size=h;
x2-x1=hround(1.5u+max(2u,dot_size)); y2=y1;
comma(1,a,dot_size,.25u,comma_depth); % left dot and tail
comma(2,b,dot_size,.25u,comma_depth); % right dot and tail
penlabels(1,2); endchar;

cmchar "Hyphen";
newchar(hyphen,6u#,x_height#,0);
italcorr .5x_height#*slant-.5u#;
adjust_fit(0,0);
numeric thickness; thickness=if hefty:bar else:.75[hair,stem] fi;
pickup crisp.nib; pos1(thickness,90); pos2(thickness,90);
top y1r=top y2r=vround(.5h+.5thickness); rt x2=hround(w-u)+eps;
if monospace: x2=w-x1 else: lft x1=hround .2u-eps fi;
filldraw stroke z1e--z2e;  % bar
penlabels(1,2); endchar;

cmchar "Opening quotes";
newchar(openquote,7u#+max(2u#,dot_size#),asc_height#,0);
italcorr asc_height#*slant-.1u#;
adjust_fit(0,0);
x2+.5dot_size=hround(w-.6u); y1+.5dot_size=h-comma_depth;
x2-x1=hround(1.5u+max(2u,dot_size)); y2=y1;
ammoc(1,a,dot_size,.25u,comma_depth); % left dot and tail
ammoc(2,b,dot_size,.25u,comma_depth); % right dot and tail
penlabels(1,2); endchar;

cmchar "En dash";
newchar(endash,9u#,x_height#,0);
italcorr .61803x_height#*slant+.5u#;
adjust_fit(0,0);
pickup crisp.nib; pos1(vair,90); pos2(vair,90);
top y1r=top y2r=vround(.61803h+.5vair); lft x1=-eps; rt x2=w+eps;
filldraw stroke z1e--z2e;  % bar
penlabels(1,2); endchar;

cmchar "Em dash";
newchar(emdash,18u#,x_height#,0);
italcorr .61803x_height#*slant+.5u#;
adjust_fit(letter_fit#,letter_fit#);
pickup crisp.nib; pos1(vair,90); pos2(vair,90);
top y1r=top y2r=vround(.61803h+.5vair); lft x1=-eps; rt x2=w+eps;
filldraw stroke z1e--z2e;  % bar
penlabels(1,2); endchar;

cmchar "Less than sign";
compute_spread(5/4x_height#,3/2x_height#);
newchar(lesser,14u#,v_center(spread#+rule_thickness#));
italcorr h#*slant-u#;
adjust_fit(0,0); pickup rule.nib;
lft x2=hround 1.5u-eps; x1=x3=w-x2;
y1-y3=spread; y2=.5[y1,y3]=math_axis;
draw z1--z2--z3;  % diagonals
labels(1,2,3); endchar;

cmchar "Greater than sign";
compute_spread(5/4x_height#,3/2x_height#);
newchar(greater,14u#,v_center(spread#+rule_thickness#));
italcorr math_axis#*slant-u#;
adjust_fit(0,0); pickup rule.nib;
rt x2=hround(w-1.5u)+eps; x1=x3=w-x2;
y1-y3=spread; y2=.5[y1,y3]=math_axis;
draw z1--z2--z3;  % diagonals
labels(1,2,3); endchar;

iff known vertical: cmchar "Vertical line";
newchar(vertical,5u#,body_height#,paren_depth#);
italcorr body_height#*slant+.5rule_thickness#-2u#;
adjust_fit(0,0); pickup rule.nib;
x1=x2=good.x .5w; top y1=h+eps; bot y2=-d-eps;
draw z1--z2;  % stem
labels(1,2); endchar;

iff known left_brace: cmchar "Left curly brace";
newchar(left_brace,9u#,body_height#,paren_depth#);
italcorr body_height#*slant+.5vair#-u#;
adjust_fit(0,0); pickup fine.nib;
forsuffixes $=1,1',4,4',7,7': pos$(vair,0); endfor
forsuffixes $=2,3,5,6: pos$(stem,0); endfor
x2=x3=x5=x6; x1=x1'=x7=x7'=w-x4=w-x4';
lft x4l=hround(1.5u-.5vair); lft x2l=hround(.5w-.5stem);
top y1=h; bot y7=-d; .5[y4,y4']=.5[y1,y7]=.5[y2,y6]=.5[y3,y5];
y1-y2=y3-y4=(y1-y4)/4; y1-y1'=y4-y4'=y7'-y7=vair-fine;
filldraw z1l{left}...z2l---z3l...{left}z4l
 --z4'l{right}...z5l---z6l...{right}z7l
 --z7r--z7'r{left}...z6r---z5r...{left}.5[z4r,z4'r]{right}
 ...z3r---z2r...{right}z1'r--z1r--cycle;  % stroke
penlabels(1,2,3,4,5,6,7); endchar;

iff known right_brace: cmchar "Right curly brace";
newchar(right_brace,9u#,body_height#,paren_depth#);
italcorr math_axis#*slant+.5vair#-u#;
adjust_fit(0,0); pickup fine.nib;
forsuffixes $=1,1',4,4',7,7': pos$(vair,0); endfor
forsuffixes $=2,3,5,6: pos$(stem,0); endfor
x2=x3=x5=x6; x1=x1'=x7=x7'=w-x4=w-x4';
rt x4r=hround(w-1.5u+.5vair); rt x2r=hround(.5w+.5stem);
top y1=h; bot y7=-d; .5[y4,y4']=.5[y1,y7]=.5[y2,y6]=.5[y3,y5];
y1-y2=y3-y4=(y1-y4)/4; y1-y1'=y4-y4'=y7'-y7=vair-fine;
filldraw z1r{right}...z2r---z3r...{right}z4r
 --z4'r{left}...z5r---z6r...{left}z7r
 --z7l--z7'l{right}...z6l---z5l...{right}.5[z4l,z4'l]{left}
 ...z3l---z2l...{left}z1'l--z1l--cycle;  % stroke
penlabels(1,2,3,4,5,6,7); endchar;

cmchar "Straight double quotes";
newchar(typequote,9u#,asc_height#,0);
numeric top_width#,spread#; 
top_width#=if serifs: flare# else: stem# fi;
spread#=max(3u#,top_width#+.5u#); define_pixels(spread);
italcorr asc_height#*slant+.5top_width#+.5spread#-4u#;
adjust_fit(0,0);
x1=x2; x3=x4=w-x1; x3-x1=spread+2; y1=y3;
y2=y4=max(.5[bar_height,x_height]+.5vair,h-x_height);
if serifs: pickup crisp.nib; pos1(flare,0); pos2(vair,0);
 pos3(flare,0); pos4(vair,0);
 y1+.5stem=h; filldraw circ_stroke z1e--z2e;  % left stem and bulb
 filldraw circ_stroke z3e--z4e;  % right stem and bulb
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 pos3(stem,0); pos4(vair,0);
 top y1=h; filldraw stroke z1e--z2e;  % left stem
 filldraw stroke z3e--z4e; fi  % right stem
penlabels(1,2,3,4); endchar;

cmchar "Therefore symbol == Old English period";
numeric dot_diam#,dot_diam;
dot_diam#=max(dot_size#,cap_curve#);
newchar(oeper,x_height#+2u#+dot_diam#,.86x_height#+dot_diam#,0);
dot_diam=max(tiny.breadth,hround(max(dot_size,cap_curve)-2stem_corr));
italcorr h#*slant+.5dot_diam#-2.25u#;
adjust_fit(0,0);
pickup tiny.nib; pos1(dot_diam,0); pos2(dot_diam,90);
x1=x2=u+.5dot_diam; bot y2l=-o;
y1=.5[y2l,y2r]; dot(1,2);  % left dot
pos3(dot_diam,0); penpos4(y2r-y2l,90); y3=y4=y1; x3=x4=w-x1;
dot(3,4);  % right dot
pos5(dot_diam,0); pos6(dot_diam,90);
x5=x6=.5w; bot y6l=.86x_height-o;
y5=.5[y6l,y6r]; dot(5,6);
penlabels(1,2,3,4,5,6); endchar;

cmchar "subscript Scandinavian circle accent";
newchar(Ring,5u#+hair#,0,desc_depth#);
adjust_fit(0,0);
numeric circ_hair,circ_vair; h:=asc_height;
circ_hair=hround min(hair,u+.5); circ_vair=vround min(vair,(asc_height-x_height)/6+.5);
penpos1(circ_vair,90); penpos3(circ_vair,-90);
penpos2(circ_hair,180); penpos4(circ_hair,0);
x2r=hround(.5w-1.5u-.5circ_hair);
x4r=w-x2r; x1=x3=.5w; y1r=h+apex_o; y2=y4=.5[y1,y3];
y3r=vround(1/3[x_height,h]+apex_o);
penstroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & pulled_arc.e(3,4) & pulled_arc.e(4,1) & cycle;  % bowl
currentpicture:=currentpicture shifted (0,-(asc_height+dot_size)*aspect_ratio);
endchar;

cmchar "Grave accent";
newchar(Grave,9u#,min(asc_height#,2x_height#),0);
adjust_fit(0,0);
if serifs: pickup crisp.nib; x1-.5stem=hround 2u; x2=2/3[x1,w-x1];
 y1+.5stem=h+eps; y2=max(2/3[h,x_height],x_height+o+hair);
 numeric theta; theta=angle(z2-z1)+90;
 pos1(stem,theta); pos2(hair,theta);
 filldraw circ_stroke z1e--z2e;  % diagonal
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 lft x1l=hround 1.5u; rt x2r=hround(.5w+.25u+.5vair);
 top y1=h; bot y2=vround 2/3[h,x_height];
 filldraw stroke z1e--z2e; fi  % diagonal
penlabels(1,2); endchar;

cmchar "Acute accent";
newchar(Acute,9u#,min(asc_height#,2x_height#),0);
italcorr h#*slant-if serifs: 1.5 fi u#;
adjust_fit(0,0);
if serifs: pickup crisp.nib; x1+.5stem=hround(w-2u); x2=2/3[x1,w-x1];
 y1+.5stem=h+eps; y2=max(2/3[h,x_height],x_height+o+hair);
 numeric theta; theta=angle(z2-z1)+90;
 pos1(stem,theta); pos2(hair,theta);
 filldraw circ_stroke z1e--z2e;  % diagonal
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 rt x1r=hround(w-1.5u); lft x2l=hround(.5w-.25u-.5vair);
 top y1=h; bot y2=vround 2/3[h,x_height];
 filldraw stroke z1e--z2e; fi  % diagonal
penlabels(1,2); endchar;

cmchar "Hachek (check) accent";
newchar(Hachek,9u#,.75[x_height#,min(asc_height#,2x_height#)],0);
h':=vround min(asc_height,2x_height); % height of circumflex being inverted
if serifs: italcorr h#*slant+.5hair#-1.75u#;
 adjust_fit(0,0);
 pickup crisp.nib; pos2'(.5[vair,curve],90); top y2'r=h;
 pos2(.5[vair,curve],90); x2=.5w;
 x1=w-x3=good.x 2.25u; top y1=top y3=h; y1-y2=.5(y2'-x_height);
 pos1(hair,angle(z2-z1)+90); pos3(hair,angle(z3-z2)+90);
 filldraw stroke z1e--z2e--z3e;  % diagonals
else: italcorr h#*slant-.5stem#+.5vair#-.75u#;
 adjust_fit(0,0);
 pickup fine.nib; pos1(vair,0); pos3(vair,0); x1=w-x3;
 pos2(stem,0); bot y2=vround(1/12[x_height,h']+o); x2=.5w;
 top y1=top y3=h+o; lft x1l=hround(rt x2r-3.25u-.5vair);
 z0=whatever[z1r,z2r]=whatever[z2l,z3l];
 y4l=y4r=y2; x4l=good.x .2[x2l,x2]; x4r=w-x4l;
 filldraw z4l--z1l--z1r--z0--z3l--z3r--z4r--cycle; fi  % diagonals
penlabels(0,1,2,3,4); endchar;

cmchar "Breve accent";
newchar(Breve,9u#,min(asc_height#,2x_height#),0);
italcorr h#*slant+.5vair#-1.5u#;
adjust_fit(0,0);
pickup crisp.nib; pos1(vair,-180); pos3(vair,0);
top y1=top y3=h; lft x1r=w-rt x3r=hround(2u-.5vair);
numeric mid_thickness; mid_thickness=vround 1/3[vair,stem];
pos2(mid_thickness,-90); x2=.5w;
bot y2r=vround max(x_height+o+tiny,1/3[x_height,h]+o-.5mid_thickness);
filldraw stroke z1e{down}...z2e{right}...{up}z3e;  % stroke
penlabels(1,2,3); endchar;

cmchar "Inverted Breve accent";
newchar(Ibreve,9u#,min(asc_height#,2x_height#),0);
italcorr h#*slant+.5vair#-1.5u#;
adjust_fit(0,0);
pickup crisp.nib; pos1(vair,-180); pos3(vair,0);
top y2r=h; lft x1r=w-rt x3r=hround(2u-.5vair);
numeric mid_thickness; mid_thickness=vround 1/3[vair,stem];
pos2(mid_thickness,90); x2=.5w;
bot y1=bot y3=vround max(x_height+o+tiny,1/3[x_height,h]+o-.5mid_thickness);
filldraw stroke z1e{up}...z2e{right}...{down}z3e;  % stroke
penlabels(1,2,3); endchar;

cmchar "Subscript Inverted Breve accent";
newchar(Uibreve,9u#,0,.5desc_depth#);
italcorr h#*slant+.5vair#-1.5u#;
adjust_fit(0,0); h:=min(asc_height,2x_height);
pickup crisp.nib;
numeric mid_thickness; mid_thickness=vround 1/3[vair,stem];
y2=-dot_size; y1=y3=vround max(x_height+o+tiny, 1/3[x_height,asc_height]+o-.5mid_thickness)-asc_height-dot_size;
x2=x1+2.5u=x3-2.5u=.5w;
pos2(mid_thickness,90); pos1(vair,-180); pos3(vair,0);
filldraw stroke z1e{up}...z2e{right}...{down}z3e;
chardp:= (bot y1) / hppp;  %adjust depth 
penlabels(1,2,3); endchar;

% end of file grampunc.mf