| 1 |
% CEMAC.MF --- version 3.0 (6 March 2002) --- (c) Harold W. de Wijn |
| 2 |
% DRIVER FILE TO GENERATE CE MARK |
| 3 |
% FILE SHOULD BE RENAMED WHENEVER IT IS MODIFIED! |
| 4 |
|
| 5 |
message "CEMAC.MF v3.0 (6 March 2002) - (c) Harold W. de Wijn"; |
| 6 |
|
| 7 |
mode_setup; |
| 8 |
|
| 9 |
|
| 10 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 11 |
%% Macros |
| 12 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 13 |
|
| 14 |
def draw_CE = |
| 15 |
italcorr 9/10OuterDiameter#*S; |
| 16 |
|
| 17 |
currenttransform:=identity if S<>0: slanted S fi; |
| 18 |
|
| 19 |
pickup pencircle scaled Thickness; |
| 20 |
|
| 21 |
% ---------- Circle segment ---------- |
| 22 |
Margin:=3/20OuterDiameter; |
| 23 |
z6=(good.x(Margin+1/2Thickness),1/2h); |
| 24 |
z0=z6 + (good.y(1/2OuterDiameter -1/2Thickness +1/2h) -1/2h, 0); |
| 25 |
forsuffixes $=1,2,4,8,10,11: z$=z6 rotatedaround(z0,($-6)*22.5); endfor; |
| 26 |
|
| 27 |
draw z1{z8-z10}..z2{left}..z4{z6-z2}..z6{down}..z8{z10-z6}.. |
| 28 |
z10{right}..{z2-z4}z11; |
| 29 |
|
| 30 |
extra_pixel:=1; |
| 31 |
z31=(x0+1/20OuterDiameter,y2+pen_top+extra_pixel); |
| 32 |
z32=(x31,y10+pen_bot-extra_pixel); |
| 33 |
z33=(x1+pen_rt+max(pen_top*S,pen_bot*S)+extra_pixel,y32); |
| 34 |
z34=(x33,y31); |
| 35 |
cull currentpicture keeping (1,infinity) withweight 1; |
| 36 |
unfill z31--z32--z33--z34--cycle; % erase excess |
| 37 |
|
| 38 |
penlabels(0,1,2,4,6,8,10,11,31,32,33,34); |
| 39 |
|
| 40 |
% ---------- Bar ---------- |
| 41 |
if Bar=1: |
| 42 |
draw z6--z0; |
| 43 |
|
| 44 |
z41=(x0-1/20OuterDiameter,y0+pen_top+extra_pixel); |
| 45 |
z42=(x41,y0+pen_bot-extra_pixel); |
| 46 |
z43=(x0+pen_rt+max(pen_top*S,pen_bot*S)+extra_pixel,y42); |
| 47 |
z44=(x43,y41); |
| 48 |
cull currentpicture keeping (1,infinity) withweight 1; |
| 49 |
unfill z41--z42--z43--z44--cycle; % erase excess |
| 50 |
|
| 51 |
penlabels(41,42,43,44); |
| 52 |
fi; |
| 53 |
|
| 54 |
enddef; |
| 55 |
|
| 56 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 57 |
|
| 58 |
def makebox(text r) = |
| 59 |
for y=0,1/2h,h: r((y*S,y),(w+y*S,y)); endfor; |
| 60 |
for x=0,Margin,w-Margin,w: |
| 61 |
if S=0: r((x,0),(x,h)); |
| 62 |
else: for y=0,1/2h,h: r((x+y*S,y-0.01h),(x+y*S,y+0.01h)); endfor; fi; |
| 63 |
endfor; |
| 64 |
if S>0: r((w+charic*pt,3/4h),(w+charic*pt,h+o)); fi; |
| 65 |
enddef; |
| 66 |
|
| 67 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 68 |
|
| 69 |
def outline = % cf. The METAFONTbook, p.244 |
| 70 |
cull currentpicture keeping (1,infinity) withweight 1; |
| 71 |
picture v; v:=currentpicture; |
| 72 |
cull currentpicture keeping (1,1) withweight 3; |
| 73 |
addto currentpicture also v |
| 74 |
-v shifted right -v shifted left -v shifted up -v shifted down; |
| 75 |
cull currentpicture keeping (1,4); |
| 76 |
enddef; |
| 77 |
|
| 78 |
|
| 79 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 80 |
%% Generating symbols |
| 81 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 82 |
|
| 83 |
if unknown S: S:=0 fi; % no slanting is default |
| 84 |
|
| 85 |
% ---------- Font dimensions ---------- |
| 86 |
font_slant S; |
| 87 |
font_x_height x_height#; |
| 88 |
font_normal_space 6u#+2letter_fit#; |
| 89 |
font_normal_stretch 3u#; |
| 90 |
font_normal_shrink 2u#; |
| 91 |
font_quad 18u#+4letter_fit#; |
| 92 |
font_extra_space 2u#; |
| 93 |
|
| 94 |
% ---------- CE marks ---------- |
| 95 |
BoxHeight#:=cap_height#; |
| 96 |
OuterDiameter#:=BoxHeight# + 2o#; |
| 97 |
Thickness#:=3/20OuterDiameter#; % prescribed by geometry |
| 98 |
BoxWidth#:=OuterDiameter#-Thickness#; % prescribed by geometry |
| 99 |
define_pixels(OuterDiameter,Thickness,o); |
| 100 |
|
| 101 |
beginchar("C",BoxWidth#,BoxHeight#,0); Bar:=0; draw_CE; endchar; |
| 102 |
beginchar("E",BoxWidth#,BoxHeight#,0); Bar:=1; draw_CE; endchar; |
| 103 |
|
| 104 |
beginchar("c",BoxWidth#,BoxHeight#,0); Bar:=0; draw_CE; outline; endchar; |
| 105 |
beginchar("e",BoxWidth#,BoxHeight#,0); Bar:=1; draw_CE; outline; endchar; |
| 106 |
|
| 107 |
bye |