1
2
3
4
5
6
7
8
9
10
11
12
13
14\startMPextensions
15 color mfun_grid_lgc[] ;
16 numeric mfun_grid_lgi ;
17 mfun_grid_lgc[1] := red ;
18 mfun_grid_lgc[2] := green ;
19 mfun_grid_lgc[3] := blue ;
20 mfun_grid_lgi := 1 ;
21\stopMPextensions
22
23\startuseMPgraphic{linegrid}
24
25
26
27
28
29
30
31
32 if mfun_grid_lgi = 3 :
33 mfun_grid_lgi := 1 ;
34 else :
35 mfun_grid_lgi := mfun_grid_lgi 1 ;
36 fi ;
37 draw image (
38 save f, t ;
39 pair f, t ;
40 f := (0,-2LineHeight) ;
41 t := (0, 2LineHeight) ;
42 for i=ypart f eps step LineHeight5 until ypart t eps:
43 draw (EmWidth,i) -- (0,i) ;
44 endfor ;
45 draw f -- t ;
46 draw (EmWidth,0) -- (EmWidth,0) ;
47
48 ) shifted (EmWidth2,0) withcolor mfun_grid_lgc[mfun_grid_lgi] ;
49 setbounds currentpicture to origin -- cycle ;
50\stopuseMPgraphic
51
52\unexpanded\def\showlinegrid{\dontleavehmode\smash{\useMPgraphic{linegrid}}}
53
54\continueifinputfile{metaimpgrid.mkiv}
55
56\starttext
57
58\showlinegrid \input tufte \par
59\showlinegrid \input tufte \par
60\showlinegrid \input ward \par
61\showlinegrid \input ward \par
62
63\stoptext
64 |