Debian Codegraph @

texmf-dist/source/metafont/roex/roexsamp/ro-07.mf

raw
1 %%%%
2 %%%% This file belongs to the ROEX package.
3 %%%%
4 %%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C
5 %%% draw fix_fill_cmyk fix_draw_cmyk
6 % RO-07.MF, ``LOGO OF JOURNAL OF ALGORITHMS'':
7 % Another example excerpted from The \MF{}book, pages 137 thru 139;
8 % |penstroke| is redefined in such a way that instead of creating a bitmap
9 % picture, it stores respective curves; two points were moved, |z.a8l| and
10 % |z.a8r| (see comments with a remark ``intrusion''), in order to avoid
11 % partially overlaping paths, as ROEX does not cope with such data.
12 % ---
13 input mftoeps; eps_mode_setup; input roex; tracingremoving:=1;
14 % ---
15 def penstroke text t =
16 forsuffixes e = l,r: path_.e:=t; endfor
17 if cycle path_.l: R[incr R.num]:=path_.l.t_; R[incr R.num]:=path_.r.t_;
18 else: R[incr R.num]:=path_.l -- reverse path_.r -- cycle; fi
19 enddef;
20 % ---
21 beginchar("0",29mm#,25mm#,0);
22 path R[\\]; R.num:=0;
23 %
24 thick#:=2mm#; thin#:=5/4mm#;
25 define_whole_blacker_pixels(thick,thin);
26 forsuffixes $=a,b,c: transform $;
27 forsuffixes e=l,r: path $e,$'e; numeric t$[\\]e;
28 endfor
29 endfor
30 penpos1(thick,0); penpos2(thick,90); penpos3(thick,180); penpos4(thick,270);
31 penpos5(thick,0); penpos6(thick,90); penpos7(thick,180); penpos8(thick,270);
32 x2=x4=x6=x8=.5[x5,x7]=.5w; x1r=w; x3r=0;
33 x5-x7=y6-y8;
34 y1=y3=y5=y7=.5[y6,y8]=.5h; y2r=h; y4r=0;
35 y6r=.75h;
36 forsuffixes e=l,r: a.e=b'e=c'e=superellipse (z1e,z2e,z3e,z4e,.75);
37 a'e=b.e=c.e=superellipse (z5e,z6e,z7e,z8e,.72);
38 endfor
39 penpos a1(thin,0); penpos a5(whatever,-90); penpos a9(thin,180);
40 x.a1l-x.a9l=1/3(x5l-x7l); x.a5=.5w; y.a1=y.a9; y.a5r=4/7h;
41 x.a3l=x.a1l; x.a3r=x.a1r; x.a4r=1/6[x.a3r,x1l]; x0=.5w; y0=.52h;
42 x.a6l+x.a4l=x.a6r+x.a4r=x.a7l+x.a3l=
43 x.a7r+x.a3r=x.a9+x.a1=w;
44 y.a3r=y.a4r=y.a6r=y.a7r=.2[y2l,y0]; y.a3l=y.a4l=y.a6l=y.a7l=y.a3r-thin;
45 z.a4l=z.a4r+(thin,0) rotated(angle(z.a4r-z.a5r)+90)+whatever*(z.a4r-z.a5r);
46 z.a4l-z.a5l=whatever*(z.a4r-z.a5r);
47 z=a.r intersectionpoint (z0--(w,0));
48 y.a1-y.a5=length(z-z0);
49 b=identity shifted (0,y0-y.a1) rotatedaround(z0,90-angle(z0-(w,0)));
50 c=b reflectedabout (z2,z4);
51 for n=1,3,4,5,6,7,9: forsuffixes e=l,,r: forsuffixes $=b,c:
52 z$[n]e=z.a[n]e transformed $;
53 endfor endfor endfor
54 forsuffixes e=l,r: forsuffixes $=a,b,c:
55 % intrusion: the primed entries are stored for further use (see below)
56 z$2e'=$l intersectionpoint (z$1e--z$3e);
57 z$8e'=$l intersectionpoint (z$9e--z$7e);
58 % end of intrusion
59 z$2e=$r intersectionpoint (z$1e--z$3e);
60 z$8e=$r intersectionpoint (z$9e--z$7e);
61 t$1e=xpart($e intersectiontimes (z$1l--z$3l));
62 t$9e=xpart($e intersectiontimes (z$9l--z$7l));
63 t$4e=xpart($'e intersectiontimes (z$5r--z$4l));
64 t$6e=xpart($'e intersectiontimes (z$5r--z$6l));
65 endfor endfor
66 penstroke subpath(t.a9e,t.b6e) of a.e;
67 penstroke subpath(t.b4e,t.c4e) of b'e;
68 penstroke subpath(t.c6e,t.a1e+8) of c'e;
69 penstroke subpath(t.a6e,t.b9e) of a'e;
70 penstroke subpath(t.b1e,t.c1e) of b.e;
71 penstroke subpath(t.c9e,t.a4e+8) of c.e;
72 % intrusion: correction of offending nodes, i.e., |z.a8l|, |z.a8r|,
73 % |z.a8l|, and |z.a8r|
74 x.a8l:=x.a8l'; x.a8r:=x.a8r'; y.a8l:=y.a8l'; y.a8r:=y.a8r'+(y2r-y2);
75 x.a2l:=x.a2l'; x.a2r:=x.a2r'; y.a2l:=y.a2l'; y.a2r:=y.a2r'+(y2r-y2);
76 % end of intrusion
77 forsuffixes $=a,b,c:
78 % |penlabels($1,$2,$3,$4,$5,$6,$7,$8,$9);|
79 penstroke z$2e--z$3e--z$4e--z$5e--z$6e--z$7e--z$8e;
80 endfor
81 % |penlabels(range 0 thru 8);|
82 vardef touch_path expr p = pos_turn p enddef;
83 remove_overlap (make_list(1,R.num)R) () R;
84 find_BB make_list(1,R.num)R;
85 write_preamble jobname;
86 fix_fill_cmyk 0,0,0,1/6;
87 fill_C make_list(1,R.num)R;
88 fix_line_width 1/10pt;
89 for i:=1 upto R.num:
90 fix_draw_cmyk if check_turn R[i]>0: 0,1,1,0 else: 1,1,0,0 fi;
91 draw_C R[i];
92 if proofing>0:
93 for j:=0 upto length(R[i])-1:
94 makelabel(decimal(j) & "/" & decimal(i),point j of R[i]);
95 endfor
96 fi
97 endfor
98 write_postamble;
99 endchar;
100 end.
101 %%\end
102