mp-symb.mpiv /size: 6532 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [       file=mp-symb.mp,
3%D        version=very old,
4%D          title=\CONTEXT\ \METAPOST\ graphics,
5%D       subtitle=navigation symbol macros,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14%D Instead of these symbols, you can use the \type {contnav}
15%D font by Taco Hoekwater that is derived form this file.
16
17u  := 3;
18h  := 5u;
19wt := 5u;
20wb := .25wt;
21o  := .1u;
22pw := .5u;
23
24drawoptions (withpen pencircle scaled pw);
25
26path lefttriangle, righttriangle, sublefttriangle, subrighttriangle;
27
28pair s ; s = (2wb,0) ;
29
30x1t = x2t = 0;
31x3t = wt;
32y3t = .5h;
33z1t-z2t = (z3t-z2t) rotated 60;
34
35z4t = (z2t--z3t) intersectionpoint ((z1t--z2t) shifted s) ;
36z5t = (z3t--z1t) intersectionpoint ((z1t--z2t) shifted s) ;
37
38righttriangle = z1t--z2t--z3t--cycle;
39lefttriangle = righttriangle rotatedaround((0,.5h), 180) shifted (wt,0);
40
41subrighttriangle = z4t--((z2t--z3t--z1t) shifted s)--z5t ;
42sublefttriangle  = subrighttriangle rotatedaround((0,.5h), 180) shifted (wt,0);
43
44path sidebar;
45
46x1b = x4b = 0;
47x2b = x3b = wb;
48y1b = y2b = y1t;
49y3b = y4b = y2t;
50
51sidebar = z1b--z2b--z3b--z4b--cycle;
52
53path midbar, onebar, twobar;
54
55hh = abs(y1t-y2t);
56
57%midbar := unitsquare scaled 2hh/3;
58midbar := unitsquare scaled hh;
59onebar := unitsquare xscaled (hh/3) yscaled hh;
60twobar := onebar;
61
62def prepareglyph =
63  drawoptions (withpen pencircle scaled .5u);
64enddef;
65
66def finishglyph =
67  set_outer_boundingbox currentpicture;
68  bboxmargin := o;
69  setbounds currentpicture to bbox currentpicture;
70%  draw boundingbox currentpicture withcolor red withpen pencircle scaled 1;
71enddef;
72
73beginfig  (1);
74  prepareglyph;
75  fill lefttriangle;
76  draw lefttriangle;  % draw gets the bbox right, filldraw doesn't
77  finishglyph;
78endfig;
79
80beginfig  (2);
81  prepareglyph;
82  fill righttriangle;
83  draw righttriangle;
84  finishglyph;
85endfig;
86
87beginfig  (3);
88  prepareglyph;
89  fill sidebar;
90  draw sidebar;
91  fill lefttriangle shifted (.5s);
92  draw lefttriangle shifted (.5s);
93  finishglyph;
94endfig;
95
96beginfig  (4);
97  prepareglyph;
98  fill righttriangle;
99  draw righttriangle;
100  fill sidebar shifted (wt,0);
101  draw sidebar shifted (wt,0);
102  finishglyph;
103endfig;
104
105beginfig  (5);
106  prepareglyph;
107  fill lefttriangle;
108  draw lefttriangle;
109  fill lefttriangle shifted s;
110  draw lefttriangle shifted s;
111  finishglyph;
112endfig;
113
114beginfig  (6);
115  prepareglyph;
116  fill righttriangle;
117  draw righttriangle;
118  fill righttriangle shifted s;
119  draw righttriangle shifted s;
120  finishglyph;
121endfig;
122
123beginfig  (7);
124  prepareglyph;
125  fill midbar;
126  draw midbar;
127  finishglyph;
128endfig;
129
130beginfig  (8);
131  prepareglyph;
132  fill onebar;
133  draw onebar;
134  finishglyph;
135endfig;
136
137beginfig  (9);
138  prepareglyph;
139  fill twobar;
140  draw twobar;
141  fill twobar shifted (pw+hh/2,0);
142  draw twobar shifted (pw+hh/2,0);
143  finishglyph;
144endfig;
145
146beginfig(101);
147  prepareglyph;
148  draw lefttriangle;
149  finishglyph;
150endfig;
151
152beginfig(102);
153  prepareglyph;
154  draw righttriangle;
155  finishglyph;
156endfig;
157
158beginfig(103);
159  prepareglyph;
160  draw sidebar;
161  draw lefttriangle shifted (.5s);
162  finishglyph;
163endfig;
164
165beginfig(104);
166  prepareglyph;
167  draw righttriangle;
168  draw sidebar shifted (wt,0);
169  finishglyph;
170endfig;
171
172beginfig(105);
173  prepareglyph;
174  draw lefttriangle;
175  draw lefttriangle shifted s;
176  finishglyph;
177endfig;
178
179beginfig(106);
180  prepareglyph;
181  draw righttriangle;
182  draw righttriangle shifted s;
183  finishglyph;
184endfig;
185
186beginfig(107);
187  prepareglyph;
188  draw midbar;
189  finishglyph;
190endfig;
191
192beginfig(108);
193  prepareglyph;
194  draw onebar;
195  finishglyph;
196endfig;
197
198beginfig(109);
199  prepareglyph;
200  draw twobar;
201  draw twobar shifted (pw+hh/2,0);
202  finishglyph;
203endfig;
204
205beginfig(201);
206  prepareglyph;
207  draw lefttriangle;
208  finishglyph;
209endfig;
210
211beginfig(202);
212  prepareglyph;
213  draw righttriangle;
214  finishglyph;
215endfig;
216
217beginfig(203);
218  prepareglyph;
219  draw sidebar;
220  draw lefttriangle shifted (.5s);
221  finishglyph;
222endfig;
223
224beginfig(204);
225  prepareglyph;
226  draw righttriangle;
227  draw sidebar shifted (wt,0);
228  finishglyph;
229endfig;
230
231beginfig(205);
232  prepareglyph;
233  draw sublefttriangle shifted s;
234  draw lefttriangle shifted s;
235  finishglyph;
236endfig;
237
238beginfig(206);
239  prepareglyph;
240  draw subrighttriangle;
241  draw righttriangle;
242  finishglyph;
243endfig;
244
245beginfig(207);
246  prepareglyph;
247  draw midbar;
248  finishglyph;
249endfig;
250
251beginfig(208);
252  prepareglyph;
253  draw onebar;
254  finishglyph;
255endfig;
256
257beginfig(209);
258  prepareglyph;
259  draw twobar;
260  draw twobar shifted (pw+hh/2,0);
261  finishglyph;
262endfig;
263
264
265beginfig(999);
266
267picture collection []  ;
268
269prepareglyph ;
270draw lefttriangle ;
271finishglyph ;
272collection[201] := currentpicture ;
273currentpicture := nullpicture ;
274
275prepareglyph ;
276draw righttriangle ;
277finishglyph ;
278collection[202] := currentpicture ;
279currentpicture := nullpicture ;
280
281prepareglyph ;
282draw sidebar ;
283draw lefttriangle shifted (.5s) ;
284finishglyph ;
285collection[203] := currentpicture ;
286currentpicture := nullpicture ;
287
288prepareglyph ;
289draw righttriangle ;
290draw sidebar shifted (wt,0) ;
291finishglyph ;
292collection[204] := currentpicture ;
293currentpicture := nullpicture ;
294
295prepareglyph ;
296draw sublefttriangle shifted s ;
297draw lefttriangle shifted s ;
298finishglyph ;
299collection[205] := currentpicture ;
300currentpicture := nullpicture ;
301
302prepareglyph ;
303draw subrighttriangle ;
304draw righttriangle ;
305finishglyph ;
306collection[206] := currentpicture ;
307currentpicture := nullpicture ;
308
309prepareglyph ;
310draw midbar ;
311finishglyph ;
312collection[207] := currentpicture ;
313currentpicture := nullpicture ;
314
315prepareglyph ;
316draw onebar ;
317finishglyph ;
318collection[208] := currentpicture ;
319currentpicture := nullpicture ;
320
321prepareglyph ;
322draw twobar ;
323draw twobar shifted (pw+hh/2,0) ;
324finishglyph ;
325collection[209] := currentpicture ;
326currentpicture := nullpicture ;
327
328for i=201 upto 209 :
329  collection[i] := collection[i] shifted - center collection[i] ;
330endfor ;
331
332addto currentpicture also collection[205] shifted (   0,   0)
333  withcolor (.3,.4,.5) ;
334addto currentpicture also collection[202] shifted (   0,1.5h)
335  withcolor (.5,.6,.7) ;
336addto currentpicture also collection[201] shifted (1.5h,   0)
337  withcolor (.6,.7,.8) ;
338addto currentpicture also collection[206] shifted (1.5h,1.5h)
339  withcolor (.4,.5,.6) ;
340
341collection[210] := currentpicture ;
342currentpicture := nullpicture ;
343
344bboxmargin := .25u;
345
346fill bbox collection[210] withcolor .95(1,1,0);
347addto currentpicture also collection[210] ;
348
349endfig ;
350
351end
352