Debian Codegraph @

texmf-dist/fonts/source/public/euro-ce/euromac.mf

raw
1 % EUROMAC.MF --- version 3.0 (6 March 2002) --- (c) Harold W. de Wijn
2 % DRIVER FILE TO GENERATE EURO SYMBOLS
3 % FILE SHOULD BE RENAMED WHENEVER IT IS MODIFIED!
4
5
6 message "EUROMAC.MF v3.0 (6 March 2002) - (c) Harold W. de Wijn";
7
8 mode_setup;
9
10
11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 %% Macros
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14
15 def draw_euro =
16
17 italcorr 0.85BoxHeight#*S; % height of upper right corner times S
18
19 % ---------- Geometrical parameters ----------
20 OuterDiameter#:=BoxHeight# + 2o#; % o_correction omitted
21 define_pixels(OuterDiameter);
22 w#:=(LeftMargin# + 0.99282*WidthFactor(C,T)*C*OuterDiameter#
23 + RightMargin#); % cf. notes to WidthFactor below
24 charwd:=w#;
25 define_whole_pixels(w);
26
27 BarSeparation:=1/12OuterDiameter;
28 Thickness:=1/12OuterDiameter*T;
29 BarProtrusion:=(5/6cosd40 - 1/2)*OuterDiameter;
30
31 % The leftward protrusion of the bars is defined on the basis of the
32 % official symbol, for which, measured in the horizontal direction, the
33 % left end of the bars is twice as far from the circle center as the lower
34 % right end of the beak.
35
36 % ---------- Transformation ----------
37 currenttransform:=identity if C<>1: xscaled C fi if S<>0: slanted S fi
38 transformed add_transform;
39 % The transform add_transform may provide additional transformations,
40 % such as reflections and rotations.
41
42 % ---------- Pen ----------
43 pickup pencircle scaled Thickness;
44
45 % ---------- Circle ----------
46 Left:=LeftMargin/C + BarProtrusion; % abscissa of circle's leftmost edge
47 z1=(Left + 1/2Thickness/C, 1/2h);
48 z0=z1 + (good.y(1/2OuterDiameter - 1/2Thickness + 1/2h) - 1/2h, 0);
49 forsuffixes $=2,3,4,5,6,7,8: z$=z1 rotatedaround(z0,45*($-1)); endfor;
50
51 % To lessen the risk of pimples at the horizontal tangents, the circle's
52 % center point z0 is positioned at such a distance from z1 that z3 and z7
53 % have "good" y values.
54
55 draw z1{down}..z2{down+right}..z3{right}..z4{right+up}..z5{up}..
56 z6{up+left}..z7{left}..z8{left+down}..cycle;
57
58 % ---------- Defining beak ----------
59 % The beak of the official euro symbol is defined by the point where the
60 % radius at 40 degrees from horizontal meets the circle. We rather use
61 % the equivalent definition that the median of the circle, i.e., the path
62 % traversed by the pen, ends at 42.6717 degrees (z31).
63
64 z31=z1 rotatedaround(z0,-180+42.6717);
65 z32=(x3,y3-1/2Thickness);
66 z33=whatever[z32,z31];
67 x33=x31 - OuterDiameter*(0.01780 % so far the official geometry
68 + 0.01780*(T-1) + 0.005*(C-1) - 0.004*S + 0.003*(C-1)*(C-1)
69 + 0.002*(C-1)*(T-1))/C; % cf. notes to WidthFactor below
70
71 % ---------- Cross bars ----------
72 z40=(round(Left-BarProtrusion),y41+pen_bot);
73 z50=(x40,y51+pen_bot);
74 extra_pixel_x:=1;
75 z41=(x40 + (min(pen_bot*S,pen_top*S) - extra_pixel_x)/C,
76 good.y(y0 + 1/2BarSeparation + 1/2Thickness));
77 z42=(x33 + (max(pen_bot*S,pen_top*S) + extra_pixel_x)/C,y41);
78 z51=(x41, good.y(y0 - 1/2BarSeparation - 1/2Thickness));
79 z52-z42=whatever*(z31-z32); y52=y51;
80
81 % The median heights y41 and y51 of the cross bars have "good" values
82 % and the abscissae x40 and x50 of the left ends are rounded to integers
83 % for the sake of uniformity at low resolution.
84
85 draw z41--z42;
86 draw z51--z52;
87
88 % ---------- Erasing excess ----------
89 % One extra pixel is added to be on the safe side. Note that sloped
90 % tangents to the pen circle are horizontally displaced from the pen's
91 % center by sqrt(1+S**2) times the radius. Instead of the square root,
92 % we rely on the more efficient function 1+abs(S), which is equal or
93 % larger. We however first normalize the current picture, because
94 % regions where bars and circle overlap and possibly some pixels near
95 % z1 to z8 have double weight.
96
97 cull currentpicture keeping (1,infinity) withweight 1;
98
99 extra_pixel_x:=1; extra_pixel_y:=1;
100 z61=(x5 + (pen_rt + max(pen_top*S,pen_bot*S) + extra_pixel_x)/C,y7);
101 z62=whatever[z32,z31]; y62=y7;
102 z63=whatever[z32,z31]; y63=y51+pen_bot-extra_pixel_y;
103 z64=(x33,y63);
104 z65=(x64,y32);
105 z66=(x61,y32);
106 unfill z61--z62--z63--z64--z65--z66--cycle;
107
108 z71-z40=whatever*(z32-z31); y71=y41+pen_top+extra_pixel_y;
109 z72=(x41 + (pen_lft + min(pen_bot*S,pen_top*S) - extra_pixel_x)/C,y71);
110 z73=(x72,y74);
111 z74-z40=whatever*(z32-z31); y74=y41+pen_bot-extra_pixel_y;
112 unfill z71--z72--z73--z74--cycle;
113
114 z75-z50=whatever*(z32-z31); y75=y51+pen_top+extra_pixel_y;
115 z76=(x72,y75);
116 z77=(x72,y78);
117 z78-z50=whatever*(z32-z31); y78=y51+pen_bot-extra_pixel_y;
118 unfill z75--z76--z77--z78--cycle;
119
120 % ---------- Pen labels ----------
121 penlabels(0,1,2,3,4,5,6,7,8,31,32,33,40,41,42,50,51,52,
122 61,62,63,64,65,66,71,72,73,74,75,76,77,78);
123
124 enddef;
125
126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
127
128 def WidthFactor(expr C,T) =
129 % The overall width of the official euro symbol, i.e., the horizontal
130 % distance between the left end of the bars and the upper outer corner of
131 % the beak, amounts to
132 % (5/6cosd40 + 1/2sind(2angle(5cosd40,6+5sind40))) = 0.99282
133 % times the outer diameter. Transformations while keeping the pen nib
134 % invariant as well as changing the thickness displace these end points
135 % from their "official" positions. The associated corrections to the
136 % width are to sufficient accuracy approximated by the factor
137 (1 - (0.017*(T-1) + 0.051*(C-1) + 0.004*S + 0.068*(C-1)*(T-1))/C)
138 enddef;
139
140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
141
142 def makebox(text r) =
143 for y=0,1/2h,h: r((y*S,y),(w+y*S,y)); endfor;
144 for x=0,LeftMargin,w-RightMargin,w:
145 if S=0: r((x,0),(x,h));
146 else: for y=0,1/2h,h: r((x+y*S,y-0.01h),(x+y*S,y+0.01h)); endfor; fi;
147 endfor;
148 if S>0: r((w+charic*pt,3/4h),(w+charic*pt,h+o)); fi;
149 enddef;
150
151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152
153 def outline = % cf. The METAFONTbook, p.244
154 cull currentpicture keeping (1,infinity) withweight 1;
155 picture v; v:=currentpicture;
156 cull currentpicture keeping (1,1) withweight 3;
157 addto currentpicture also v
158 -v shifted right -v shifted left -v shifted up -v shifted down;
159 cull currentpicture keeping (1,4);
160 enddef;
161
162
163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
164 %% Generating symbols
165 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
166
167 % ---------- Defaults, pixels ----------
168 LeftMargin#:=20/36pt#; RightMargin#:=20/36pt#; % universal values
169 define_pixels(LeftMargin,RightMargin,o);
170
171 if unknown C: C:=1; fi; % no condensing is default
172 if unknown S: S:=0; fi; % no slanting is default
173 if unknown T: T:=1; fi; % official thickness is default
174
175 transform add_transform; def add_transform = identity enddef;
176
177 % ---------- Return to calling file? ----------
178 % Now generate the font unless you wish to return to the calling file.
179 if unknown Return: relax elseif Return=1: endinput; fi;
180
181 % ---------- Font dimensions ----------
182 font_slant S;
183 font_x_height x_height#;
184 font_normal_space 6u#+2letter_fit#;
185 font_normal_stretch 3u#;
186 font_normal_shrink 2u#;
187 font_quad 18u#+4letter_fit#;
188 font_extra_space 2u#;
189
190 % ---------- Euro as high as capital C ----------
191 BoxHeight#:=cap_height#; % width of box is computed by draw_euro
192
193 C:=1;
194 "Official euro symbol (cap height)";
195 beginchar("E",0,BoxHeight#,0); draw_euro; endchar;
196 "Official euro symbol (cap height outline)";
197 beginchar("O",0,BoxHeight#,0); draw_euro; outline; endchar;
198
199 C:=0.887; % golden section**(1/4)
200 "Demicondensed (cap height)";
201 beginchar("D",0,BoxHeight#,0); draw_euro; endchar;
202 "Demicondensed (cap height outline)";
203 beginchar("N",0,BoxHeight#,0); draw_euro; outline; endchar;
204
205 C:=0.786; % square root of golden section
206 "Condensed (cap height)";
207 beginchar("F",0,BoxHeight#,0); draw_euro; endchar;
208 "Condensed (cap height outline)";
209 beginchar("P",0,BoxHeight#,0); draw_euro; outline; endchar;
210
211 C:=0.618; % golden section
212 "Double condensed (cap height)";
213 beginchar("G",0,BoxHeight#,0); draw_euro; endchar;
214 "Double condensed (cap height outline)";
215 beginchar("Q",0,BoxHeight#,0); draw_euro; outline; endchar;
216
217 % ---------- Euro as high as numerals ----------
218 BoxHeight#:=fig_height#;
219
220 C:=1;
221 "Official euro symbol (fig height)";
222 beginchar("e",0,BoxHeight#,0); draw_euro; endchar;
223 "Official euro symbol (fig height outline)";
224 beginchar("o",0,BoxHeight#,0); draw_euro; outline; endchar;
225
226 C:=0.887; % golden section**(1/4)
227 "Demicondensed (fig height)";
228 beginchar("d",0,BoxHeight#,0); draw_euro; endchar;
229 "Demicondensed (fig height outline)";
230 beginchar("n",0,BoxHeight#,0); draw_euro; outline; endchar;
231
232 C:=0.786; % square root of golden section
233 "Condensed (fig height)";
234 beginchar("f",0,BoxHeight#,0); draw_euro; endchar;
235 "Condensed (fig height outline)";
236 beginchar("p",0,BoxHeight#,0); draw_euro; outline; endchar;
237
238 C:=0.618; % golden section
239 "Double condensed (fig height)";
240 beginchar("g",0,BoxHeight#,0); draw_euro; endchar;
241 "Double condensed (fig height outline)";
242 beginchar("q",0,BoxHeight#,0); draw_euro; outline; endchar;
243
244 bye
245