-
Notifications
You must be signed in to change notification settings - Fork 1
/
xpdftex.tex
179 lines (162 loc) · 8.67 KB
/
xpdftex.tex
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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
136
137
138
139
140
141
142
143
144
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
173
174
175
176
177
178
% xpdftex (pdftex emulation in luatex)
% Copyright 2022-2023 LaTeX Project
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
\catcode`\{=1
\catcode`\}=2
\catcode`\@=11
\catcode`\!=11
\catcode`\_=11
\catcode`\:=11
\let\@@!directlua\directlua \let\directlua\undefined
\@@!directlua{tex.enableprimitives('pdf',{'tracingfonts','pagewidth','pageheight',
'adjustspacing','protrudechars','copyfont','savepos','lastxpos','lastypos',
'draftmode','pxdimen','insertht','normaldeviate','uniformdeviate', 'setrandomseed','primitive'
})}
\@@!directlua{tex.enableprimitives('',{'expanded','ignoreligaturesinfont',
'expandglyphsinfont','lastsavedboxresourceindex','useboxresource','saveimageresource',
'lastsavedimageresourceindex','lastsavedimageresourcepages','useimageresource','outputmode',
'ifprimitive','ifabsnum','ifabsdim','lpcode','rpcode'})}
\@@!directlua{tex.enableprimitives('',tex.extraprimitives('etex'))}
\@@!directlua{tex.enableprimitives('@@!',{'pdffeedback','pdfextension','pdfvariable','luatexbanner'})}
\let\pdfnoligatures \ignoreligaturesinfont \let\ignoreligaturesinfont\undefined
\let\pdffontexpand \expandglyphsinfont \let\expandglyphsinfont\undefined
\let\pdfxform \saveboxresource \let\saveboxresource\undefined
\let\pdflastxform \lastsavedboxresourceindex \let\lastsavedboxresourceindex\undefined
\let\pdfrefxform \useboxresource \let\useboxresource\undefined
\let\pdfximage \saveimageresource \let\saveimageresource\undefined
\let\pdflastximage \lastsavedimageresourceindex \let\lastsavedimageresourceindex\undefined
\let\pdflastximagepages \lastsavedimageresourcepages \let\lastsavedimageresourcepages\undefined
\let\pdfrefximage \useimageresource \let\useimageresource\undefined
\let\pdfoutput \outputmode \let\outputmode\undefined
\let\ifpdfprimitive \ifprimitive \let\ifprimitive\undefined
\let\ifpdfabsnum \ifabsnum \let\ifabsnum\undefined
\let\ifpdfabsdim \ifabsdim \let\ifabsdim\undefined
\protected\def\pdftexversion {\numexpr 140\relax}
\def\pdftexrevision {7}
\protected\def\pdflastlink {\numexpr\@@!pdffeedback lastlink\relax}
\protected\def\pdfretval {\numexpr\@@!pdffeedback retval\relax}
\protected\def\pdflastobj {\numexpr\@@!pdffeedback lastobj\relax}
\protected\def\pdflastannot {\numexpr\@@!pdffeedback lastannot\relax}
\def\pdfxformname {\@@!pdffeedback xformname}
{\pdfoutput=1
\xdef\pdfcreationdate {\@@!pdffeedback creationdate}
}
\def\pdffontname {\@@!pdffeedback fontname}
\def\pdffontobjnum {\@@!pdffeedback fontobjnum}
\def\pdffontsize {\@@!pdffeedback fontsize}
\def\pdfpageref {\@@!pdffeedback pageref}
\def\pdfcolorstackinit {\@@!pdffeedback colorstackinit}
\protected\def\pdfliteral {\@@!pdfextension literal}
\protected\def\pdfcolorstack {\@@!pdfextension colorstack}
\protected\def\pdfsetmatrix {\@@!pdfextension setmatrix}
\protected\def\pdfsave {\@@!pdfextension save\relax}
\protected\def\pdfrestore {\@@!pdfextension restore\relax}
\protected\def\pdfobj {\@@!pdfextension obj }
\protected\def\pdfrefobj {\@@!pdfextension refobj }
\protected\def\pdfannot {\@@!pdfextension annot }
\protected\def\pdfstartlink {\@@!pdfextension startlink }
\protected\def\pdfendlink {\@@!pdfextension endlink\relax}
\protected\def\pdfoutline {\@@!pdfextension outline }
\protected\def\pdfdest {\@@!pdfextension dest }
\protected\def\pdfthread {\@@!pdfextension thread }
\protected\def\pdfstartthread {\@@!pdfextension startthread }
\protected\def\pdfendthread {\@@!pdfextension endthread\relax}
\protected\def\pdfinfo {\@@!pdfextension info }
\protected\def\pdfcatalog {\@@!pdfextension catalog }
\protected\def\pdfnames {\@@!pdfextension names }
\protected\def\pdfincludechars {\@@!pdfextension includechars }
\protected\def\pdffontattr {\@@!pdfextension fontattr }
\protected\def\pdfmapfile {\@@!pdfextension mapfile }
\protected\def\pdfmapline {\@@!pdfextension mapline }
\protected\def\pdftrailer {\@@!pdfextension trailer }
\protected\def\pdfglyphtounicode {\@@!pdfextension glyphtounicode }
\protected\edef\pdfcompresslevel {\@@!pdfvariable compresslevel}
\protected\edef\pdfobjcompresslevel {\@@!pdfvariable objcompresslevel}
\protected\edef\pdfdecimaldigits {\@@!pdfvariable decimaldigits}
\protected\edef\pdfgamma {\@@!pdfvariable gamma}
\protected\edef\pdfimageresolution {\@@!pdfvariable imageresolution}
\protected\edef\pdfimageapplygamma {\@@!pdfvariable imageapplygamma}
\protected\edef\pdfimagegamma {\@@!pdfvariable imagegamma}
\protected\edef\pdfimagehicolor {\@@!pdfvariable imagehicolor}
\protected\edef\pdfimageaddfilename {\@@!pdfvariable imageaddfilename}
\protected\edef\pdfpkresolution {\@@!pdfvariable pkresolution}
\protected\edef\pdfinclusioncopyfonts {\@@!pdfvariable inclusioncopyfonts}
\protected\edef\pdfinclusionerrorlevel {\@@!pdfvariable inclusionerrorlevel}
\protected\edef\pdfgentounicode {\@@!pdfvariable gentounicode}
\protected\edef\pdfpagebox {\@@!pdfvariable pagebox}
\protected\edef\pdfminorversion {\@@!pdfvariable minorversion}
\protected\edef\pdfuniqueresname {\@@!pdfvariable uniqueresname}
\protected\edef\pdfhorigin {\@@!pdfvariable horigin}
\protected\edef\pdfvorigin {\@@!pdfvariable vorigin}
\protected\edef\pdflinkmargin {\@@!pdfvariable linkmargin}
\protected\edef\pdfdestmargin {\@@!pdfvariable destmargin}
\protected\edef\pdfthreadmargin {\@@!pdfvariable threadmargin}
\protected\edef\pdfpagesattr {\@@!pdfvariable pagesattr}
\protected\edef\pdfpageattr {\@@!pdfvariable pageattr}
\protected\edef\pdfpageresources {\@@!pdfvariable pageresources}
\protected\edef\pdfxformattr {\@@!pdfvariable xformattr}
\protected\edef\pdfxformresources {\@@!pdfvariable xformresources}
\protected\edef\pdfpkmode {\@@!pdfvariable pkmode}
\let\@@!everyjob\everyjob
\toksdef\everyjob60000 % pdftex doesn't know about these
\countdef\e@alloc@luafunction@count60000
\edef\pdftexbanner{xpdftex: \@@!luatexbanner}
\protected\def\pdfinterwordspaceon{\@@!directlua{texio.write_nl("pdfinterwordspaceon not implemented in xpdftex")}}
\protected\def\pdfinterwordspaceoff{\@@!directlua{texio.write_nl("pdfinterwordspaceoff not implemented in xpdftex")}}
\protected\def\pdffakespace{ \@@!directlua{texio.write_nl("pdffakespace not implemented in xpdftex")}}
\def\@@!postlua{%
\let\pdffilesize\tex_filesize:D\let\tex_filesize:D\@undfined
\let\pdffiledump\tex_filedump:D\let\tex_filedump:D\@undefined
\let\pdffilemoddate\tex_filemoddate:D\let\tex_filemoddate:D\@undefined
\let\pdfstrcmp\tex_strcmp:D\let\tex_strcmp:D\@undefined
\let\pdfmdfivesum\tex_mdfivesum:D\let\tex_mdfivesum:D\@undefined
\let\pdfelapsedtime\__sys_elapsedtime:\let\__sys_elapsedtime:\@undefined
\let\__intarray_gset_count:Nw\@undefined
\let\intarray_count:N\@@!intarray_count:N
\let\intarray_gzero:N\@@!intarray_gzero:N
\let\__intarray_to_clist:Nn\@@!__intarray_to_clist:Nn
\protected\edef\pdfshellescape{\numexpr\@@!directlua{tex.sprint(status.shell_escape)}\relax}
}
\def\@@!tmp{}
\@@!everyjob{%
\let\@@!intarray_count:N\intarray_count:N
\let\@@!intarray_gzero:N\intarray_gzero:N
\let\@@!__intarray_to_clist:Nn\__intarray_to_clist:Nn
\@@!directlua{require("xpdftex.lua")}\@@!postlua\the\everyjob
\protected\def\write{\@@!directlua{xpdftex.write_or_execute()}}%
\let\tex_filesize:D\pdffilesize
\let\tex_filedump:D\pdffiledump
\let\tex_filemoddate:D\pdffilemoddate
\let\tex_strcmp:D\pdfstrcmp
\let\tex_mdfivesum:D\pdfmdfivesum
}
\@@!directlua{require("xpdftex.lua")}\@@!postlua
% allow microtype to find luatex
\everyjob\expandafter{\the\everyjob
\AddToHook{file/microtype.sty/before}[xpdftex]{%
\let\pdftexversion\@undefined
\let\directlua\@@!directlua
\let\protrudechars\pdfprotrudechars
\let\adjustspacing\pdfadjustspacing
\let\expandglyphsinfont\pdffontexpand
\def\luatexversion{115}%
\countdef\outputmode10000 \outputmode=1
}%
\AddToHook{file/microtype.sty/after}[xpdftex]{%
\AtBeginDocument{\def\pdftexversion{140}%
\let\directlua\@undefined
\let\luatexversion\@undefined
\let\pdfoutput\@undefined
\let\protrudechars\@undefined
\let\adjustspacing\@undefined
\let\expandglyphsinfont\@undefined
}}%
}
\catcode`\{=12
\catcode`\{=12
\catcode`\@=12
\catcode`\!=12
\catcode`\_=12
\catcode`\:=12