summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/task-ini.lua
blob: d0c00f5c81294b5f8a83a9720629bc07885b5e6e (plain)
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
if not modules then modules = { } end modules ['task-ini'] = {
    version   = 1.001,
    comment   = "companion to task-ini.mkiv",
    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
    copyright = "PRAGMA ADE / ConTeXt Development Team",
    license   = "see context related readme files"
}

-- this is a temporary solution, we need to isolate some modules and then
-- the load order can determine the trickery to be applied to node lists
--
-- we can disable more handlers and enable then when really used (*)
--
-- todo: two finalizers: real shipout (can be imposed page) and page shipout (individual page)
--
-- todo: consider moving the kernel kerning/ligaturing functions in the main font loop because
-- there we know if they are needed; doesn't save time but; if we overload unh* commands to
-- not apply the font handler, we can remove all checks for subtypes 255

local tasks           = nodes.tasks
local prependaction   = tasks.prependaction
local appendaction    = tasks.appendaction
local disableaction   = tasks.disableaction
local enableaction    = tasks.enableaction
local freezegroup     = tasks.freezegroup
local freezecallbacks = callbacks.freeze

appendaction("processors",   "normalizers", "typesetters.wrappers.handler")                      -- disabled
appendaction("processors",   "normalizers", "typesetters.characters.handler")                    -- always on
appendaction("processors",   "normalizers", "fonts.collections.process")                         -- disabled
appendaction("processors",   "normalizers", "fonts.checkers.missing")                            -- disabled

appendaction("processors",   "characters",  "scripts.autofontfeature.handler")
appendaction("processors",   "characters",  "scripts.splitters.handler")                         -- disabled
appendaction("processors",   "characters",  "typesetters.cleaners.handler")                      -- disabled
appendaction("processors",   "characters",  "typesetters.directions.handler")                    -- disabled
appendaction("processors",   "characters",  "typesetters.cases.handler")                         -- disabled
appendaction("processors",   "characters",  "typesetters.breakpoints.handler")                   -- disabled
appendaction("processors",   "characters",  "scripts.injectors.handler")                         -- disabled

appendaction("processors",   "words",       "languages.replacements.handler")                    -- disabled

appendaction("processors",   "words",       "languages.hyphenators.handler")                     -- always on

appendaction("processors",   "words",       "languages.words.check")                             -- disabled  -- might move up, no disc check needed then

appendaction("processors",   "words",       "typesetters.initials.handler")                      -- disabled  -- might move up
appendaction("processors",   "words",       "typesetters.firstlines.handler")                    -- disabled  -- might move down

appendaction("processors",   "fonts",       "builders.paragraphs.solutions.splitters.split")     -- experimental
appendaction("processors",   "fonts",       "nodes.handlers.characters")                         -- maybe todo
appendaction("processors",   "fonts",       "nodes.injections.handler")
appendaction("processors",   "fonts",       "typesetters.fontkerns.handler")
appendaction("processors",   "fonts",       "nodes.handlers.protectglyphs", nil, "nohead")       -- maybe todo
appendaction("processors",   "fonts",       "builders.kernel.ligaturing")                        -- always on (could be selective: if only node mode)
appendaction("processors",   "fonts",       "builders.kernel.kerning")                           -- always on (could be selective: if only node mode)
appendaction("processors",   "fonts",       "nodes.handlers.stripping")                          -- disabled (might move)
------------("processors",   "fonts",       "typesetters.italics.handler")                       -- disabled (after otf/kern handling)
appendaction("processors",   "fonts",       "nodes.handlers.flatten")

appendaction("processors",   "lists",       "typesetters.rubies.check")                          -- disabled (maybe someplace else)
appendaction("processors",   "lists",       "typesetters.characteralign.handler")                -- disabled (we need to to this after otf appliance)
appendaction("processors",   "lists",       "typesetters.spacings.handler")                      -- disabled
appendaction("processors",   "lists",       "typesetters.kerns.handler")                         -- disabled
appendaction("processors",   "lists",       "typesetters.digits.handler")                        -- disabled (after otf handling)
appendaction("processors",   "lists",       "typesetters.italics.handler")                       -- disabled (after otf/kern handling)
appendaction("processors",   "lists",       "languages.visualizediscretionaries")                -- disabled

