1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16\unprotect
17
18\registerctxluafile{mlibpps}{autosuffix}
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35\newbox \MPtextbox
36\newtoks\everyMPLIBsettext
37
38\permanent\protected\def\mlib_flush_environment
39 {
40 \clf_mptexget
41 \enforced\let\MPLIBflushenvironment\relax}
42
43\aliased\let\MPLIBflushenvironment\mlib_flush_environment
44
45\permanent\protected\def\MPLIBsetNtext#1
46 {\MPLIBflushenvironment
47 \dowithnextbox{\clf_mpsettext\nextbox #1}\hbox\bgroup
48 \meta_set_current_color
49 \enforced\let\MPLIBflushenvironment\mlib_flush_environment
50 \let\next}
51
52\permanent\protected\def\MPLIBsetCtext#1#2
53 {\MPLIBflushenvironment
54 \dowithnextbox{\clf_mpsettext\nextbox #1}\hbox\bgroup
55 \directcolored[#2]
56 \meta_set_current_color
57 \enforced\let\MPLIBflushenvironment\mlib_flush_environment
58 \let\next}
59
60\aliased\let\MPLIBsettext\MPLIBsetNtext
61
62\permanent\protected\def\MPLIBsetNtextX#1
63 {\MPLIBflushenvironment
64 \hbox\bgroup
65 \meta_set_current_color
66 \enforced\let\MPLIBflushenvironment\mlib_flush_environment
67 \let\next}
68
69\permanent\protected\def\MPLIBsetCtextX#1#2
70 {\MPLIBflushenvironment
71 \hbox\bgroup
72 \directcolored[#2]
73 \meta_set_current_color
74 \enforced\let\MPLIBflushenvironment\mlib_flush_environment
75 \let\next}
76
77\aliased\let\MPLIBsettextX\MPLIBsetNtextX
78
79
80
81
82
83
84
85
86
87
88
89\permanent\permanent\protected\def\MPLIBgettextscaled#1#2#3
90 {\clf_mpgettext\MPtextbox #1
91 \vpack to \zeropoint
92 {\vss
93 \hcontainer to \zeropoint
94 {\scale
95 [\c!sx=#2,\c!sy=#3]
96 {\raise\dp\MPtextbox\box\MPtextbox}\hss}}}
97
98\let\mlib_sx\!!zerocount
99\let\mlib_sy\!!zerocount
100
101\permanent\protected\def\MPLIBfigure#1#2
102 {\setbox\scratchbox\hpack{\externalfigure[#1][\c!mask=#2]}
103 \clf_mpsetsxsy\wd\scratchbox\ht\scratchbox\zeropoint
104 \vpack to \zeropoint
105 {\vss
106 \hpack to \zeropoint
107 {\fastsxsy{\mlib_sx}{\mlib_sy}{\box\scratchbox}\hss}}}
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135\permanent\protected\def\MPLIBgettextscaledcm#1#2#3#4#5#6#7#8#9
136 {\clf_mpgettext\MPtextbox #1
137 \setbox\MPbox\hpack\bgroup
138 \dotransformnextbox{#2}{#3}{#4}{#5}{#6}{#7}
139 \vpack to \zeropoint\bgroup
140 \vss \hcontainer to \zeropoint \bgroup
141 \fastsxsy{#8}{#9}{\raise\dp\MPtextbox\box\MPtextbox}\hss
142 \egroup
143 \egroup
144 \egroup
145 \smashbox\MPbox
146 \box\MPbox}
147
148
149
150
151
152
153
154
155\permanent\protected\def\MPLIBgetboxscaledcm#1#2
156 {\begingroup
157 \copyboxfromcache{#1}{#2}\MPtextbox
158 \mlib_get_box_scaled_cm_next}
159
160\protected\def\mlib_get_box_scaled_cm_next#1#2#3#4#5#6#7#8
161 {\setbox\MPbox\hpack\bgroup
162 \dotransformnextbox{#1}{#2}{#3}{#4}{#5}{#6}
163 \vpack to \zeropoint\bgroup
164 \vss
165 \hpack to \zeropoint \bgroup
166 \fastsxsy{#7}{#8}{\raise\dp\MPtextbox\box\MPtextbox}
167 \hss
168 \egroup
169 \egroup
170 \egroup
171 \smashbox\MPbox
172 \box\MPbox
173 \endgroup}
174
175\permanent\protected\def\MPLIBscaledcm#1#2#3#4#5#6#7
176 {\begingroup
177
178 \hpack\bgroup
179 \dotransformnextbox{#2}{#3}{#4}{#5}{#6}{#7}
180
181 \vpack to \zeropoint\bgroup
182 \vss
183 \hcontainer to \zeropoint \bgroup
184 #1\hss
185
186 \egroup
187 \egroup
188 \egroup
189
190 \endgroup}
191
192\permanent\protected\def\MPLIBgraphictext#1
193 {\startTEXpage[\c!scale=10000]#1\stopTEXpage}
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221\permanent\protected\def\MPLIBpositionwhd#1#2#3#4#5
222 {\dosavepositionwhd{#1}\zerocount{#2\onebasepoint}{#3\onebasepoint}{#4\onebasepoint}{#5\onebasepoint}\zeropoint}
223
224\def\mlib_stop_group#1#2#3#4#5#6
225 {\egroup
226 \setbox\scratchbox\hpack{\kern\onebasepoint\box\scratchbox}
227 \wd\scratchbox \dimexpr#5\onebasepoint#3\onebasepoint2\onebasepoint\relax
228 \ht\scratchbox #6\onebasepoint
229 \dp\scratchbox#4\onebasepoint
230 \setbox\scratchbox\hpack\bgroup
231 \kern#3\onebasepoint
232 \box\scratchbox
233 \egroup
234 \saveboxresource
235 attr {Group << S Transparency I \ifnum#1=1 true \else false \fi K \ifnum#2=1 true \else false \fi >>}
236 resources {\pdfbackendcurrentresources}
237 \scratchbox
238 \setbox\scratchbox\hpack\bgroup
239 \kern#3\onebasepoint
240 \kern\onebasepoint
241 \useboxresource\lastsavedboxresourceindex
242 \egroup
243 \wd\scratchbox\zeropoint
244 \ht\scratchbox\zeropoint
245 \dp\scratchbox\zeropoint
246 \box\scratchbox
247 \endgroup}
248
249\permanent\protected\lettonothing\MPLIBstopgroup
250
251\permanent\protected\def\MPLIBstartgroup#1#2#3#4#5#6
252 {\begingroup
253 \setbox\scratchbox\hpack\bgroup
254 \enforced\permanent\protected\def\MPLIBstopgroup{\mlib_stop_group{#1}{#2}{#3}{#4}{#5}{#6}}}
255
256
257
258
259
260
261\permanent\protected\def\MPLIBstartsetpattern#1#2#3#4#5#6
262 {\normalexpanded{\registerpattern[mppattern#1]\ifnum#6=\zerocount[hoffset=\MPx{mppattern#1},voffset=\MPy{mppattern#1}]\fi}
263 \bgroup
264 \dowithnextbox{
265 \boxxoffset\nextbox#2\onebasepoint
266 \boxyoffset\nextbox#3\onebasepoint
267 \wd\nextbox\dimexpr#4\onebasepoint#2\onebasepoint\relax
268 \ht\nextbox\dimexpr#5\onebasepoint#3\onebasepoint\relax
269 \box\nextbox}
270 \hpack\bgroup}
271
272\permanent\protected\def\MPLIBstopsetpattern
273 {\egroup
274 \egroup}
275
276\permanent\protected\def\MPLIBstartgetpattern#1#2#3#4#5#6
277 {\setbox\nextbox\hpack\bgroup
278 \applypattern
279 [\c!name=mppattern#1,
280
281 \c!width=\dimexpr#4\onebasepoint#2\onebasepoint\relax,
282
283 \c!height=\dimexpr#5\onebasepoint#3\onebasepoint\relax]
284 \hss
285 \egroup
286
287 \boxyoffset\nextbox \dimexpr#3\onebasepoint\relax
288
289 \boxxoffset\nextbox \dimexpr#2\onebasepoint\relax
290 \ht\nextbox\zeropoint
291 \wd\nextbox\zeropoint
292 \dp\nextbox\zeropoint
293 \normalexpanded{\ifnum#6=\zerocount\hpos{mppattern#1}\fi}{\box\nextbox}}
294
295\permanent\protected\lettonothing\MPLIBstopgetpattern
296
297
298
299\newtoks\mptexttoks
300\newbox \mptextbox
301\newtoks\mpoutlinetoks
302\newtoks\mpgraphictexttoks
303
304\mptexttoks {\global\setbox\mptextbox\hbox{\clf_mptexttoks}}
305\mpoutlinetoks {\global\setbox\mptextbox\vbox{\clf_mpoutlinetoks}}
306\mpgraphictexttoks{\global\setbox\mptextbox\vbox{\clf_mpgraphictexttoks}}
307
308\protect \endinput
309 |