1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33\setuppapersize
34 [S6][S6]
35
36\setupbodyfont
37 [pos,10pt]
38
39
40
41\setuplayout
42 [topspace=0cm,
43 backspace=0cm,
44 header=0pt,
45 footer=0pt,
46 width=middle,
47 height=middle]
48
49\setupcolors
50 [state=start]
51
52\definecolor[TextColor][s=.9]
53\definecolor[PageColor][r=.5,g=.4,b=.3]
54\definecolor[LineColor][r=.7,g=.6,b=.5]
55
56\definecolor[ColorPage][r=.5,g=.6,b=.7]
57\definecolor[ColorLine][r=.3,g=.4,b=.5]
58
59\setupinteraction
60 [state=start,
61 display=new]
62
63\setupinteractionscreen
64 [option=max]
65
66
67
68
69\defineoverlay [page] [\uniqueMPgraphic{page}]
70\defineoverlay [graphic] [\uniqueMPgraphic{graphic}]
71\defineoverlay [number] [\uniqueMPgraphic{number}]
72
73
74
75\defineoverlay [nextpage] [\overlaybutton{nextpage}]
76\defineoverlay [previouspage] [\overlaybutton{previouspage}]
77\defineoverlay [forward] [\overlaybutton{forward}]
78
79
80
81\definelayer [main]
82\defineoverlay [main] [\composedlayer{main}]
83
84
85
86\setupbackgrounds
87 [page]
88 [background={previouspage,page}]
89
90
91
92
93
94\setupbackgrounds
95 [text]
96 [background={main,idea}]
97
98
99
100
101
102\defineframedtext
103 [PageText]
104 [width=fit,offset=.5cm,
105 before=,after=,frame=off,background={number,forward}]
106
107\defineframedtext
108 [SampleText]
109 [width=.6\makeupwidth,height=fit,offset=2cm,align=middle,
110 before=,after=,frame=off,background={graphic,sample,nextpage}]
111
112\defineframedtext
113 [TextText]
114 [width=.6\makeupwidth,height=fit,offset=2cm,align=middle,
115 before=,after=,frame=off,background={text,nextpage}]
116
117
118
119
120
121
122\def\StartIdea
123 {\null \dontcomplain}
124
125\def\StopIdea
126 {\setlayer
127 [main]
128 [x=\makeupwidth,y=.5cm,hoffset=.5cm,location=lb]
129 {\PageText{\pagenumber}}
130 \page}
131
132
133
134\def\StartSample
135 {\setlayer
136 [main]
137 [hoffset=.75cm,voffset=.75cm]
138 \bgroup \hpos {SampText:\realfolio} \bgroup \startSampleText [none]}
139
140\def\StopSample
141 {\stopSampleText \egroup \egroup}
142
143
144
145
146
147
148\def\StartText
149 {\setMPpositiongraphic
150 {TextText:\realfolio}{text}{other=SampText:\realfolio}
151 \setlayer
152 [main]
153 [x=\makeupwidth,y=\makeupheight,
154 hoffset=.75cm,voffset=.75cm,
155 location=lt]
156 \bgroup \noindent \hpos {TextText:\realfolio} \bgroup \startTextText [none]}
157
158\def\StopText
159 {\stopTextText \egroup \egroup}
160
161
162
163
164
165
166\startuniqueMPgraphic{page}
167 StartPage ;
168 pickup pencircle scaled .5cm ;
169 fill Page withcolor \MPcolor{PageColor} ;
170 draw Page withcolor \MPcolor{LineColor} ;
171 StopPage ;
172\stopuniqueMPgraphic
173
174\startuniqueMPgraphic{number}
175 path p ; p := fullcircle xscaled OverlayWidth yscaled OverlayHeight;
176 pickup pencircle scaled .25cm ;
177 fill p withcolor \MPcolor{TextColor} ;
178 draw p withcolor (white\MPcolor{PageColor}) ;
179\stopuniqueMPgraphic
180
181\startuniqueMPgraphic{graphic}
182 path p ; p := fullcircle xscaled OverlayWidth yscaled OverlayHeight;
183 pickup pencircle scaled .5cm ;
184 fill p withcolor \MPcolor{TextColor} ;
185 draw p withcolor \MPcolor{LineColor} ;
186\stopuniqueMPgraphic
187
188
189
190
191
192\startMPpositiongraphic{text}
193 initialize_box(\MPpos{\MPvar{other}}) ;
194 path p ; p := fullcircle xscaled wxy yscaled hxy shifted cxy ;
195 initialize_box(\MPpos{\MPvar{self}}) ;
196 path q ; q := fullcircle xscaled wxy yscaled hxy shifted cxy ;
197 pickup pencircle scaled .5cm ;
198 fill q withcolor \MPcolor{TextColor} ;
199 draw p withcolor (white\MPcolor{PageColor}) ;
200 clip currentpicture to q ;
201 draw q withcolor \MPcolor{LineColor} ;
202 anchor_box(\MPanchor{\MPvar{self}}) ;
203\stopMPpositiongraphic
204
205
206
207
208\def\StartTitlePage
209 {\startstandardmakeup
210 \dontcomplain
211 \setupframedtexts[TextText][width=fit]
212 \StartText
213 \bfd\setupinterlinespace
214 \def\\{\blank\bfc\setupinterlinespace\def\\{\blank}}}
215
216\def\StopTitlePage
217 {\StopText
218 \stopstandardmakeup}
219
220\def\TitlePage#1
221 {\StartTitlePage#1\StopTitlePage}
222
223
224
225
226\startMPpositiongraphic{text}
227 if box_found(\MPpos{\MPvar{other}}) :
228 initialize_box(\MPpos{\MPvar{other}}) ;
229 path p ; p := fullcircle xscaled wxy yscaled hxy shifted cxy ;
230 fi ;
231 initialize_box(\MPpos{\MPvar{self}}) ;
232 path q ; q := fullcircle xscaled wxy yscaled hxy shifted cxy ;
233 pickup pencircle scaled .5cm ;
234 fill q withcolor \MPcolor{TextColor} ;
235 if box_found(\MPpos{\MPvar{other}}) :
236 draw p withcolor (white\MPcolor{PageColor}) ;
237 clip currentpicture to q ;
238 draw q withcolor \MPcolor{LineColor} ;
239 else :
240 draw q withcolor (white\MPcolor{PageColor}) ;
241 fi ;
242 anchor_box(\MPanchor{\MPvar{self}}) ;
243
244\stopMPpositiongraphic
245
246\doifnotmode{demo}{\endinput}
247
248\starttext
249
250\TitlePage
251 {Fancy Styles:\\layers}
252
253\StartIdea
254 \StartSample
255 \input tufte
256 \StopSample
257 \StartText
258 \input reich
259 \StopText
260\StopIdea
261
262\StartIdea
263 \StartSample
264 \input knuth
265 \StopSample
266 \StartText
267 \input reich
268 \StopText
269\StopIdea
270
271\stoptext
272 |