appendaction ("processors",  "after",       "typesetters.marksuspects")

appendaction("shipouts",     "normalizers", "typesetters.showsuspects")
appendaction("shipouts",     "normalizers", "typesetters.margins.finalhandler")                  -- disabled
------------("shipouts",     "normalizers", "nodes.handlers.cleanuppage")                        -- disabled
appendaction("shipouts",     "normalizers", "builders.paragraphs.expansion.trace")               -- disabled
appendaction("shipouts",     "normalizers", "typesetters.alignments.handler")
appendaction("shipouts",     "normalizers", "nodes.references.handler")                          -- disabled
appendaction("shipouts",     "normalizers", "nodes.destinations.handler")                        -- disabled
appendaction("shipouts",     "normalizers", "nodes.rules.handler")                               -- disabled
appendaction("shipouts",     "normalizers", "nodes.shifts.handler")                              -- disabled
appendaction("shipouts",     "normalizers", "structures.tags.handler")                           -- disabled
appendaction("shipouts",     "normalizers", "nodes.handlers.accessibility")                      -- disabled
appendaction("shipouts",     "normalizers", "nodes.handlers.backgrounds")                        -- disabled
appendaction("shipouts",     "normalizers", "nodes.handlers.alignbackgrounds")                   -- disabled
------------("shipouts",     "normalizers", "nodes.handlers.export")                             -- disabled
appendaction("shipouts",     "normalizers", "typesetters.rubies.attach")                         -- disabled

appendaction("shipouts",     "finishers",   "nodes.visualizers.handler")                         -- disabled
appendaction("shipouts",     "finishers",   "attributes.colors.handler")                         -- disabled
appendaction("shipouts",     "finishers",   "attributes.transparencies.handler")                 -- disabled
appendaction("shipouts",     "finishers",   "attributes.colorintents.handler")                   -- disabled
appendaction("shipouts",     "finishers",   "attributes.negatives.handler")                      -- disabled
appendaction("shipouts",     "finishers",   "attributes.effects.handler")                        -- disabled
appendaction("shipouts",     "finishers",   "attributes.viewerlayers.handler")                   -- disabled

--maybe integrate relocate and families

appendaction("math",         "normalizers", "noads.handlers.showtree",  nil, "nohead")

appendaction("math",         "normalizers", "noads.handlers.unscript",  nil, "nohead")           -- always on (maybe disabled)
appendaction("math",         "normalizers", "noads.handlers.variants",  nil, "nohead")           -- always on
appendaction("math",         "normalizers", "noads.handlers.relocate",  nil, "nohead")           -- always on
appendaction("math",         "normalizers", "noads.handlers.families",  nil, "nohead")           -- always on

appendaction("math",         "normalizers", "noads.handlers.render",    nil, "nohead")           -- always on
appendaction("math",         "normalizers", "noads.handlers.collapse",  nil, "nohead") -- * first-- always on
appendaction("math",         "normalizers", "noads.handlers.domains",   nil, "nohead") -- * last -- disabled
appendaction("math",         "normalizers", "noads.handlers.autofences",nil, "nohead")           -- disabled
appendaction("math",         "normalizers", "noads.handlers.resize",    nil, "nohead")           -- always on
------------("math",         "normalizers", "noads.handlers.respace",   nil, "nohead")           -- always on
appendaction("math",         "normalizers", "noads.handlers.alternates",nil, "nohead")           -- always on
appendaction("math",         "normalizers", "noads.handlers.tags",      nil, "nohead")           -- disabled
appendaction("math",         "normalizers", "noads.handlers.italics",   nil, "nohead")           -- disabled
appendaction("math",         "normalizers", "noads.handlers.kernpairs", nil, "nohead")           -- disabled
appendaction("math",         "normalizers", "noads.handlers.classes",   nil, "nohead")           -- disabled

