1
2
3
4
5
6
7
8
9
10
11
12
13
14\unprotect
15
16\registerctxluafile { mlib pps }{}
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33\newbox \MPtextbox
34\newtoks \everyMPLIBsettext
35
36\def \doMPLIBflushenvironment
37 {
38 \clf_mptexget
39 \let \MPLIBflushenvironment \relax }
40
41\let \MPLIBflushenvironment \doMPLIBflushenvironment
42
43\unexpanded \def \MPLIBsetNtext # 1
44 { \MPLIBflushenvironment
45 \dowithnextbox { \clf_mpsettext \nextbox # 1 } \hbox \bgroup
46 \meta_set_current_color
47 \let \MPLIBflushenvironment \doMPLIBflushenvironment
48 \let \next }
49
50\unexpanded \def \MPLIBsetCtext # 1 # 2
51 { \MPLIBflushenvironment
52 \dowithnextbox { \clf_mpsettext \nextbox # 1 } \hbox \bgroup
53 \directcolored [# 2 ]
54 \meta_set_current_color
55 \let \MPLIBflushenvironment \doMPLIBflushenvironment
56 \let \next }
57
58\let \MPLIBsettext \MPLIBsetNtext
59
60\unexpanded \def \MPLIBsetNtextX # 1
61 { \MPLIBflushenvironment
62 \hbox \bgroup
63 \meta_set_current_color
64 \let \MPLIBflushenvironment \doMPLIBflushenvironment
65 \let \next }
66
67\unexpanded \def \MPLIBsetCtextX # 1 # 2
68 { \MPLIBflushenvironment
69 \hbox \bgroup
70 \directcolored [# 2 ]
71 \meta_set_current_color
72 \let \MPLIBflushenvironment \doMPLIBflushenvironment
73 \let \next }
74
75\let \MPLIBsettextX \MPLIBsetNtextX
76
77\unexpanded \def \MPLIBgettextscaled # 1 # 2 # 3
78 { \clf_mpgettext \MPtextbox # 1
79 \vpack to \zeropoint { \vss\hpack to \zeropoint { \scale [ \c!sx =# 2 , \c!sy =# 3 ] { \raise\dp \MPtextbox \box \MPtextbox } \forcecolorhack \hss }}}
80
81
82
83
84
85
86\unexpanded \def \MPLIBfigure # 1 # 2
87 { \setbox \scratchbox \hpack { \externalfigure [# 1 ][ \c!mask =# 2 ] }
88 \clf_mpsetsxsy \wd \scratchbox \ht \scratchbox \zeropoint
89 \vpack to \zeropoint { \vss\hpack to \zeropoint { \fastsxsy { \sx }{ \sy }{ \box \scratchbox } \hss }}}
90
91
92
93\unexpanded \def \MPLIBgettextscaledcm # 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9
94 { \clf_mpgettext \MPtextbox # 1
95 \setbox \MPbox \hpack \bgroup
96 \dotransformnextbox { # 2 }{ # 3 }{ # 4 }{ # 5 }{ # 6 }{ # 7 }
97 \vpack to \zeropoint\bgroup
98 \vss
99 \hpack to \zeropoint \bgroup
100
101
102 \fastsxsy { # 8 }{ # 9 }{ \raise\dp \MPtextbox \box \MPtextbox }
103
104
105
106
107
108 \forcecolorhack
109 \hss
110 \egroup
111 \egroup
112 \egroup
113 \smashbox \MPbox
114 \box \MPbox }
115
116
117
118
119
120
121
122
123\unexpanded \def \MPLIBgetboxscaledcm # 1 # 2
124 { \begingroup
125 \copyboxfromcache { # 1 }{ # 2 } \MPtextbox
126 \MPLIBgetboxscaledcm_next }
127
128\unexpanded \def \MPLIBgetboxscaledcm_next # 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8
129 { \setbox \MPbox \hpack \bgroup
130 \dotransformnextbox { # 1 }{ # 2 }{ # 3 }{ # 4 }{ # 5 }{ # 6 }
131 \vpack to \zeropoint\bgroup
132 \vss
133 \hpack to \zeropoint \bgroup
134 \fastsxsy { # 7 }{ # 8 }{ \raise\dp \MPtextbox \box \MPtextbox }
135 \hss
136 \egroup
137 \egroup
138 \egroup
139 \smashbox \MPbox
140 \box \MPbox
141 \endgroup }
142
143\unexpanded \def \MPLIBgraphictext # 1
144 { \startTEXpage [ \c!scale = 1 0 0 0 0 ]# 1 \stopTEXpage }
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172\unexpanded \def \MPLIBpositionwhd # 1 # 2 # 3 # 4 # 5
173 { \dosavepositionwhd { # 1 } \zerocount { # 2 \onebasepoint }{ # 3 \onebasepoint }{ # 4 \onebasepoint }{ # 5 \onebasepoint } \zeropoint }
174
175
176
177
178
179
180\def \doMPLIBstopgroup # 1 # 2 # 3 # 4 # 5 # 6
181 { \egroup
182 \setbox \scratchbox \hpack { \kern \onebasepoint \box \scratchbox }
183 \wd \scratchbox \dimexpr # 5 \onebasepoint # 3 \onebasepoint 2 \onebasepoint \relax
184 \ht \scratchbox # 6 \onebasepoint
185 \dp \scratchbox # 4 \onebasepoint
186 \setbox \scratchbox \hpack \bgroup
187 \kern # 3 \onebasepoint
188 \box \scratchbox
189 \egroup
190 \saveboxresource
191 attr { Group << S Transparency I \ifnum # 1 = 1 true \else false \fi K \ifnum # 2 = 1 true \else false \fi >> }
192 resources { \pdfbackendcurrentresources }
193 \scratchbox
194 \setbox \scratchbox \hpack \bgroup
195 \kern # 3 \onebasepoint
196 \kern \onebasepoint
197 \useboxresource \lastsavedboxresourceindex
198 \egroup
199 \wd \scratchbox \zeropoint
200 \ht \scratchbox \zeropoint
201 \dp \scratchbox \zeropoint
202 \box \scratchbox
203 \endgroup }
204
205\unexpanded \def \MPLIBstartgroup # 1 # 2 # 3 # 4 # 5 # 6
206 { \begingroup
207 \setbox \scratchbox \hpack \bgroup
208 \unexpanded \def \MPLIBstopgroup { \doMPLIBstopgroup { # 1 }{ # 2 }{ # 3 }{ # 4 }{ # 5 }{ # 6 }}}
209
210
211
212\newtoks \mptexttoks
213\newbox \mptextbox
214\newtoks \mpoutlinetoks
215\newtoks \mpgraphictexttoks
216
217\mptexttoks { \global\setbox \mptextbox \hbox { \clf_mptexttoks }}
218\mpoutlinetoks { \global\setbox \mptextbox \vbox { \clf_mpoutlinetoks }}
219\mpgraphictexttoks { \global\setbox \mptextbox \vbox { \clf_mpgraphictexttoks }}
220
221\protect \endinput
222 |