Debian Codegraph @

texmf-dist/tex/luatex/blopentype/blot.tex

raw
1 %
2 % blopentype: a basic luatex open type loader
3 %
4 % some (most) pitex macros still in place.- 30.12.2022
5 % check history after `\endinput`
6 %
7 % User interface
8 %
9 \message{This is blopentype, v0.0.4 December 2023}
10
11 \input luatex85.sty % deprecated 30.12.2022
12 \input yax % which itself \input's texapi
13 \input gates
14
15 \setcatcodes{\@\_=11}
16 \suppressoutererror=1
17
18 % MESSAGES
19 \def\ptx@error{\senderror{PiTeX}}
20 \def\ptx@log#1{%
21 \immediate\write17{^^J#1^^J}%
22 }
23 \def\ptx@warn#1{%
24 \ptx@log{PiTeX warning: #1}%
25 }
26
27 % ATTRIBUTES
28 \newcount\ptx@attribute_count
29 \ptx@attribute_count=100 % The first 100 attributes are scratch.
30 \def\newattribute#1{%
31 \advance\ptx@attribute_count1
32 \attributedef#1=\ptx@attribute_count
33 \xdefcs{ptx@attribute:\commandtoname#1}{\the\ptx@attribute_count}%
34 }
35 \def\unsetattribute#1{#1=-"7FFFFFFF\relax}
36 \def\attributenumber#1{\usecs{ptx@attribute:\commandtoname#1}}
37
38 % FREEDEF
39 \def\freedef#1{%
40 \def#1{%
41 \ifnextnospace"
42 {\ptx@freedef_quote#1}
43 {\ifnextnospace/
44 {\ptx@freedef_slash#1}
45 {\usecs{ptx@freedef_user:\commandtoname#1}}}%
46 }%
47 \defcs{ptx@freedef_user:\commandtoname#1}##1%
48 }
49 \def\ptx@freedef_quote#1"#2"{%
50 \usecs{ptx@freedef_user:\commandtoname#1}{#2}%
51 }
52 \def\ptx@freedef_slash#1/#2/{%
53 \usecs{ptx@freedef_user:\commandtoname#1}{#2}%
54 }
55
56
57 \newbox\ptx@box_temp
58
59 \newif\ifmaintext
60 \maintexttrue
61
62 % CATCODE TABLES
63 \newcount\ptx@catcodetable_count
64 \ptx@catcodetable_count=100 % First 100 are scratch.
65 \def\newcatcodetable#1#2{%
66 \global\advance\ptx@catcodetable_count1
67 \chardef#1=\ptx@catcodetable_count
68 \begingroup
69 \setcatcodes{#2}%
70 \savecatcodetable#1%
71 \endgroup
72 }
73
74 \newcatcodetable\texcatcodes{\@\_=12}
75
76 \def\inputltmfile#1 {\input #1.tex }
77
78 \inputltmfile blot-lua
79 \inputltmfile blot-files
80 \inputltmfile blot-fonts
81 \restorecatcodes
82 \endinput
83 %
84 % the remaining macros are leftovers from PiTeX, awaiting removal.- 30.12.2022
85 %
86 %
87 \inputltmfile sections
88 \inputltmfile blocks
89 \inputltmfile references
90 \inputltmfile verbatim
91 \inputltmfile inserts
92 \inputltmfile output
93 \input navigator.tex
94
95 % AUXILIARY FILE
96 \iffile{\jobname.aux}{%
97 \ptx@lua{%
98 remove_conversion()
99 tex.print("\luaescapestring{\noexpand\input\noexpand\jobname.aux}")
100 }%
101 \directlua{restore_conversion()}}
102 \immediate\openout\ptx@auxfile=\jobname.aux
103
104 % PDF SETTINGS
105 \restrictparameter document : author title pdftitle date pdfdate subject keywords mode layout version\par
106 \restrictattribute document : mode outlines bookmarks thumbs thumbnails attachments files oc\par
107 \restrictattribute document : layout onepage onecolumn twopage twocolumn twopage* twocolumn*\par
108
109 \suppressoutererror=1
110 \let\ptx@bye\bye
111 \def\bye{%
112 \passvalueand{\setattribute navigator : title = } document : pdftitle { }{}
113 % The "date" attribute in the "document" parameter isn't supposed to hold a
114 % PDF-date, as navigator expects.
115 \deleteattribute document : date
116 \passvalueand{\setattribute navigator : date = } document : pdfdate { }{}
117 \finishpdffile\ptx@bye
118 }
119
120 \setattribute navigator : meta = document
121
122 % Turns a dimen into PostScript points, without the unit (as wanted by PDF).
123 \def\pdfpoint#1{%
124 \directlua{%
125 local d = "\the\dimexpr#1"
126 d = string.gsub(d, "pt", "")
127 tex.print(tostring(d * (72/72.27)))
128 }}
129
130
131
132
133 % TEX SETTINGS
134 \long\def\ptx@tex_set#1#2#3{%
135 \ifcs{#2}
136 {\usecs{#2}=#3\relax}
137 {\ptx@error{No TeX parameter `#2'}}
138 }
139
140 \defactiveparameter tex {%
141 \parameterloop #1 : \ptx@tex_set
142 }
143
144 \frenchspacing
145 \maxdepth=\maxdimen
146
147 \def\antigobblespace{%
148 \ifcatnext a{ }{\iffnext({ }}%
149 }
150
151 \def\strut#1#2{%
152 \vrule height#1 depth#2 width0pt
153 }
154
155 \newdimen\extraboxspace
156 \newdimen\ptx@extraboxspace_top
157 \newdimen\ptx@extraboxspace_right
158 \newdimen\ptx@extraboxspace_bottom
159 \newdimen\ptx@extraboxspace_left
160
161 \newfornoempty\ptx@colorbox_loop{1}#2,{%
162 \ifcase#1
163 \ptx@extraboxspace_top =#2
164 \ptx@extraboxspace_right =#2
165 \ptx@extraboxspace_bottom =#2
166 \ptx@extraboxspace_left =#2
167 \or
168 \ptx@extraboxspace_right =#2
169 \ptx@extraboxspace_left =#2
170 \or
171 \ptx@extraboxspace_bottom =#2
172 \or
173 \ptx@extraboxspace_left =#2
174 \fi
175 \passarguments{\numexpr(#1+1)}%
176 }
177 \def\colorbox{%
178 \ifnextnospace[\ptx@colorbox_setborders
179 {\ptx@extraboxspace_top =\extraboxspace
180 \ptx@extraboxspace_right =\extraboxspace
181 \ptx@extraboxspace_bottom =\extraboxspace
182 \ptx@extraboxspace_left =\extraboxspace
183 \ptx@colorbox_do}%
184 }
185 \def\ptx@colorbox_setborders[#1]{%
186 \ptx@colorbox_loop{0}{#1,}%
187 \ptx@colorbox_do
188 }
189 {\setcatcodes{pt=12}
190 \gdef\noPT#1pt{#1 }}
191 \def\ptx@colorbox_do#1#2{%
192 \bgroup
193 \setbox\ptx@box_temp=\hbox{#2}%
194 \hbox{%
195 \pdfliteral{
196 q #1 rg #1 RG
197 -\expandafter\noPT\the\ptx@extraboxspace_left
198 \expandafter\noPT\the\dimexpr(\ht\ptx@box_temp+\ptx@extraboxspace_top)\relax
199 \expandafter\noPT\the\dimexpr(\wd\ptx@box_temp+\ptx@extraboxspace_left+\ptx@extraboxspace_right)\relax
200 -\expandafter\noPT\the\dimexpr(\ht\ptx@box_temp+\ptx@extraboxspace_top+\dp\ptx@box_temp+\ptx@extraboxspace_bottom)\relax
201 re f Q}%
202 #2}%
203 \egroup
204 }
205
206 \def\og{\char"00AB~} \def\fg{~\char"00BB\antigobblespace}
207
208 \def\trace{\tracingcommands3 \tracingmacros2 }
209 \def\untrace{\tracingcommands0 \tracingmacros0 }
210
211 \restorecatcodes
212
213 \endinput
214
215 These notes are leftovers from Isambert's code: they'll be removed as
216 documentation improves.- 30.12.2022
217
218 This is piTeX, a set of macros I (Paul Isambert) use to
219 typeset documentations for my packages (that's why it is
220 archived on CTAN).
221
222 Perhaps in the future, when this achieves some kind of
223 format-like completude, it'll be publicly announced. In the
224 meanwhile, a documentation exists (pitex-doc.pdf, also readable
225 in a text editor as pitex-doc.txt).
226
227
228 You can of course use those macros, but you are on your
229 own, and the files will probably be modified without announcement.
230 The file is supposed to be \input on plain TeX with LuaTeX, at least v.0.6.
231
232
233 The files needed are:
234
235 texapi.tex (an independent package for programming)
236 yax.tex (an independent package for key=value interface)
237 gates.tex and gates.lua (an independant package for overall architecture)
238 navigator.tex (an independant package for PDF features)
239 lua.ptx and base.ptxlua (Lua side)
240 files.ptx (file management)
241 fonts.ptx, fonts.ptxlua and foundry-settings.lua
242 (fonts, should be independant some day; actually
243 fonts.ptxlua can be used independantly, but there is
244 no doc)
245 sections.ptx (sectionning commands)
246 blocks.ptx (text blocks)
247 references.ptx (labels and references)
248 verbatim.ptx (typesetting verbatim)
249 inserts.ptx (footnotes and figures, a mess)
250 output.ptx (output routine)
251
252 The file i-pitex.lua is needed only to typeset the documentation with the
253 Interpreter package.
254
255
256 Date: November 2011.
257
258 --- blopentype history
259
260 28-06-2023 fixed bug in blot-fonts.lua which affected nix systems.
261 thanks to david.carlisle for useful patch.
262 02-08-2023 fixed bug in blot-fonts.lua:
263 failure on files with empty extensions in font directories.
264 thanks to david.carlisle for useful patch.
265 07-09-2023 fixed bugs in blot-fonts.lua:
266 - quick kludge to avoid empty ligature tables
267 - quick kludge to avoid missing font families/series: fallback to default font