appendaction("math",         "builders",    "builders.kernel.mlist_to_hlist")                    -- always on
------------("math",         "builders",    "noads.handlers.italics",   nil, "nohead")           -- disabled
appendaction("math",         "builders",    "typesetters.directions.processmath")                -- disabled (has to happen pretty late)
appendaction("math",         "builders",    "noads.handlers.makeup",    nil, "nohead")           -- disabled (has to happen last)

appendaction("finalizers",   "lists",       "typesetters.paragraphs.normalize")                  -- moved here
appendaction("finalizers",   "lists",       "typesetters.margins.localhandler")                  -- disabled
appendaction("finalizers",   "lists",       "builders.paragraphs.keeptogether")
------------("finalizers",   "lists",       "nodes.handlers.graphicvadjust")                     -- todo
appendaction("finalizers",   "fonts",       "builders.paragraphs.solutions.splitters.optimize")  -- experimental
appendaction("finalizers",   "lists",       "builders.paragraphs.tag")

-- the next can also be in contributers normalizers (when we remove the loop in the handler)

appendaction("finalizers",   "lists",       "nodes.linefillers.handler")

appendaction("contributers", "normalizers", "nodes.handlers.flattenline")
appendaction("contributers", "normalizers", "nodes.handlers.textbackgrounds")

-- still experimental

appendaction("mvlbuilders",  "normalizers", "typesetters.margins.globalhandler")                 -- disabled
appendaction("mvlbuilders",  "normalizers", "nodes.handlers.migrate")

appendaction("mvlbuilders",  "normalizers", "builders.vspacing.pagehandler")                     -- last !
appendaction("mvlbuilders",  "normalizers", "builders.profiling.pagehandler")                    -- here !

------------("vboxbuilders", "normalizers", "typesetters.margins.localhandler")
appendaction("vboxbuilders", "normalizers", "builders.vspacing.vboxhandler")
appendaction("vboxbuilders", "normalizers", "builders.profiling.vboxhandler")                    -- here !

-- experimental too

appendaction("mvlbuilders",  "normalizers", "typesetters.checkers.handler")
appendaction("vboxbuilders", "normalizers", "typesetters.checkers.handler")

-- rather special (this might get hardcoded):

prependaction("processors",  "before",      "nodes.properties.attach")  -- enabled but optimized for quick abort
appendaction ("shipouts",    "normalizers", "nodes.properties.delayed") -- enabled but optimized for quick abort

-- speedup: only kick in when used

disableaction("processors",  "typesetters.wrappers.handler")
disableaction("processors",  "languages.replacements.handler")
disableaction("processors",  "typesetters.characteralign.handler")
disableaction("processors",  "scripts.autofontfeature.handler")
disableaction("processors",  "scripts.splitters.handler")
disableaction("processors",  "scripts.injectors.handler") -- was enabled
disableaction("processors",  "fonts.collections.process")
disableaction("processors",  "fonts.checkers.missing")
disableaction("processors",  "chars.handle_breakpoints")
disableaction("processors",  "typesetters.cleaners.handler")
disableaction("processors",  "typesetters.cases.handler")
disableaction("processors",  "typesetters.digits.handler")
disableaction("processors",  "typesetters.breakpoints.handler")
disableaction("processors",  "typesetters.directions.handler")
disableaction("processors",  "languages.words.check")
disableaction("processors",  "typesetters.initials.handler")
disableaction("processors",  "typesetters.firstlines.handler")
disableaction("processors",  "typesetters.spacings.handler")
disableaction("processors",  "typesetters.kerns.handler")
disableaction("processors",  "typesetters.italics.handler")
disableaction("processors",  "languages.visualizediscretionaries")
disableaction("processors",  "nodes.handlers.stripping")
disableaction("processors",  "builders.paragraphs.solutions.splitters.split")
disableaction("processors",  "typesetters.rubies.check")
disableaction("processors",  "typesetters.fontkerns.handler")
disableaction("processors",  "nodes.handlers.flatten")
disableaction("processors",  "typesetters.marksuspects")

disableaction("shipouts",    "typesetters.showsuspects")
disableaction("shipouts",    "typesetters.margins.finalhandler")
disableaction("shipouts",    "builders.paragraphs.expansion.trace")
disableaction("shipouts",    "typesetters.alignments.handler")
disableaction("shipouts",    "nodes.rules.handler")
disableaction("shipouts",    "nodes.shifts.handler")
disableaction("shipouts",    "attributes.colors.handler")
disableaction("shipouts",    "attributes.transparencies.handler")
disableaction("shipouts",    "attributes.colorintents.handler")
disableaction("shipouts",    "attributes.effects.handler")
disableaction("shipouts",    "attributes.negatives.handler")
disableaction("shipouts",    "attributes.viewerlayers.handler")
disableaction("shipouts",    "structures.tags.handler")
disableaction("shipouts",    "nodes.visualizers.handler")
disableaction("shipouts",    "nodes.handlers.accessibility")
disableaction("shipouts",    "nodes.handlers.backgrounds")
disableaction("shipouts",    "nodes.handlers.alignbackgrounds")
disableaction("shipouts",    "nodes.references.handler")
disableaction("shipouts",    "nodes.destinations.handler")
-------------("shipouts",    "nodes.handlers.export")
disableaction("shipouts",    "typesetters.rubies.attach")

disableaction("finalizers",  "typesetters.margins.localhandler")
disableaction("finalizers",  "builders.paragraphs.keeptogether")
disableaction("finalizers",  "builders.paragraphs.solutions.splitters.optimize")
-------------("finalizers",  "nodes.handlers.graphicvadjust") -- sort of obsolete
disableaction("finalizers",  "builders.paragraphs.tag")
disableaction("finalizers",  "nodes.linefillers.handler")

disableaction("contributers","nodes.handlers.flattenline")
disableaction("contributers","nodes.handlers.textbackgrounds")

disableaction("math",        "noads.handlers.showtree")
disableaction("math",        "noads.handlers.tags")
disableaction("math",        "noads.handlers.italics")
disableaction("math",        "noads.handlers.kernpairs")
disableaction("math",        "noads.handlers.domains")
disableaction("math",        "noads.handlers.classes")
disableaction("math",        "noads.handlers.autofences")
disableaction("math",        "noads.handlers.makeup")
disableaction("math",        "typesetters.directions.processmath")

disableaction("mvlbuilders", "typesetters.margins.globalhandler")
disableaction("mvlbuilders", "nodes.handlers.migrate")
disableaction("mvlbuilders", "typesetters.checkers.handler")
disableaction("mvlbuilders", "builders.profiling.pagehandler")

-------------("vboxbuilders","typesetters.margins.localhandler")
disableaction("vboxbuilders","typesetters.checkers.handler")
disableaction("vboxbuilders","builders.profiling.vboxhandler")

freezecallbacks("find_.*_file", "find file using resolver")
freezecallbacks("read_.*_file", "read file at once")
freezecallbacks("open_.*_file", "open file for reading")

-- experimental:

freezegroup("processors",   "normalizers")
freezegroup("processors",   "characters")
freezegroup("processors",   "words")
freezegroup("processors",   "fonts")
freezegroup("processors",   "lists")

freezegroup("finalizers",   "normalizers")
freezegroup("finalizers",   "fonts")
freezegroup("finalizers",   "lists")

freezegroup("shipouts",     "normalizers")
freezegroup("shipouts",     "finishers")

freezegroup("mvlbuilders",  "normalizers")
freezegroup("vboxbuilders", "normalizers")

-----------("parbuilders",  "lists")
-----------("pagebuilders", "lists")

freezegroup("math",         "normalizers")
freezegroup("math",         "builders")

-- new: disabled here

disableaction("processors", "builders.kernel.ligaturing")
disableaction("processors", "builders.kernel.kerning")

directives.register("nodes.basepass", function(v)
    if v then
         enableaction("processors", "builders.kernel.ligaturing")
         enableaction("processors", "builders.kernel.kerning")
    else
         disableaction("processors", "builders.kernel.ligaturing")
         disableaction("processors", "builders.kernel.kerning")
    end
end)