summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/back-exp.lua21
-rw-r--r--tex/context/base/mkiv/char-ini.lua11
-rw-r--r--tex/context/base/mkiv/cldf-ini.lua24
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv6
-rw-r--r--tex/context/base/mkiv/font-col.lua88
-rw-r--r--tex/context/base/mkiv/font-ctx.lua6
-rw-r--r--tex/context/base/mkiv/font-hsh.lua96
-rw-r--r--tex/context/base/mkiv/font-imp-quality.lua28
-rw-r--r--tex/context/base/mkiv/font-ocl.lua2
-rw-r--r--tex/context/base/mkiv/good-ctx.lua36
-rw-r--r--tex/context/base/mkiv/grph-inc.lua5
-rw-r--r--tex/context/base/mkiv/l-package.lua4
-rw-r--r--tex/context/base/mkiv/luat-run.lua8
-rw-r--r--tex/context/base/mkiv/luat-sto.lua2
-rw-r--r--tex/context/base/mkiv/m-fonts-plugins.mkiv5
-rw-r--r--tex/context/base/mkiv/math-act.lua4
-rw-r--r--tex/context/base/mkiv/math-ini.mkiv1
-rw-r--r--tex/context/base/mkiv/math-noa.lua12
-rw-r--r--tex/context/base/mkiv/math-vfu.lua4
-rw-r--r--tex/context/base/mkiv/meta-ini.mkiv8
-rw-r--r--tex/context/base/mkiv/mlib-pps.lua1
-rw-r--r--tex/context/base/mkiv/mlib-run.lua2
-rw-r--r--tex/context/base/mkiv/mult-low.lua1
-rw-r--r--tex/context/base/mkiv/node-bck.lua107
-rw-r--r--tex/context/base/mkiv/node-fnt.lua821
-rw-r--r--tex/context/base/mkiv/node-ini.lua27
-rw-r--r--tex/context/base/mkiv/node-met.lua66
-rw-r--r--tex/context/base/mkiv/node-nut.lua252
-rw-r--r--tex/context/base/mkiv/node-par.lua60
-rw-r--r--tex/context/base/mkiv/node-ppt.lua259
-rw-r--r--tex/context/base/mkiv/node-res.lua28
-rw-r--r--tex/context/base/mkiv/node-rul.lua329
-rw-r--r--tex/context/base/mkiv/pack-rul.lua173
-rw-r--r--tex/context/base/mkiv/page-lin.lua11
-rw-r--r--tex/context/base/mkiv/scrp-ini.lua51
-rw-r--r--tex/context/base/mkiv/spac-chr.lua59
-rw-r--r--tex/context/base/mkiv/spac-par.mkiv8
-rw-r--r--tex/context/base/mkiv/spac-ver.mkiv5
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26301 -> 26331 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin267692 -> 267701 bytes
-rw-r--r--tex/context/base/mkiv/strc-pag.mkiv2
-rw-r--r--tex/context/base/mkiv/supp-box.mkiv4
-rw-r--r--tex/context/base/mkiv/symb-ini.mkiv14
-rw-r--r--tex/context/base/mkiv/syst-ini.mkiv2
-rw-r--r--tex/context/base/mkiv/type-ini.mkvi12
-rw-r--r--tex/context/base/mkiv/typo-cln.lua31
-rw-r--r--tex/context/base/mkiv/typo-lin.lua8
-rw-r--r--tex/context/base/mkiv/typo-pnc.lua77
-rw-r--r--tex/context/base/mkiv/util-str.lua95
-rw-r--r--tex/context/interface/mkiv/context-en.xml1
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin853853 -> 853843 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin61222 -> 61216 bytes
-rw-r--r--tex/context/interface/mkiv/i-strut.xml2
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua54
57 files changed, 790 insertions, 2149 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 9fc06651d..89d228b63 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2018.08.30 18:41}
+\newcontextversion{2018.09.01 23:10}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index d07e196e7..b146654e7 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2018.08.30 18:41}
+\edef\contextversion{2018.09.01 23:10}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua
index 6d403fe53..39f6e5155 100644
--- a/tex/context/base/mkiv/back-exp.lua
+++ b/tex/context/base/mkiv/back-exp.lua
@@ -3300,10 +3300,9 @@ end
return p
end
- function builders.paragraphs.tag(head) -- traverse_list
+ function builders.paragraphs.tag(head)
noftextblocks = noftextblocks + 1
- for n in nexthlist, head do
- local subtype = getsubtype(n)
+ for n, subtype in nexthlist, head do
if subtype == line_code then
setattr(n,a_textblock,noftextblocks)
elseif subtype == glue_code or subtype == kern_code then -- no need to set fontkerns
@@ -3313,22 +3312,6 @@ end
return false
end
- if LUATEXVERSION >= 1.080 then
-
- function builders.paragraphs.tag(head) -- traverse_list
- noftextblocks = noftextblocks + 1
- for n, subtype in nexthlist, head do
- if subtype == line_code then
- setattr(n,a_textblock,noftextblocks)
- elseif subtype == glue_code or subtype == kern_code then -- no need to set fontkerns
- setattr(n,a_textblock,0)
- end
- end
- return false
- end
-
- end
-
end
do
diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua
index 92f9a2291..ea9aa330f 100644
--- a/tex/context/base/mkiv/char-ini.lua
+++ b/tex/context/base/mkiv/char-ini.lua
@@ -645,22 +645,19 @@ function characters.getrange(name,expression) -- used in font fallback definitio
local first, rest = lpegmatch(splitter2,name)
local range = rawget(blocks,lower(gsub(first,"[^a-zA-Z0-9]","")))
if range then
- start = range.first
- stop = range.last
local s = loadstring("return 0 " .. rest)
if type(s) == "function" then
local d = s()
if type(d) == "number" then
- start = start + d
- stop = stop + d
- return start, stop, nil
+ return range.first + d, range.last + d, nil
end
end
end
end
- start, stop = lpegmatch(splitter1,name)
+ local start, stop = lpegmatch(splitter1,name)
if start and stop then
- start, stop = tonumber(start,16) or tonumber(start), tonumber(stop,16) or tonumber(stop)
+ start = tonumber(start,16) or tonumber(start)
+ stop = tonumber(stop, 16) or tonumber(stop)
if start and stop then
return start, stop, nil
end
diff --git a/tex/context/base/mkiv/cldf-ini.lua b/tex/context/base/mkiv/cldf-ini.lua
index da7f94922..943e7e7c1 100644
--- a/tex/context/base/mkiv/cldf-ini.lua
+++ b/tex/context/base/mkiv/cldf-ini.lua
@@ -116,22 +116,11 @@ local report_cld = logs.reporter("cld","stack")
local processlines = true -- experiments.register("context.processlines", function(v) processlines = v end)
-local tokenflushmode = false
-local nodeflushmode = false
-local scannerdefmode = false
+local tokenflushmode = true
+local nodeflushmode = true
+local scannerdefmode = true
local maxflushnodeindex = 0x10FFFF - 1
-if LUATEXFUNCTIONALITY > 6780 then
-
- -- The gain in performance is neglectable.
-
- tokenflushmode = true
- nodeflushmode = true
- scannerdefmode = true
- maxflushnodeindex = token.biggest_char() - 1
-
-end
-
-- tokenflushmode = false
-- scannerdefmode = false
-- nodeflushmode = false
@@ -710,15 +699,12 @@ local s_cldl_option_b = "[\\cldl"
local s_cldl_option_f = "[\\cldl" -- add space (not needed)
local s_cldl_option_e = "]"
local s_cldl_option_s = "\\cldl"
-local s_cldl_option_d = "\\cldd"
+----- s_cldl_option_d = "\\cldd"
+local s_cldl_option_d = s_cldl_option_s
local s_cldl_argument_b = "{\\cldl"
local s_cldl_argument_f = "{\\cldl "
local s_cldl_argument_e = "}"
-if LUATEXFUNCTIONALITY < 6898 then
- s_cldl_option_d = s_cldl_option_s
-end
-
-- local s_cldl_option_b = "["
-- local s_cldl_option_f = "" -- add space (not needed)
-- local s_cldl_option_s = ""
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index ae85906d2..6f8f6c2a7 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2018.08.30 18:41}
+\newcontextversion{2018.09.01 23:10}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 51a644104..24f2cb13d 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -42,7 +42,7 @@
%D has to match \type {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2018.08.30 18:41}
+\edef\contextversion{2018.09.01 23:10}
\edef\contextkind {beta}
%D For those who want to use this:
@@ -77,8 +77,8 @@
%D We just quit if new functionality is expected.
-\ifnum\luatexversion<107 % also change message
- \writestatus{!!!!}{Your luatex binary is too old, you need at least version 1.07!}
+\ifnum\luatexversion<108 % also change message
+ \writestatus{!!!!}{Your luatex binary is too old, you need at least version 1.08!}
\expandafter\end
\fi
diff --git a/tex/context/base/mkiv/font-col.lua b/tex/context/base/mkiv/font-col.lua
index 6d35a8e35..0af6f3188 100644
--- a/tex/context/base/mkiv/font-col.lua
+++ b/tex/context/base/mkiv/font-col.lua
@@ -58,6 +58,7 @@ local fontdata = hashes.identifiers
local fontquads = hashes.quads
local chardata = hashes.characters
local propdata = hashes.properties
+local mathparameters = hashes.mathparameters
local currentfont = font.current
local addcharacters = font.addcharacters
@@ -68,6 +69,15 @@ local list = { }
local current = 0
local enabled = false
+local validvectors = table.setmetatableindex(function(t,k)
+ local v = false
+ if not mathparameters[k] then
+ v = vectors[k]
+ end
+ t[k] = v
+ return v
+end)
+
local function checkenabled()
-- a bit ugly but nicer than a fuzzy state while defining math
if next(vectors) then
@@ -112,6 +122,18 @@ function collections.define(name,font,ranges,details)
end
details = settings_to_hash(details)
-- todo, combine per font start/stop as arrays
+ local offset = details.offset
+ if type(offset) == "string" then
+ local start = characters.getrange(offset,true)
+ offset = start or false
+ else
+ offset = tonumber(offset) or false
+ end
+ local rscale = tonumber (details.rscale) or 1
+ local force = toboolean(details.force,true)
+ local check = toboolean(details.check,true)
+ local factor = tonumber(details.factor)
+ local features = details.features
for s in gmatch(ranges,"[^, ]+") do
local start, stop, description, gaps = characters.getrange(s,true)
if start and stop then
@@ -126,24 +148,17 @@ function collections.define(name,font,ranges,details)
end
end
end
- local offset = details.offset
- if type(offset) == "string" then
- local start = characters.getrange(offset,true)
- offset = start or false
- else
- offset = tonumber(offset) or false
- end
d[#d+1] = {
font = font,
start = start,
stop = stop,
gaps = gaps,
offset = offset,
- rscale = tonumber (details.rscale) or 1,
- force = toboolean(details.force,true),
- check = toboolean(details.check,true),
- factor = tonumber(details.factor),
- features = details.features,
+ rscale = rscale,
+ force = force,
+ check = check,
+ factor = factor,
+ features = features,
}
end
end
@@ -218,8 +233,11 @@ function collections.clonevector(name)
if trace_collecting then
report_fonts("activating collection %a for font %a",name,current)
end
- checkenabled()
statistics.stoptiming(fonts)
+ -- for WS: needs checking
+ if validvectors[current] then
+ checkenabled()
+ end
end
-- we already have this parser
@@ -310,11 +328,9 @@ local function monoslot(font,char,parent,factor)
end
function collections.process(head) -- this way we keep feature processing
- for n in nextchar, head do
- local font = getfont(n)
- local vector = vectors[font]
+ for n, char, font in nextchar, head do
+ local vector = validvectors[font]
if vector then
- local char = getchar(n)
local vect = vector[char]
if not vect then
-- keep it
@@ -345,44 +361,6 @@ function collections.process(head) -- this way we keep feature processing
return head
end
-if LUATEXVERSION >= 1.080 then
-
- function collections.process(head) -- this way we keep feature processing
- for n, char, font in nextchar, head do
- local vector = vectors[font]
- if vector then
- local vect = vector[char]
- if not vect then
- -- keep it
- elseif type(vect) == "table" then
- local newfont = vect[1]
- local newchar = vect[2]
- if trace_collecting then
- report_fonts("remapping character %C in font %a to character %C in font %a%s",
- char,font,newchar,newfont,not chardata[newfont][newchar] and " (missing)" or ""
- )
- end
- setfont(n,newfont,newchar)
- else
- local fakemono = vector.factor
- if trace_collecting then
- report_fonts("remapping font %a to %a for character %C%s",
- font,vect,char,not chardata[vect][char] and " (missing)" or ""
- )
- end
- if fakemono then
- setfont(n,vect,monoslot(vect,char,font,fakemono))
- else
- setfont(n,vect)
- end
- end
- end
- end
- return head
- end
-
-end
-
function collections.found(font,char) -- this way we keep feature processing
if not char then
font, char = currentfont(), font
diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua
index 82b6ae457..37ce96ee8 100644
--- a/tex/context/base/mkiv/font-ctx.lua
+++ b/tex/context/base/mkiv/font-ctx.lua
@@ -1453,15 +1453,15 @@ do -- else too many locals
-- characters[0x2007] = { width = characters[0x0030] and characters[0x0030].width or parameters.space } -- figure
-- characters[0x2008] = { width = characters[0x002E] and characters[0x002E].width or parameters.space } -- period
--
- local fallbacks = specification.fallbacks
+ local fallbacks = specification.fallbacks or ""
local mathsize = (mathsize == 1 or mathsize == 2 or mathsize == 3) and mathsize or nil -- can be unset so we test 1 2 3
- if fallbacks and fallbacks ~= "" and mathsize and not busy then
+ if fallbacks ~= "" and mathsize and not busy then
busy = true
-- We need this ugly hack in order to resolve fontnames (at the \TEX end). Originally
-- math was done in Lua after loading (plugged into aftercopying).
--
-- After tl 2017 I'll also do text fallbacks this way (although backups there are done
- -- in a completely different way.
+ -- in a completely different way.)
if trace_defining then
report_defining("defining %a, id %a, target %a, features %a / %a, fallbacks %a / %a, step %a",
name,id,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks,1)
diff --git a/tex/context/base/mkiv/font-hsh.lua b/tex/context/base/mkiv/font-hsh.lua
index 60a27c043..81059a5f9 100644
--- a/tex/context/base/mkiv/font-hsh.lua
+++ b/tex/context/base/mkiv/font-hsh.lua
@@ -18,48 +18,50 @@ fonts.hashes = hashes
-- todo: autoallocate ... just create on the fly .. use constructors.keys (problem: plurals)
-local identifiers = hashes.identifiers or allocate()
-local characters = hashes.characters or allocate() -- chardata
-local descriptions = hashes.descriptions or allocate()
-local parameters = hashes.parameters or allocate()
-local properties = hashes.properties or allocate()
-local resources = hashes.resources or allocate()
-local spacings = hashes.spacings or allocate()
-local spaces = hashes.spaces or allocate()
-local quads = hashes.quads or allocate() -- maybe also spacedata
-local xheights = hashes.xheights or allocate()
-local csnames = hashes.csnames or allocate() -- namedata
-local features = hashes.features or allocate()
-local marks = hashes.marks or allocate()
-local classes = hashes.classes or allocate()
-local italics = hashes.italics or allocate()
-local lastmathids = hashes.lastmathids or allocate()
-local dynamics = hashes.dynamics or allocate()
-local unicodes = hashes.unicodes or allocate()
-local originals = hashes.originals or allocate()
-local modes = hashes.modes or allocate()
-local variants = hashes.variants or allocate()
-
-hashes.characters = characters
-hashes.descriptions = descriptions
-hashes.parameters = parameters
-hashes.properties = properties
-hashes.resources = resources
-hashes.spacings = spacings
-hashes.spaces = spaces
-hashes.quads = quads hashes.emwidths = quads
-hashes.xheights = xheights hashes.exheights = xheights
-hashes.csnames = csnames
-hashes.features = features
-hashes.marks = marks
-hashes.classes = classes
-hashes.italics = italics
-hashes.lastmathids = lastmathids
-hashes.dynamics = dynamics
-hashes.unicodes = unicodes
-hashes.originals = originals
-hashes.modes = modes
-hashes.variants = variants
+local identifiers = hashes.identifiers or allocate()
+local characters = hashes.characters or allocate() -- chardata
+local descriptions = hashes.descriptions or allocate()
+local parameters = hashes.parameters or allocate()
+local mathparameters = hashes.mathparameters or allocate()
+local properties = hashes.properties or allocate()
+local resources = hashes.resources or allocate()
+local spacings = hashes.spacings or allocate()
+local spaces = hashes.spaces or allocate()
+local quads = hashes.quads or allocate() -- maybe also spacedata
+local xheights = hashes.xheights or allocate()
+local csnames = hashes.csnames or allocate() -- namedata
+local features = hashes.features or allocate()
+local marks = hashes.marks or allocate()
+local classes = hashes.classes or allocate()
+local italics = hashes.italics or allocate()
+local lastmathids = hashes.lastmathids or allocate()
+local dynamics = hashes.dynamics or allocate()
+local unicodes = hashes.unicodes or allocate()
+local originals = hashes.originals or allocate()
+local modes = hashes.modes or allocate()
+local variants = hashes.variants or allocate()
+
+hashes.characters = characters
+hashes.descriptions = descriptions
+hashes.parameters = parameters
+hashes.mathparameters = mathparameters
+hashes.properties = properties
+hashes.resources = resources
+hashes.spacings = spacings
+hashes.spaces = spaces
+hashes.quads = quads hashes.emwidths = quads
+hashes.xheights = xheights hashes.exheights = xheights
+hashes.csnames = csnames
+hashes.features = features
+hashes.marks = marks
+hashes.classes = classes
+hashes.italics = italics
+hashes.lastmathids = lastmathids
+hashes.dynamics = dynamics
+hashes.unicodes = unicodes
+hashes.originals = originals
+hashes.modes = modes
+hashes.variants = variants
local nodepool = nodes and nodes.pool
local dummyglyph = nodepool and nodepool.register(nodepool.glyph())
@@ -148,6 +150,16 @@ setmetatableindex(parameters, function(t,k)
end
end)
+setmetatableindex(mathparameters, function(t,k)
+ if k == true then
+ return mathparameters[currentfont()]
+ else
+ local mathparameters = identifiers[k].mathparameters
+ t[k] = mathparameters
+ return mathparameters
+ end
+end)
+
setmetatableindex(properties, function(t,k)
if k == true then
return properties[currentfont()]
diff --git a/tex/context/base/mkiv/font-imp-quality.lua b/tex/context/base/mkiv/font-imp-quality.lua
index 8da011cd7..52eed080c 100644
--- a/tex/context/base/mkiv/font-imp-quality.lua
+++ b/tex/context/base/mkiv/font-imp-quality.lua
@@ -340,11 +340,15 @@ local function map_opbd_onto_protrusion(tfmdata,value,opbd)
local coverage = step.coverage
if coverage then
for k, v in next, coverage do
- -- local p = - v[3] / descriptions[k].width-- or 1 ~= 0 too but the same
- local p = - (v[1] / 1000) * factor * left
- characters[k].left_protruding = p
- if trace_protrusion then
- report_protrusions("lfbd -> %C -> %p",k,p)
+ if v == true then
+ -- zero
+ else
+ -- local p = - v[3] / descriptions[k].width-- or 1 ~= 0 too but the same
+ local p = - (v[1] / 1000) * factor * left
+ characters[k].left_protruding = p
+ if trace_protrusion then
+ report_protrusions("lfbd -> %C -> %p",k,p)
+ end
end
end
end
@@ -369,11 +373,15 @@ local function map_opbd_onto_protrusion(tfmdata,value,opbd)
local coverage = step.coverage
if coverage then
for k, v in next, coverage do
- -- local p = v[3] / descriptions[k].width -- or 3
- local p = (v[1] / 1000) * factor * right
- characters[k].right_protruding = p
- if trace_protrusion then
- report_protrusions("rtbd -> %C -> %p",k,p)
+ if v == true then
+ -- zero
+ else
+ -- local p = v[3] / descriptions[k].width -- or 3
+ local p = (v[1] / 1000) * factor * right
+ characters[k].right_protruding = p
+ if trace_protrusion then
+ report_protrusions("rtbd -> %C -> %p",k,p)
+ end
end
end
end
diff --git a/tex/context/base/mkiv/font-ocl.lua b/tex/context/base/mkiv/font-ocl.lua
index fc9953d88..f97487ecd 100644
--- a/tex/context/base/mkiv/font-ocl.lua
+++ b/tex/context/base/mkiv/font-ocl.lua
@@ -134,7 +134,7 @@ local start = { "pdf", "mode", "font" } -- force text mode (so get q Q right)
local push = { "pdf", "page", "q" }
local pop = { "pdf", "page", "Q" }
-if not LUATEXFUNCTIONALITY or LUATEXFUNCTIONALITY < 6472 then
+if not LUATEXFUNCTIONALITY or LUATEXFUNCTIONALITY < 6472 then -- for outside context (till tl 2019)
start = { "nop" }
----- = stop
end
diff --git a/tex/context/base/mkiv/good-ctx.lua b/tex/context/base/mkiv/good-ctx.lua
index 5b6a02d09..b7dd15fb8 100644
--- a/tex/context/base/mkiv/good-ctx.lua
+++ b/tex/context/base/mkiv/good-ctx.lua
@@ -147,10 +147,9 @@ function colorschemes.coloring(head)
local lastattr = nil
local lastcache = nil
local lastscheme = nil
- for n in nextglyph, head do
+ for n, f, char in nextglyph, head do
local a = getattr(n,a_colorscheme)
if a then
- local f = getfont(n)
if f ~= lastfont then
lastfont = f
lastscheme = fontproperties[f].colorscheme
@@ -160,7 +159,7 @@ function colorschemes.coloring(head)
lastcache = cache[a]
end
if lastscheme then
- local sc = lastscheme[getchar(n)]
+ local sc = lastscheme[char]
if sc then
setnodecolor(n,lastcache[sc]) -- we could inline this one
end
@@ -170,37 +169,6 @@ function colorschemes.coloring(head)
return head
end
-if LUATEXVERSION >= 1.080 then
-
- function colorschemes.coloring(head)
- local lastfont = nil
- local lastattr = nil
- local lastcache = nil
- local lastscheme = nil
- for n, f, char in nextglyph, head do
- local a = getattr(n,a_colorscheme)
- if a then
- if f ~= lastfont then
- lastfont = f
- lastscheme = fontproperties[f].colorscheme
- end
- if a ~= lastattr then
- lastattr = a
- lastcache = cache[a]
- end
- if lastscheme then
- local sc = lastscheme[char]
- if sc then
- setnodecolor(n,lastcache[sc]) -- we could inline this one
- end
- end
- end
- end
- return head
- end
-
-end
-
function colorschemes.enable()
nodes.tasks.enableaction("processors","fonts.goodies.colorschemes.coloring")
function colorschemes.enable() end
diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua
index c28764856..e9d3170af 100644
--- a/tex/context/base/mkiv/grph-inc.lua
+++ b/tex/context/base/mkiv/grph-inc.lua
@@ -1402,11 +1402,6 @@ function checkers.generic(data)
resolution,
arguments
)
- -- for now:
- if LUATEXFUNCTIONALITY <= 6802 then
- userpassword = nil
- ownerpassword = nil
- end
--
local figure = figures_loaded[hash]
if figure == nil then
diff --git a/tex/context/base/mkiv/l-package.lua b/tex/context/base/mkiv/l-package.lua
index 4faee76bf..0dd71e5ec 100644
--- a/tex/context/base/mkiv/l-package.lua
+++ b/tex/context/base/mkiv/l-package.lua
@@ -394,3 +394,7 @@ end
-- front ..
table.insert(searchers,1,helpers.loaded)
+
+if context then
+ package.path = ""
+end
diff --git a/tex/context/base/mkiv/luat-run.lua b/tex/context/base/mkiv/luat-run.lua
index 139e54338..3856575a9 100644
--- a/tex/context/base/mkiv/luat-run.lua
+++ b/tex/context/base/mkiv/luat-run.lua
@@ -134,12 +134,8 @@ callbacks.register('process_output_buffer', false, "actions perf
callbacks.register("pre_dump", pre_dump_actions, "lua related finalizers called before we dump the format") -- comes after \everydump
-if LUATEXFUNCTIONALITY > 6505 then
- callbacks.register("finish_synctex", wrapup_synctex, "rename temporary synctex file")
- callbacks.register('wrapup_run', false, "actions performed after closing files")
-else
- callbacks.register("finish_synctex_callback", wrapup_synctex, "rename temporary synctex file")
-end
+callbacks.register("finish_synctex", wrapup_synctex, "rename temporary synctex file")
+callbacks.register('wrapup_run', false, "actions performed after closing files")
-- temp hack for testing:
diff --git a/tex/context/base/mkiv/luat-sto.lua b/tex/context/base/mkiv/luat-sto.lua
index e67830b0d..ce891765a 100644
--- a/tex/context/base/mkiv/luat-sto.lua
+++ b/tex/context/base/mkiv/luat-sto.lua
@@ -78,7 +78,7 @@ if environment.initex then
dumped = concat({ definition, comment, dumped },"\n")
local code = nil
local name = formatters["slot %s (%s)"](max,name)
- if LUAVERSION >= 5.3 and LUATEXFUNCTIONALITY >= 6454 then
+ if LUAVERSION >= 5.3 then
local code = loadstring(dumped,name)
setbytecode(max,code,strip)
else
diff --git a/tex/context/base/mkiv/m-fonts-plugins.mkiv b/tex/context/base/mkiv/m-fonts-plugins.mkiv
index b74b8c3d0..154e47804 100644
--- a/tex/context/base/mkiv/m-fonts-plugins.mkiv
+++ b/tex/context/base/mkiv/m-fonts-plugins.mkiv
@@ -186,6 +186,7 @@
\definefontfeature
[arabic-node]
[arabic]
+ [salt=yes] % seems to be needed for husayni
\definefontfeature
[arabic-native]
@@ -224,7 +225,7 @@
\getbuffer[#5-definitions]
\showfontkerns
\showmakeup[discretionary]
- \enabletrackers[fonts.plugins.hb.colors]%
+ % \enabletrackers[fonts.plugins.hb.colors]%
\testfeatureonce{1}{
\getbuffer[#5-text]
}
@@ -263,7 +264,7 @@
\title{#1 #3 #4}
\start
\getbuffer[#5-definitions]
- \enabletrackers[fonts.plugins.hb.colors]%
+ % \enabletrackers[fonts.plugins.hb.colors]%
\testfeatureonce{1}{
\setupalign[flushleft] % easier to compare
\getbuffer[#5-text]
diff --git a/tex/context/base/mkiv/math-act.lua b/tex/context/base/mkiv/math-act.lua
index a847b78c6..07ef32746 100644
--- a/tex/context/base/mkiv/math-act.lua
+++ b/tex/context/base/mkiv/math-act.lua
@@ -738,9 +738,9 @@ function mathematics.finishfallbacks(target,specification,fallbacks)
done[unic] = true
end
end
+ local step = offset - start
for unicode = start, stop do
- local unic = unicode + offset - start
- remap(unic,unicode,false)
+ remap(unicode + step,unicode,false)
end
if gaps then
for unic, unicode in next, gaps do
diff --git a/tex/context/base/mkiv/math-ini.mkiv b/tex/context/base/mkiv/math-ini.mkiv
index e84d6efaa..94d26fce7 100644
--- a/tex/context/base/mkiv/math-ini.mkiv
+++ b/tex/context/base/mkiv/math-ini.mkiv
@@ -753,7 +753,6 @@
{\ifmmode\normalmbox\else\normalhbox\fi}
\unexpanded\def\enablembox
- %{\appendtoks\math_enable_mbox\to \everymathematics}
{\toksapp\everymathematics{\math_enable_mbox}}
\def\math_enable_mbox
diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua
index 0e502505d..15d9bd0f1 100644
--- a/tex/context/base/mkiv/math-noa.lua
+++ b/tex/context/base/mkiv/math-noa.lua
@@ -786,19 +786,15 @@ do
if id > 0 then
local data = fontdata[id]
local char = mathematics.big(data,chr,size,method)
- local ht = getfield(pointer,"height")
- -- local ht = getheight(pointer) -- LUATEXVERSION >= 1.080
- local dp = getfield(pointer,"depth")
- -- local dp = getdepth(pointer) -- LUATEXVERSION >= 1.080
+ local ht = getheight(pointer)
+ local dp = getdepth(pointer)
if ht == 1 or dp == 1 then -- 1 scaled point is a signal
local chardata = data.characters[char]
if ht == 1 then
- setfield(pointer,"height",chardata.height)
- -- setheight(pointer,chardata.height) -- LUATEXVERSION >= 1.080
+ setheight(pointer,chardata.height)
end
if dp == 1 then
- setfield(pointer,"depth",chardata.depth)
- -- setdepth(pointer,chardata.depth) -- LUATEXVERSION >= 1.080
+ setdepth(pointer,chardata.depth)
end
end
if trace_fences then
diff --git a/tex/context/base/mkiv/math-vfu.lua b/tex/context/base/mkiv/math-vfu.lua
index 338a4bef7..95f33285e 100644
--- a/tex/context/base/mkiv/math-vfu.lua
+++ b/tex/context/base/mkiv/math-vfu.lua
@@ -618,6 +618,10 @@ setmetatableindex(reverse, function(t,name)
return r
end)
+-- use char and font hash
+--
+-- commands = { { "font", slot }, { "char", unicode } },
+
local function copy_glyph(main,target,original,unicode,slot)
local addprivate = fonts.helpers.addprivate
local olddata = original[unicode]
diff --git a/tex/context/base/mkiv/meta-ini.mkiv b/tex/context/base/mkiv/meta-ini.mkiv
index 2c7576c32..e0aba5fc0 100644
--- a/tex/context/base/mkiv/meta-ini.mkiv
+++ b/tex/context/base/mkiv/meta-ini.mkiv
@@ -97,7 +97,7 @@
\ifx\currentMPinstance\empty
\let\currentMPinstance\defaultMPinstance
\fi
- \global\t_meta_definitions\expandafter{\the\t_meta_definitions#2}%
+ \gtoksapp\t_meta_definitions{#2}%
\let\currentMPinstance\m_meta_saved_instance}
\let\stopMPdefinitions\relax
@@ -111,7 +111,7 @@
\let\stopMPextensions\relax
\unexpanded\def\startMPinitializations#1\stopMPinitializations % for all instances, when enabled
- {\global\t_meta_initializations\expandafter{\the\t_meta_initializations#1}}
+ {\gtoksapp\t_meta_initializations{#1}}
\let\stopMPinitializations\relax
@@ -131,7 +131,7 @@
\ifx\m_meta_option\!!plustoken \else
\global\t_meta_inclusions\emptytoks
\fi
- \global\t_meta_inclusions\expandafter{\the\t_meta_inclusions#2}%
+ \gtoksapp\t_meta_inclusions{#2}%
\let\currentMPinstance\m_meta_saved_instance}
\let\stopMPinclusions\relax
@@ -152,7 +152,7 @@
\ifx\m_meta_option\!!plustoken \else
\global\t_meta_inclusions\emptytoks
\fi
- \global\t_meta_inclusions\expandafter{\the\t_meta_inclusions#2}%
+ \gtoksapp\t_meta_inclusions{#2}%
\let\currentMPinstance\m_meta_saved_instance}
\installcommandhandler \??mpinstance {MPinstance} \??mpinstance
diff --git a/tex/context/base/mkiv/mlib-pps.lua b/tex/context/base/mkiv/mlib-pps.lua
index 03f712fbc..874492d68 100644
--- a/tex/context/base/mkiv/mlib-pps.lua
+++ b/tex/context/base/mkiv/mlib-pps.lua
@@ -1126,6 +1126,7 @@ local tx_reset, tx_analyze, tx_process do
if trace_btexetex then
report_metapost("handling btex ... etex: [[%s]]",s)
end
+ -- madetext = utilities.strings.collapse(s)
madetext = s
return "rawmadetext"
end
diff --git a/tex/context/base/mkiv/mlib-run.lua b/tex/context/base/mkiv/mlib-run.lua
index e1c9a9929..d032d291c 100644
--- a/tex/context/base/mkiv/mlib-run.lua
+++ b/tex/context/base/mkiv/mlib-run.lua
@@ -308,7 +308,7 @@ local function prepareddata(data,collapse)
end
end
-metapost.use_one_pass = LUATEXFUNCTIONALITY >= 6789 -- for a while
+metapost.use_one_pass = true -- Some day I will priune the code (still testing).
metapost.defaultformat = "metafun"
metapost.defaultinstance = "metafun"
diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua
index 8496980aa..b2a4cec69 100644
--- a/tex/context/base/mkiv/mult-low.lua
+++ b/tex/context/base/mkiv/mult-low.lua
@@ -60,6 +60,7 @@ return {
"spaceasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode",
"colonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode",
"leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode",
+ "leftparentasciicode", "rightparentasciicode",
"lessthanasciicode", "morethanasciicode", "doublecommentsignal",
"atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode",
"doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode",
diff --git a/tex/context/base/mkiv/node-bck.lua b/tex/context/base/mkiv/node-bck.lua
index bfc550c81..a378f0476 100644
--- a/tex/context/base/mkiv/node-bck.lua
+++ b/tex/context/base/mkiv/node-bck.lua
@@ -143,21 +143,18 @@ local enabled = false
local alignments = false
local function add_alignbackgrounds(head,list)
- for current in nexthlist, list do
- if getsubtype(current) == cell_code then
- local list = getlist(current)
- if list then
- for template in nexthlist, list do
- local background = getattr(template,a_alignbackground)
- if background then
- local list = colored_a(current,list,template)
- if list then
- setlist(current,list)
- end
- setattr(template,a_alignbackground,unsetvalue) -- or property
+ for current, id, subtype, list in nextlist, list do
+ if list and id == hlist_code and subtype == cell_code then
+ for template in nexthlist, list do
+ local background = getattr(template,a_alignbackground)
+ if background then
+ local list = colored_a(current,list,template)
+ if list then
+ setlist(current,list)
end
- break
+ setattr(template,a_alignbackground,unsetvalue) -- or property
end
+ break
end
end
end
@@ -172,23 +169,20 @@ end
local function add_backgrounds(head,id,list)
if list then
- for current, id, subtype in nextnode, list do
- if id == hlist_code or id == vlist_code then
- local list = getlist(current)
- if list then
- if alignments and subtype == alignment_code then
- local l = add_alignbackgrounds(current,list)
- if l then
- list = l
- setlist(current,list)
- end
- end
- local l = add_backgrounds(current,id,list)
+ for current, id, subtype, list in nextlist, list do
+ if list then
+ if alignments and subtype == alignment_code then
+ local l = add_alignbackgrounds(current,list)
if l then
list = l
- setlist(current,l)
+ setlist(current,list)
end
end
+ local l = add_backgrounds(current,id,list)
+ if l then
+ list = l
+ setlist(current,l)
+ end
end
end
end
@@ -203,67 +197,6 @@ local function add_backgrounds(head,id,list)
end
end
-if LUATEXVERSION >= 1.080 then
-
- -- local function add_alignbackgrounds(head,list)
- add_alignbackgrounds = function(head,list)
- for current, id, subtype, list in nextlist, list do
- if list and id == hlist_code and subtype == cell_code then
- for template in nexthlist, list do
- local background = getattr(template,a_alignbackground)
- if background then
- local list = colored_a(current,list,template)
- if list then
- setlist(current,list)
- end
- setattr(template,a_alignbackground,unsetvalue) -- or property
- end
- break
- end
- end
- end
- local template = getprop(head,"alignmentchecked")
- if template then
- list = colored_b(head,list,template[1],hlist_code,template[2])
- flush_node_list(template)
- templates[currentrow] = false
- return list
- end
- end
-
- -- local function add_backgrounds(head,id,list)
- add_backgrounds = function(head,id,list)
- if list then
- for current, id, subtype, list in nextlist, list do
- if list then
- if alignments and subtype == alignment_code then
- local l = add_alignbackgrounds(current,list)
- if l then
- list = l
- setlist(current,list)
- end
- end
- local l = add_backgrounds(current,id,list)
- if l then
- list = l
- setlist(current,l)
- end
- end
- end
- end
- if id == hlist_code or id == vlist_code then
- local background = getattr(head,a_background)
- if background then
- list = colored_a(head,list,head,id)
- -- not needed
- setattr(head,a_background,unsetvalue) -- or property
- return list
- end
- end
- end
-
-end
-
function nodes.handlers.backgrounds(head)
add_backgrounds(head,getid(head),getlist(head))
return head
diff --git a/tex/context/base/mkiv/node-fnt.lua b/tex/context/base/mkiv/node-fnt.lua
index 4c46c7942..6c77ea1ff 100644
--- a/tex/context/base/mkiv/node-fnt.lua
+++ b/tex/context/base/mkiv/node-fnt.lua
@@ -203,31 +203,23 @@ local function stop_trace(u,usedfonts,a,attrfonts,b,basefonts,r,redundant,e,expa
report_fonts()
end
-function handlers.characters(head,groupcode,size,packtype,direction)
- -- either next or not, but definitely no already processed list
- starttiming(nodes)
-
- local usedfonts = { }
- local attrfonts = { }
- local basefonts = { }
- local basefont = nil
- local prevfont = nil
- local prevattr = 0
- local variants = nil
- local redundant = nil
- local firstnone = nil
- local lastfont = nil
- local lastproc = nil
- local lastnone = nil
-
- local a, u, b, r, e = 0, 0, 0, 0, 0
-
- if trace_fontrun then
- start_trace(head)
- end
- -- There is no gain in checking for a single glyph and then having a fast path. On the
- -- metafun manual (with some 2500 single char lists) the difference is just noise.
+do
+
+ local usedfonts
+ local attrfonts
+ local basefonts
+ local basefont
+ local prevfont
+ local prevattr
+ local variants
+ local redundant
+ local firstnone
+ local lastfont
+ local lastproc
+ local lastnone
+
+ local a, u, b, r, e
local function protectnone()
protect_glyphs(firstnone,lastnone)
@@ -262,7 +254,7 @@ function handlers.characters(head,groupcode,size,packtype,direction)
end
end
- local function setnode(n,font,attr) -- we could use prevfont and prevattr when we set them first
+ local function setnode(n,font,attr) -- we could use prevfont and prevattr when we set then first
if firstnone then
protectnone()
end
@@ -296,632 +288,287 @@ function handlers.characters(head,groupcode,size,packtype,direction)
end
end
- for n in nextchar, head do
- local font = getfont(n)
- -- local attr = (none and prevattr) or getattr(n,0) or 0 -- zero attribute is reserved for fonts in context
- local attr = getattr(n,0) or 0 -- zero attribute is reserved for fonts in context
- if font ~= prevfont or attr ~= prevattr then
- prevfont = font
- prevattr = attr
- variants = fontvariants[font]
- local fontmode = fontmodes[font]
- if fontmode == "none" then
- setnone(n)
- elseif fontmode == "base" then
- setbase(n)
- else
- setnode(n,font,attr)
- end
- elseif firstnone then
- lastnone = n
+ function handlers.characters(head,groupcode,size,packtype,direction)
+ -- either next or not, but definitely no already processed list
+ starttiming(nodes)
+
+ usedfonts = { }
+ attrfonts = { }
+ basefonts = { }
+ basefont = nil
+ prevfont = nil
+ prevattr = 0
+ variants = nil
+ redundant = nil
+ firstnone = nil
+ lastfont = nil
+ lastproc = nil
+ lastnone = nil
+
+ a, u, b, r, e = 0, 0, 0, 0, 0
+
+ if trace_fontrun then
+ start_trace(head)
end
- if variants then
- local char = getchar(n)
- if char >= 0xFE00 and (char <= 0xFE0F or (char >= 0xE0100 and char <= 0xE01EF)) then
- local hash = variants[char]
- if hash then
- local p = getprev(n)
- if p then
- local char = ischar(p) -- checked
- local variant = hash[char]
- if variant then
- if trace_variants then
- report_fonts("replacing %C by %C",char,variant)
- end
- setchar(p,variant)
- if redundant then
- r = r + 1
- redundant[r] = n
- else
- r = 1
- redundant = { n }
+
+ -- There is no gain in checking for a single glyph and then having a fast path. On the
+ -- metafun manual (with some 2500 single char lists) the difference is just noise.
+
+ for n, char, font in nextchar, head do
+ -- local attr = (none and prevattr) or getattr(n,0) or 0 -- zero attribute is reserved for fonts in context
+ local attr = getattr(n) or 0 -- zero attribute is reserved for fonts in context
+ if font ~= prevfont or attr ~= prevattr then
+ prevfont = font
+ prevattr = attr
+ variants = fontvariants[font]
+ local fontmode = fontmodes[font]
+ if fontmode == "none" then
+ setnone(n)
+ elseif fontmode == "base" then
+ setbase(n)
+ else
+ setnode(n,font,attr)
+ end
+ elseif firstnone then
+ lastnone = n
+ end
+ if variants then
+ if (char >= 0xFE00 and char <= 0xFE0F) or (char >= 0xE0100 and char <= 0xE01EF) then
+ local hash = variants[char]
+ if hash then
+ local p = getprev(n)
+ if p then
+ local char = ischar(p) -- checked
+ local variant = hash[char]
+ if variant then
+ if trace_variants then
+ report_fonts("replacing %C by %C",char,variant)
+ end
+ setchar(p,variant)
+ if redundant then
+ r = r + 1
+ redundant[r] = n
+ else
+ r = 1
+ redundant = { n }
+ end
end
end
+ elseif keep_redundant then
+ -- go on, can be used for tracing
+ elseif redundant then
+ r = r + 1
+ redundant[r] = n
+ else
+ r = 1
+ redundant = { n }
end
- elseif keep_redundant then
- -- go on, can be used for tracing
- elseif redundant then
- r = r + 1
- redundant[r] = n
- else
- r = 1
- redundant = { n }
end
end
end
- end
- if firstnone then
- protectnone()
- end
+ if firstnone then
+ protectnone()
+ end
- if force_boundaryrun then
+ if force_boundaryrun then
- -- we can inject wordboundaries and then let the hyphenator do its work
- -- but we need to get rid of those nodes in order to build ligatures
- -- and kern (a rather context thing)
+ -- we can inject wordboundaries and then let the hyphenator do its work
+ -- but we need to get rid of those nodes in order to build ligatures
+ -- and kern (a rather context thing)
- for b in nextboundary, head do
- if getsubtype(b) == word_boundary then
- if redundant then
- r = r + 1
- redundant[r] = b
- else
- r = 1
- redundant = { b }
+ for b, subtype in nextboundary, head do
+ if subtype == word_boundary then
+ if redundant then
+ r = r + 1
+ redundant[r] = b
+ else
+ r = 1
+ redundant = { b }
+ end
end
end
- end
- end
+ end
- if redundant then
- for i=1,r do
- local r = redundant[i]
- local p, n = getboth(r)
- if r == head then
- head = n
- setprev(n)
- else
- setlink(p,n)
- end
- if b > 0 then
- for i=1,b do
- local bi = basefonts[i]
- local b1 = bi[1]
- local b2 = bi[2]
- if b1 == b2 then
- if b1 == r then
- bi[1] = false
- bi[2] = false
+ if redundant then
+ for i=1,r do
+ local r = redundant[i]
+ local p, n = getboth(r)
+ if r == head then
+ head = n
+ setprev(n)
+ else
+ setlink(p,n)
+ end
+ if b > 0 then
+ for i=1,b do
+ local bi = basefonts[i]
+ local b1 = bi[1]
+ local b2 = bi[2]
+ if b1 == b2 then
+ if b1 == r then
+ bi[1] = false
+ bi[2] = false
+ end
+ elseif b1 == r then
+ bi[1] = n
+ elseif b2 == r then
+ bi[2] = p
end
- elseif b1 == r then
- bi[1] = n
- elseif b2 == r then
- bi[2] = p
end
end
+ flush_node(r)
end
- flush_node(r)
end
- end
- if force_discrun then
-
- -- basefont is not supported in disc only runs ... it would mean a lot of
- -- ranges .. we could try to run basemode as a separate processor run but
- -- not for now (we can consider it when the new node code is tested
- for d in nextdisc, head do
- -- we could use first_glyph, only doing replace is good enough because
- -- pre and post are normally used for hyphens and these come from fonts
- -- that part of the hyphenated word
- local _, _, r = getdisc(d)
- if r then
- local prevfont = nil
- local prevattr = nil
- local none = false
- for n in nextchar, r do
- local font = getfont(n)
- local attr = getattr(n,0) or 0 -- zero attribute is reserved for fonts in context
- if font ~= prevfont or attr ~= prevattr then
- prevfont = font
- prevattr = attr
- local fontmode = fontmodes[font]
- if fontmode == "none" then
- setnone(n)
- elseif fontmode == "base" then
- setbase(n)
- else
- setnode(n,font,attr)
+ if force_discrun then
+
+ -- basefont is not supported in disc only runs ... it would mean a lot of
+ -- ranges .. we could try to run basemode as a separate processor run but
+ -- not for now (we can consider it when the new node code is tested
+ for d in nextdisc, head do
+ -- we could use first_glyph, only doing replace is good enough because
+ -- pre and post are normally used for hyphens and these come from fonts
+ -- that part of the hyphenated word
+ local _, _, r = getdisc(d)
+ if r then
+ local prevfont = nil
+ local prevattr = nil
+ local none = false
+ for n, char, font in nextchar, r do
+ local attr = getattr(n) or 0 -- zero attribute is reserved for fonts in context
+ if font ~= prevfont or attr ~= prevattr then
+ prevfont = font
+ prevattr = attr
+ local fontmode = fontmodes[font]
+ if fontmode == "none" then
+ setnone(n)
+ elseif fontmode == "base" then
+ setbase(n)
+ else
+ setnode(n,font,attr)
+ end
+ elseif firstnone then
+ -- lastnone = n
+ lastnone = nil
end
- elseif firstnone then
- -- lastnone = n
- lastnone = nil
+ -- we assume one font for now (and if there are more and we get into issues then
+ -- we can always remove the break)
+ break
end
- -- we assume one font for now (and if there are more and we get into issues then
- -- we can always remove the break)
- break
- end
- if firstnone then
- protectnone()
+ if firstnone then
+ protectnone()
+ end
+ -- elseif expanders then
+ -- local subtype = getsubtype(d)
+ -- if subtype == automatic_code or subtype == explicit_code then
+ -- expanders[subtype](d)
+ -- e = e + 1
+ -- end
end
- -- elseif expanders then
- -- local subtype = getsubtype(d)
- -- if subtype == automatic_code or subtype == explicit_code then
- -- expanders[subtype](d)
- -- e = e + 1
- -- end
end
- end
-
- end
- if trace_fontrun then
- stop_trace(u,usedfonts,a,attrfonts,b,basefonts,r,redundant,e,expanders)
- end
+ end
- -- in context we always have at least 2 processors
- if u == 0 then
- -- skip
- elseif u == 1 then
- local attr = a > 0 and 0 or false -- 0 is the savest way
- for i=1,#lastproc do
- head = lastproc[i](head,lastfont,attr,direction)
+ if trace_fontrun then
+ stop_trace(u,usedfonts,a,attrfonts,b,basefonts,r,redundant,e,expanders)
end
- else
- -- local attr = a == 0 and false or 0 -- 0 is the savest way
- local attr = a > 0 and 0 or false -- 0 is the savest way
- for font, processors in next, usedfonts do -- unordered
- for i=1,#processors do
- head = processors[i](head,font,attr,direction,u)
+
+ -- in context we always have at least 2 processors
+ if u == 0 then
+ -- skip
+ elseif u == 1 then
+ local attr = a > 0 and 0 or false -- 0 is the savest way
+ for i=1,#lastproc do
+ head = lastproc[i](head,lastfont,attr,direction)
end
- end
- end
- if a == 0 then
- -- skip
- elseif a == 1 then
- local font, dynamics = next(attrfonts)
- for attribute, processors in next, dynamics do -- unordered, attr can switch in between
- for i=1,#processors do
- head = processors[i](head,font,attribute,direction)
+ else
+ -- local attr = a == 0 and false or 0 -- 0 is the savest way
+ local attr = a > 0 and 0 or false -- 0 is the savest way
+ for font, processors in next, usedfonts do -- unordered
+ for i=1,#processors do
+ head = processors[i](head,font,attr,direction,u)
+ end
end
end
- else
- for font, dynamics in next, attrfonts do
+ if a == 0 then
+ -- skip
+ elseif a == 1 then
+ local font, dynamics = next(attrfonts)
for attribute, processors in next, dynamics do -- unordered, attr can switch in between
for i=1,#processors do
- head = processors[i](head,font,attribute,direction,a)
+ head = processors[i](head,font,attribute,direction)
end
end
- end
- end
- if b == 0 then
- -- skip
- elseif b == 1 then
- -- only one font
- local range = basefonts[1]
- local start = range[1]
- local stop = range[2]
- if (start or stop) and (start ~= stop) then
- local front = head == start
- if stop then
- start = ligaturing(start,stop)
- start = kerning(start,stop)
- elseif start then -- safeguard
- start = ligaturing(start)
- start = kerning(start)
- end
- if front and head ~= start then
- head = start
+ else
+ for font, dynamics in next, attrfonts do
+ for attribute, processors in next, dynamics do -- unordered, attr can switch in between
+ for i=1,#processors do
+ head = processors[i](head,font,attribute,direction,a)
+ end
+ end
end
end
- else
- -- multiple fonts
- for i=1,b do
- local range = basefonts[i]
+ if b == 0 then
+ -- skip
+ elseif b == 1 then
+ -- only one font
+ local range = basefonts[1]
local start = range[1]
local stop = range[2]
- if start then -- and start ~= stop but that seldom happens
+ if (start or stop) and (start ~= stop) then
local front = head == start
- local prev = getprev(start)
- local next = getnext(stop)
if stop then
- start, stop = ligaturing(start,stop)
- start, stop = kerning(start,stop)
- else
+ start = ligaturing(start,stop)
+ start = kerning(start,stop)
+ elseif start then -- safeguard
start = ligaturing(start)
start = kerning(start)
end
- -- is done automatically
- if prev then
- setlink(prev,start)
- end
- if next then
- setlink(stop,next)
- end
- -- till here
if front and head ~= start then
head = start
end
end
- end
- end
- stoptiming(nodes)
- if trace_characters then
- nodes.report(head)
- end
- return head
-end
-
-if LUATEXVERSION >= 1.080 then
-
- do
-
- local usedfonts
- local attrfonts
- local basefonts
- local basefont
- local prevfont
- local prevattr
- local variants
- local redundant
- local firstnone
- local lastfont
- local lastproc
- local lastnone
-
- local a, u, b, r, e
-
- local function protectnone()
- protect_glyphs(firstnone,lastnone)
- firstnone = nil
- end
-
- local function setnone(n)
- if firstnone then
- protectnone()
- end
- if basefont then
- basefont[2] = getprev(n)
- basefont = false
- end
- if not firstnone then
- firstnone = n
- end
- lastnone = n
- end
-
- local function setbase(n)
- if firstnone then
- protectnone()
- end
- if force_basepass then
- if basefont then
- basefont[2] = getprev(n)
- end
- b = b + 1
- basefont = { n, false }
- basefonts[b] = basefont
- end
- end
-
- local function setnode(n,font,attr) -- we could use prevfont and prevattr when we set then first
- if firstnone then
- protectnone()
- end
- if basefont then
- basefont[2] = getprev(n)
- basefont = false
- end
- if attr > 0 then
- local used = attrfonts[font]
- if not used then
- used = { }
- attrfonts[font] = used
- end
- if not used[attr] then
- local fd = setfontdynamics[font]
- if fd then
- used[attr] = fd[attr]
- a = a + 1
- end
- end
- else
- local used = usedfonts[font]
- if not used then
- lastfont = font
- lastproc = fontprocesses[font]
- if lastproc then
- usedfonts[font] = lastproc
- u = u + 1
- end
- end
- end
- end
-
- function handlers.characters(head,groupcode,size,packtype,direction)
- -- either next or not, but definitely no already processed list
- starttiming(nodes)
-
- usedfonts = { }
- attrfonts = { }
- basefonts = { }
- basefont = nil
- prevfont = nil
- prevattr = 0
- variants = nil
- redundant = nil
- firstnone = nil
- lastfont = nil
- lastproc = nil
- lastnone = nil
-
- a, u, b, r, e = 0, 0, 0, 0, 0
-
- if trace_fontrun then
- start_trace(head)
- end
-
- -- There is no gain in checking for a single glyph and then having a fast path. On the
- -- metafun manual (with some 2500 single char lists) the difference is just noise.
-
- for n, char, font in nextchar, head do
- -- local attr = (none and prevattr) or getattr(n,0) or 0 -- zero attribute is reserved for fonts in context
- local attr = getattr(n) or 0 -- zero attribute is reserved for fonts in context
- if font ~= prevfont or attr ~= prevattr then
- prevfont = font
- prevattr = attr
- variants = fontvariants[font]
- local fontmode = fontmodes[font]
- if fontmode == "none" then
- setnone(n)
- elseif fontmode == "base" then
- setbase(n)
- else
- setnode(n,font,attr)
- end
- elseif firstnone then
- lastnone = n
- end
- if variants then
- if (char >= 0xFE00 and char <= 0xFE0F) or (char >= 0xE0100 and char <= 0xE01EF) then
- local hash = variants[char]
- if hash then
- local p = getprev(n)
- if p then
- local char = ischar(p) -- checked
- local variant = hash[char]
- if variant then
- if trace_variants then
- report_fonts("replacing %C by %C",char,variant)
- end
- setchar(p,variant)
- if redundant then
- r = r + 1
- redundant[r] = n
- else
- r = 1
- redundant = { n }
- end
- end
- end
- elseif keep_redundant then
- -- go on, can be used for tracing
- elseif redundant then
- r = r + 1
- redundant[r] = n
- else
- r = 1
- redundant = { n }
- end
- end
- end
- end
-
- if firstnone then
- protectnone()
- end
-
- if force_boundaryrun then
-
- -- we can inject wordboundaries and then let the hyphenator do its work
- -- but we need to get rid of those nodes in order to build ligatures
- -- and kern (a rather context thing)
-
- for b, subtype in nextboundary, head do
- if subtype == word_boundary then
- if redundant then
- r = r + 1
- redundant[r] = b
- else
- r = 1
- redundant = { b }
- end
- end
- end
-
- end
-
- if redundant then
- for i=1,r do
- local r = redundant[i]
- local p, n = getboth(r)
- if r == head then
- head = n
- setprev(n)
- else
- setlink(p,n)
- end
- if b > 0 then
- for i=1,b do
- local bi = basefonts[i]
- local b1 = bi[1]
- local b2 = bi[2]
- if b1 == b2 then
- if b1 == r then
- bi[1] = false
- bi[2] = false
- end
- elseif b1 == r then
- bi[1] = n
- elseif b2 == r then
- bi[2] = p
- end
- end
- end
- flush_node(r)
- end
- end
-
- if force_discrun then
-
- -- basefont is not supported in disc only runs ... it would mean a lot of
- -- ranges .. we could try to run basemode as a separate processor run but
- -- not for now (we can consider it when the new node code is tested
- for d in nextdisc, head do
- -- we could use first_glyph, only doing replace is good enough because
- -- pre and post are normally used for hyphens and these come from fonts
- -- that part of the hyphenated word
- local _, _, r = getdisc(d)
- if r then
- local prevfont = nil
- local prevattr = nil
- local none = false
- for n, char, font in nextchar, r do
- local attr = getattr(n) or 0 -- zero attribute is reserved for fonts in context
- if font ~= prevfont or attr ~= prevattr then
- prevfont = font
- prevattr = attr
- local fontmode = fontmodes[font]
- if fontmode == "none" then
- setnone(n)
- elseif fontmode == "base" then
- setbase(n)
- else
- setnode(n,font,attr)
- end
- elseif firstnone then
- -- lastnone = n
- lastnone = nil
- end
- -- we assume one font for now (and if there are more and we get into issues then
- -- we can always remove the break)
- break
- end
- if firstnone then
- protectnone()
- end
- -- elseif expanders then
- -- local subtype = getsubtype(d)
- -- if subtype == automatic_code or subtype == explicit_code then
- -- expanders[subtype](d)
- -- e = e + 1
- -- end
- end
- end
-
- end
-
- if trace_fontrun then
- stop_trace(u,usedfonts,a,attrfonts,b,basefonts,r,redundant,e,expanders)
- end
-
- -- in context we always have at least 2 processors
- if u == 0 then
- -- skip
- elseif u == 1 then
- local attr = a > 0 and 0 or false -- 0 is the savest way
- for i=1,#lastproc do
- head = lastproc[i](head,lastfont,attr,direction)
- end
- else
- -- local attr = a == 0 and false or 0 -- 0 is the savest way
- local attr = a > 0 and 0 or false -- 0 is the savest way
- for font, processors in next, usedfonts do -- unordered
- for i=1,#processors do
- head = processors[i](head,font,attr,direction,u)
- end
- end
- end
- if a == 0 then
- -- skip
- elseif a == 1 then
- local font, dynamics = next(attrfonts)
- for attribute, processors in next, dynamics do -- unordered, attr can switch in between
- for i=1,#processors do
- head = processors[i](head,font,attribute,direction)
- end
- end
- else
- for font, dynamics in next, attrfonts do
- for attribute, processors in next, dynamics do -- unordered, attr can switch in between
- for i=1,#processors do
- head = processors[i](head,font,attribute,direction,a)
- end
- end
- end
- end
- if b == 0 then
- -- skip
- elseif b == 1 then
- -- only one font
- local range = basefonts[1]
+ else
+ -- multiple fonts
+ for i=1,b do
+ local range = basefonts[i]
local start = range[1]
local stop = range[2]
- if (start or stop) and (start ~= stop) then
+ if start then -- and start ~= stop but that seldom happens
local front = head == start
+ local prev = getprev(start)
+ local next = getnext(stop)
if stop then
- start = ligaturing(start,stop)
- start = kerning(start,stop)
- elseif start then -- safeguard
+ start, stop = ligaturing(start,stop)
+ start, stop = kerning(start,stop)
+ else
start = ligaturing(start)
start = kerning(start)
end
+ -- is done automatically
+ if prev then
+ setlink(prev,start)
+ end
+ if next then
+ setlink(stop,next)
+ end
+ -- till here
if front and head ~= start then
head = start
end
end
- else
- -- multiple fonts
- for i=1,b do
- local range = basefonts[i]
- local start = range[1]
- local stop = range[2]
- if start then -- and start ~= stop but that seldom happens
- local front = head == start
- local prev = getprev(start)
- local next = getnext(stop)
- if stop then
- start, stop = ligaturing(start,stop)
- start, stop = kerning(start,stop)
- else
- start = ligaturing(start)
- start = kerning(start)
- end
- -- is done automatically
- if prev then
- setlink(prev,start)
- end
- if next then
- setlink(stop,next)
- end
- -- till here
- if front and head ~= start then
- head = start
- end
- end
- end
end
+ end
- stoptiming(nodes)
-
- if trace_characters then
- nodes.report(head)
- end
+ stoptiming(nodes)
- return head
+ if trace_characters then
+ nodes.report(head)
end
+ return head
end
end
diff --git a/tex/context/base/mkiv/node-ini.lua b/tex/context/base/mkiv/node-ini.lua
index 47c1b88e1..f7f815222 100644
--- a/tex/context/base/mkiv/node-ini.lua
+++ b/tex/context/base/mkiv/node-ini.lua
@@ -498,30 +498,3 @@ end
if node.fix_node_lists then
node.fix_node_lists(false)
end
-
--- a temp hack
-
-if LUATEXFUNCTIONALITY < 6866 then
-
- local texnest = tex.nest
- local texlist = tex.list
-
- function tex.getnest(k)
- if not k or k == "top" then
- return texnest[texnest.ptr]
- end
- if k == "ptr" then
- return texnest.ptr
- end
- return texnest[k]
- end
-
- function tex.getlist(k)
- return texlist[k]
- end
-
- function tex.setlist(k,v)
- texlist[k] = v
- end
-
-end
diff --git a/tex/context/base/mkiv/node-met.lua b/tex/context/base/mkiv/node-met.lua
index 3116cf2fb..5c6a24c65 100644
--- a/tex/context/base/mkiv/node-met.lua
+++ b/tex/context/base/mkiv/node-met.lua
@@ -62,26 +62,6 @@ end
-- statistics.tracefunction(node, "node", "getfield","setfield")
-- statistics.tracefunction(node.direct,"node.direct","getfield","setfield")
-if LUATEXFUNCTIONALITY < 6695 then
-
- local getnext = node.getnext
- local getid = node.getid
-
- local function iterate(h,n)
- if n then
- local n = getnext(n)
- return n, getid(n)
- elseif h then
- return h, getid(h), getnext(h)
- end
- end
-
- function node.traverse(h)
- return iterate, h
- end
-
-end
-
-- We start with some helpers and provide all relevant basic functions in the
-- node namespace as well.
@@ -645,7 +625,7 @@ local messyhack = table.tohash { -- temporary solution
nodecodes.action,
}
-table.setmetatableindex(keys,function(t,k)
+setmetatableindex(keys,function(t,k)
local v = (k == "attributelist" or k == nodecodes.attributelist) and { } or getfields(k)
if messyhack[k] then
for i=1,#v do
@@ -662,7 +642,7 @@ table.setmetatableindex(keys,function(t,k)
return v
end)
-table.setmetatableindex(whatsitkeys,function(t,k)
+setmetatableindex(whatsitkeys,function(t,k)
local v = getfields(whatsit_code,k)
if v[ 0] then v[#v+1] = "next" v[ 0] = nil end
if v[-1] then v[#v+1] = "prev" v[-1] = nil end
@@ -683,45 +663,3 @@ end
nodes.keys = keys -- [id][subtype]
nodes.fields = nodefields -- (n)
-
--- for the moment (pre 6380)
-
-if not nodes.unprotect_glyph then
-
- local protect_glyph = nodes.protect_glyph
- local protect_glyphs = nodes.protect_glyphs
- local unprotect_glyph = nodes.unprotect_glyph
- local unprotect_glyphs = nodes.unprotect_glyphs
-
- local getnext = nodes.getnext
- local setnext = nodes.setnext
-
- function nodes.protectglyphs(first,last)
- if first == last then
- return protect_glyph(first)
- elseif last then
- local nxt = getnext(last)
- setnext(last)
- local f, b = protect_glyphs(first)
- setnext(last,nxt)
- return f, b
- else
- return protect_glyphs(first)
- end
- end
-
- function nodes.unprotectglyphs(first,last)
- if first == last then
- return unprotect_glyph(first)
- elseif last then
- local nxt = getnext(last)
- setnext(last)
- local f, b = unprotect_glyphs(first)
- setnext(last,nxt)
- return f, b
- else
- return unprotect_glyphs(first)
- end
- end
-
-end
diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua
index 3282c3914..689a9d1e8 100644
--- a/tex/context/base/mkiv/node-nut.lua
+++ b/tex/context/base/mkiv/node-nut.lua
@@ -144,245 +144,6 @@ nodes.tonut = tonut
-- helpers
-if not direct.getdirection then
-
- local getdir = direct.getdir
- local setdir = direct.setdir
-
- direct.getdirection = function(n)
- local d = getdir(n)
- if d == "TLT" then return 0 end
- if d == "+TLT" then return 0, false end
- if d == "-TLT" then return 0, true end
- if d == "TRT" then return 1 end
- if d == "+TRT" then return 1, false end
- if d == "-TRT" then return 1, true end
- if d == "LTL" then return 2 end
- if d == "+LTL" then return 2, false end
- if d == "-LTL" then return 2, true end
- if d == "RTT" then return 3 end
- if d == "+RTT" then return 3, false end
- if d == "-RTT" then return 3, true end
- end
-
- direct.setdirection = function(n,d,c)
- if d == 0 then if c == true then setdir(n,"-TLT") elseif c == false then setdir(n,"+TLT") else setdir(n,"TLT") end
- elseif d == 1 then if c == true then setdir(n,"-TRT") elseif c == false then setdir(n,"+TRT") else setdir(n,"TRT") end
- elseif d == 2 then if c == true then setdir(n,"-LTL") elseif c == false then setdir(n,"+LTL") else setdir(n,"LTL") end
- elseif d == 3 then if c == true then setdir(n,"-RTT") elseif c == false then setdir(n,"+RTT") else setdir(n,"RTT") end
- else if c == true then setdir(n,"-TLT") elseif c == false then setdir(n,"+TLT") else setdir(n,"TLT") end end
- end
-
-end
-
-if not direct.getexpansion then
-
- local getfield = direct.getfield
- local setfield = direct.setfield
- local getid = direct.getid
-
- local nodecodes = nodes.nodecodes
- local whatsitcodes = nodes.whatsitcodes
-
- local glyph_code = nodecodes.glyph
- local kern_code = nodecodes.kern
-
- function direct.getexpansion(n)
- local id = getid(n)
- if id == glyph_code or id == kern_code then
- return getfield(n,"expansion_factor")
- end
- end
-
- function direct.setexpansion(n,e)
- local id = getid(n)
- if id == glyph_code or id == kern_code then
- setfield(n,"expansion_factor",e)
- end
- end
-
-end
-
-if not direct.getdata then
-
- local getid = direct.getid
- local getsubtype = direct.getsubtype
- local getfield = direct.getfield
- local setfield = direct.setfield
-
- local nodecodes = nodes.nodecodes
- local whatsitcodes = nodes.whatsitcodes
-
- local glyph_code = nodecodes.glyph
- local boundary_code = nodecodes.boundary
- local whatsit_code = nodecodes.whatsit
-
- local user_defined_code = whatsitcodes.userdefined
- local pdf_literal_code = whatsitcodes.pdfliteral
- local pdf_setmatrix_code = whatsitcodes.pdfsetmatrix
- local late_lua_code = whatsitcodes.latelua
- local special_code = whatsitcodes.special
- local write_code = whatsitcodes.write
-
- function direct.getdata(n)
- local id = getid(n)
- if id == glyph_code then
- return getfield(n,"data")
- elseif id == boundary_code then
- return getfield(n,"value")
- elseif id == whatsit_code then
- local subtype = getsubtype(n)
- if subtype == user_defined_code then
- return getfield(n,"value")
- elseif subtype == pdf_literal_code then
- return getfield(n,"data"), getfield(n,"mode")
- elseif subtype == late_lua_code then
- return getfield(n,"string")
- elseif subtype == pdf_setmatrix_code then
- return getfield(n,"data")
- elseif subtype == special_code then
- return getfield(n,"data")
- elseif subtype == write_code then
- return getfield(n,"data")
- end
- end
- end
-
- function direct.setdata(n,v,vv)
- local id = getid(n)
- if id == glyph_code then
- return setfield(n,"data",v)
- elseif id == boundary_code then
- return setfield(n,"value",v)
- elseif id == whatsit_code then
- local subtype = getsubtype(n)
- if subtype == user_defined_code then
- setfield(n,"value",v)
- elseif subtype == pdf_literal_code then
- setfield(n,"data",v)
- if m then
- setfield(n,"mode",vv)
- end
- elseif subtype == late_lua_code then
- setfield(n,"string",v)
- elseif subtype == pdf_setmatrix_code then
- setfield(n,"data",v)
- elseif subtype == special_code then
- setfield(n,"data",v)
- elseif subtype == write_code then
- setfield(n,"data",v)
- end
- end
- end
-
-end
-
-if not node.direct.traverse_glyph or not node.direct.traverse_list then
-
- logs.report("system","using fake node list traversers")
-
- local direct = node.direct
-
- local getnext = direct.getnext
- local getid = direct.getid
- local getsubtype = direct.getsubtype
- local getchar = direct.getchar
- local getfont = direct.getfont
- local getlist = direct.getlist
-
- local function iterate(h,n)
- if n then
- n = getnext(n)
- else
- n = h
- end
- if n then
- return n, getid(n), getsubtype(n)
- end
- end
-
- function direct.traverse(h)
- return iterate, h
- end
-
- function node.direct.traverse_id(id,h)
- local function iterate(h,n)
- if n then
- n = getnext(n)
- else
- n = h
- end
- while n do
- if getid(n) == id then
- return n, getsubtype(n)
- else
- n = getnext(n)
- end
- end
- end
- return iterate, h
- end
-
- local function iterate(h,n)
- if n then
- n = getnext(n)
- else
- n = h
- end
- while n do
- if getid(n) == glyph_code then
- return n, getfont(n), getchar(n)
- else
- n = getnext(n)
- end
- end
- end
-
- function node.direct.traverse_glyph(h)
- return iterate, h
- end
-
- local function iterate(h,n)
- if n then
- n = getnext(n)
- else
- n = h
- end
- while n do
- if getid(n) == glyph_code and subtype(n) < 256 then
- return n, getfont(n), getchar(n)
- else
- n = getnext(n)
- end
- end
- end
-
- function node.direct.traverse_char(h)
- return iterate, h
- end
-
- local function iterate(h,n)
- if n then
- n = getnext(n)
- else
- n = h
- end
- while n do
- local id = getid(n)
- if id == hlist_code or id == vlist_code then
- return n, id, getsubtype(n), getlist(n)
- else
- n = getnext(n)
- end
- end
- end
-
- function node.direct.traverse_list(h)
- return iterate, h
- end
-
-end
-
local nuts = nodes.nuts
nuts.check_discretionaries = direct.check_discretionaries
@@ -1024,16 +785,3 @@ function nuts.copy_properties(source,target,what)
end
return newprops -- for checking
end
-
-if LUATEXFUNCTIONALITY < 6894 then
-
- local sal = nuts.setattrlist
- local cal = nuts.current_attr
-
- function nuts.setattrlist(n,a)
- return sal(n,a == true and cal() or a)
- end
-
- nuts.setattributelist = nuts.setattrlist
-
-end
diff --git a/tex/context/base/mkiv/node-par.lua b/tex/context/base/mkiv/node-par.lua
index 56741e765..8564c8764 100644
--- a/tex/context/base/mkiv/node-par.lua
+++ b/tex/context/base/mkiv/node-par.lua
@@ -13,44 +13,36 @@ local sequencers = utilities.sequencers
-- This are called a lot!
-if LUATEXFUNCTIONALITY > 6857 then
+local actions = nodes.tasks.actions("everypar")
- local actions = nodes.tasks.actions("everypar")
+local function everypar(head)
+ starttiming(builders)
+ head = actions(head)
+ stoptiming(builders)
+ return head
+end
- local function everypar(head)
- starttiming(builders)
- head = actions(head)
- stoptiming(builders)
- return head
- end
+callbacks.register("insert_local_par",everypar,"after paragraph start")
- callbacks.register("insert_local_par",everypar,"after paragraph start")
+local actions = sequencers.new {
+ name = "newgraf",
+ arguments = "mode,indented",
+ returnvalues = "indented",
+ results = "indented",
+}
-end
+sequencers.appendgroup(actions,"before") -- user
+sequencers.appendgroup(actions,"system") -- private
+sequencers.appendgroup(actions,"after" ) -- user
-if LUATEXFUNCTIONALITY > 6870 then
-
- local actions = sequencers.new {
- name = "newgraf",
- arguments = "mode,indented",
- returnvalues = "indented",
- results = "indented",
- }
-
- sequencers.appendgroup(actions,"before") -- user
- sequencers.appendgroup(actions,"system") -- private
- sequencers.appendgroup(actions,"after" ) -- user
-
- local function newgraf(mode,indented)
- local runner = actions.runner
- if runner then
- starttiming(builders)
- indent = runner(mode,indented)
- stoptiming(builders)
- end
- return indented
+local function newgraf(mode,indented)
+ local runner = actions.runner
+ if runner then
+ starttiming(builders)
+ indent = runner(mode,indented)
+ stoptiming(builders)
end
-
- callbacks.register("new_graf",newgraf,"before paragraph start")
-
+ return indented
end
+
+callbacks.register("new_graf",newgraf,"before paragraph start")
diff --git a/tex/context/base/mkiv/node-ppt.lua b/tex/context/base/mkiv/node-ppt.lua
index e26d1690e..df2986a4e 100644
--- a/tex/context/base/mkiv/node-ppt.lua
+++ b/tex/context/base/mkiv/node-ppt.lua
@@ -318,207 +318,102 @@ table.setmetatableindex(anchored,function(t,k)
return v
end)
--- function properties.attach(head)
---
--- if nofslots <= 0 then
--- return head
--- end
---
--- local last = nil
---
--- starttiming(properties)
---
--- for source in nextwhatsit, head do
--- if getsubtype(source) == userdefined_code then
--- if last then
--- removenode(head,last,true)
--- last = nil
--- end
--- if getfield(source,"user_id") == property_id then
--- local slot = getdata(source)
--- local data = cache[slot]
--- if data then
--- cache[slot] = nil
--- local where = data[1]
--- local target = anchored[where](source)
--- if target then
--- local first = data[2]
--- local method = type(first)
--- local p_target = propertydata[target]
--- local p_source = propertydata[source]
--- if p_target then
--- if p_source then
--- for k, v in next, p_source do
--- p_target[k] = v
--- end
--- end
--- if method == "table" then
--- for k, v in next, first do
--- p_target[k] = v
--- end
--- elseif method == "function" then
--- first(target,head,where,p_target,unpack(data,3))
--- elseif method == "string" then
--- actions[first](target,head,where,p_target,unpack(data,3))
--- end
--- elseif p_source then
--- if method == "table" then
--- propertydata[target] = p_source
--- for k, v in next, first do
--- p_source[k] = v
--- end
--- elseif method == "function" then
--- propertydata[target] = p_source
--- first(target,head,where,p_source,unpack(data,3))
--- elseif method == "string" then
--- propertydata[target] = p_source
--- actions[first](target,head,where,p_source,unpack(data,3))
--- end
--- else
--- if method == "table" then
--- propertydata[target] = first
--- elseif method == "function" then
--- local t = { }
--- propertydata[target] = t
--- first(target,head,where,t,unpack(data,3))
--- elseif method == "string" then
--- local t = { }
--- propertydata[target] = t
--- actions[first](target,head,where,t,unpack(data,3))
--- end
--- end
--- if trace_setting then
--- report_setting("node %i, id %s, data %s",
--- target,nodecodes[getid(target)],serialize(propertydata[target],false))
--- end
--- end
--- if nofslots == 1 then
--- nofslots = 0
--- last = source
--- break
--- else
--- nofslots = nofslots - 1
--- end
--- end
--- last = source
--- end
--- end
--- end
---
--- if last then
--- removenode(head,last,true)
--- end
---
--- stoptiming(properties)
---
--- return head
---
--- end
+function properties.attach(head)
-if LUATEXVERSION >= 1.080 then
-
- function properties.attach(head)
-
- if nofslots <= 0 then
- return head
- end
+ if nofslots <= 0 then
+ return head
+ end
- local last = nil
+ local last = nil
- starttiming(properties)
+ starttiming(properties)
- for source, subtype in nextwhatsit, head do
- if subtype == userdefined_code then
- if last then
- removenode(head,last,true)
- last = nil
- end
- if getfield(source,"user_id") == property_id then
- local slot = getdata(source)
- local data = cache[slot]
- if data then
- cache[slot] = nil
- local where = data[1]
- local target = anchored[where](source)
- if target then
- local first = data[2]
- local method = type(first)
- local p_target = propertydata[target]
- local p_source = propertydata[source]
- if p_target then
- if p_source then
- for k, v in next, p_source do
- p_target[k] = v
- end
- end
- if method == "table" then
- for k, v in next, first do
- p_target[k] = v
- end
- elseif method == "function" then
- first(target,head,where,p_target,unpack(data,3))
- elseif method == "string" then
- actions[first](target,head,where,p_target,unpack(data,3))
+ for source, subtype in nextwhatsit, head do
+ if subtype == userdefined_code then
+ if last then
+ removenode(head,last,true)
+ last = nil
+ end
+ if getfield(source,"user_id") == property_id then
+ local slot = getdata(source)
+ local data = cache[slot]
+ if data then
+ cache[slot] = nil
+ local where = data[1]
+ local target = anchored[where](source)
+ if target then
+ local first = data[2]
+ local method = type(first)
+ local p_target = propertydata[target]
+ local p_source = propertydata[source]
+ if p_target then
+ if p_source then
+ for k, v in next, p_source do
+ p_target[k] = v
end
- elseif p_source then
- if method == "table" then
- propertydata[target] = p_source
- for k, v in next, first do
- p_source[k] = v
- end
- elseif method == "function" then
- propertydata[target] = p_source
- first(target,head,where,p_source,unpack(data,3))
- elseif method == "string" then
- propertydata[target] = p_source
- actions[first](target,head,where,p_source,unpack(data,3))
+ end
+ if method == "table" then
+ for k, v in next, first do
+ p_target[k] = v
end
- else
- if method == "table" then
- propertydata[target] = first
- elseif method == "function" then
- local t = { }
- propertydata[target] = t
- first(target,head,where,t,unpack(data,3))
- elseif method == "string" then
- local t = { }
- propertydata[target] = t
- actions[first](target,head,where,t,unpack(data,3))
+ elseif method == "function" then
+ first(target,head,where,p_target,unpack(data,3))
+ elseif method == "string" then
+ actions[first](target,head,where,p_target,unpack(data,3))
+ end
+ elseif p_source then
+ if method == "table" then
+ propertydata[target] = p_source
+ for k, v in next, first do
+ p_source[k] = v
end
+ elseif method == "function" then
+ propertydata[target] = p_source
+ first(target,head,where,p_source,unpack(data,3))
+ elseif method == "string" then
+ propertydata[target] = p_source
+ actions[first](target,head,where,p_source,unpack(data,3))
end
- if trace_setting then
- report_setting("node %i, id %s, data %s",
- target,nodecodes[getid(target)],serialize(propertydata[target],false))
+ else
+ if method == "table" then
+ propertydata[target] = first
+ elseif method == "function" then
+ local t = { }
+ propertydata[target] = t
+ first(target,head,where,t,unpack(data,3))
+ elseif method == "string" then
+ local t = { }
+ propertydata[target] = t
+ actions[first](target,head,where,t,unpack(data,3))
end
end
- if nofslots == 1 then
- nofslots = 0
- last = source
- break
- else
- nofslots = nofslots - 1
+ if trace_setting then
+ report_setting("node %i, id %s, data %s",
+ target,nodecodes[getid(target)],serialize(propertydata[target],false))
end
end
- last = source
+ if nofslots == 1 then
+ nofslots = 0
+ last = source
+ break
+ else
+ nofslots = nofslots - 1
+ end
end
+ last = source
end
end
+ end
- if last then
- removenode(head,last,true)
- end
-
- stoptiming(properties)
-
- return head
-
+ if last then
+ removenode(head,last,true)
end
-local tasks = nodes.tasks
+ stoptiming(properties)
-end
+ return head
-local tasks = nodes.tasks
+end
-- maybe better hard coded in-place
@@ -528,6 +423,8 @@ end)
-- only for development
+-- local tasks = nodes.tasks
+--
-- local function show(head,level,report)
-- for target in nextnode, head do
-- local p = propertydata[target]
diff --git a/tex/context/base/mkiv/node-res.lua b/tex/context/base/mkiv/node-res.lua
index 3eedc2348..1434e51dd 100644
--- a/tex/context/base/mkiv/node-res.lua
+++ b/tex/context/base/mkiv/node-res.lua
@@ -397,24 +397,20 @@ function nutpool.userrule(width,height,depth,dir) -- w/h/d == nil will let them
return n
end
-if LUATEXFUNCTIONALITY > 6738 then
+local outlinerule = register_nut(new_nut(nodecodes.rule,rulecodes.outline)) setdir(rule, "TLT")
- local outlinerule = register_nut(new_nut(nodecodes.rule,rulecodes.outline)) setdir(rule, "TLT")
-
- function nutpool.outlinerule(width,height,depth,line,dir) -- w/h/d == nil will let them adapt
- local n = copy_nut(outlinerule)
- if width or height or depth then
- setwhd(n,width,height,depth)
- end
- if line then
- setfield(n,"transform",line)
- end
- if dir then
- setdir(n,dir)
- end
- return n
+function nutpool.outlinerule(width,height,depth,line,dir) -- w/h/d == nil will let them adapt
+ local n = copy_nut(outlinerule)
+ if width or height or depth then
+ setwhd(n,width,height,depth)
end
-
+ if line then
+ setfield(n,"transform",line)
+ end
+ if dir then
+ setdir(n,dir)
+ end
+ return n
end
function nutpool.leader(width,list)
diff --git a/tex/context/base/mkiv/node-rul.lua b/tex/context/base/mkiv/node-rul.lua
index ae837bb03..eee60efa0 100644
--- a/tex/context/base/mkiv/node-rul.lua
+++ b/tex/context/base/mkiv/node-rul.lua
@@ -534,244 +534,116 @@ local function find_attr(head,attr)
end
end
-function nodes.linefillers.handler(head) -- traverse_list
- for current in nexthlist, head do -- LUATEXVERSION >= 1.080
- if getsubtype(current) == line_code then
- local list = getlist(current)
- if list then
- -- why doesn't leftskip take the attributes
- -- or list[linefiller] or maybe first match (maybe we need a fast helper for that)
- local a = getattr(current,a_linefiller)
- if a then
- local class = a % 1000
- local data = data[class]
- if data then
- local location = data.location
- local scope = data.scope
- local distance = data.distance
- local threshold = data.threshold
- local leftlocal = false
- local rightlocal = false
- --
- if scope == v_right then
- leftlocal = true
- elseif scope == v_left then
- rightlocal = true
- elseif scope == v_local then
- leftlocal = true
- rightlocal = true
- end
- --
- if location == v_left or location == v_both then
- local lskip = nil -- leftskip
- local iskip = nil -- indentation
- local head = list
- while head do
- local id = getid(head)
- if id == glue_code then
- if getsubtype(head) == leftskip_code then
- lskip = head
- else
- break
- end
- elseif id == localpar_code or id == dir_code then
- -- go on
- elseif id == hlist_code then
- if getsubtype(head) == indent_code then
- iskip = head
- end
- break
+function nodes.linefillers.handler(head)
+ for current, subtype, list in nexthlist, head do
+ if list and subtype == line_code then
+ -- why doesn't leftskip take the attributes
+ -- or list[linefiller] or maybe first match (maybe we need a fast helper for that)
+ local a = getattr(current,a_linefiller)
+ if a then
+ local class = a % 1000
+ local data = data[class]
+ if data then
+ local location = data.location
+ local scope = data.scope
+ local distance = data.distance
+ local threshold = data.threshold
+ local leftlocal = false
+ local rightlocal = false
+ --
+ if scope == v_right then
+ leftlocal = true
+ elseif scope == v_left then
+ rightlocal = true
+ elseif scope == v_local then
+ leftlocal = true
+ rightlocal = true
+ end
+ --
+ if location == v_left or location == v_both then
+ local lskip = nil -- leftskip
+ local iskip = nil -- indentation
+ local head = list
+ while head do
+ local id = getid(head)
+ if id == glue_code then
+ if getsubtype(head) == leftskip_code then
+ lskip = head
else
break
end
- head = getnext(head)
- end
- if head then
- local indentation = iskip and getwidth(iskip) or 0
- local leftfixed = lskip and getwidth(lskip) or 0
- local lefttotal = lskip and effective_glue(lskip,current) or 0
- local width = lefttotal - (leftlocal and leftfixed or 0) + indentation - distance
- if width > threshold then
- if iskip then
- setwidth(iskip,0)
- end
- if lskip then
- setglue(lskip,leftlocal and getwidth(lskip) or nil)
- if distance > 0 then
- insert_node_after(list,lskip,new_kern(distance))
- end
- insert_node_after(list,lskip,linefiller(current,data,width,"left"))
- else
- insert_node_before(list,head,linefiller(current,data,width,"left"))
- if distance > 0 then
- insert_node_before(list,head,new_kern(distance))
- end
- end
+ elseif id == localpar_code or id == dir_code then
+ -- go on
+ elseif id == hlist_code then
+ if getsubtype(head) == indent_code then
+ iskip = head
end
+ break
+ else
+ break
end
+ head = getnext(head)
end
- --
- if location == v_right or location == v_both then
- local pskip = nil -- parfillskip
- local rskip = nil -- rightskip
- local tail = find_tail(list)
- while tail and getid(tail) == glue_code do
- local subtype = getsubtype(tail)
- if subtype == rightskip_code then
- rskip = tail
- elseif subtype == parfillskip_code then
- pskip = tail
- else
- break
+ if head then
+ local indentation = iskip and getwidth(iskip) or 0
+ local leftfixed = lskip and getwidth(lskip) or 0
+ local lefttotal = lskip and effective_glue(lskip,current) or 0
+ local width = lefttotal - (leftlocal and leftfixed or 0) + indentation - distance
+ if width > threshold then
+ if iskip then
+ setwidth(iskip,0)
end
- tail = getprev(tail)
- end
- if tail then
- local rightfixed = rskip and getwidth(rskip) or 0
- local righttotal = rskip and effective_glue(rskip,current) or 0
- local parfixed = pskip and getwidth(pskip) or 0
- local partotal = pskip and effective_glue(pskip,current) or 0
- local width = righttotal - (rightlocal and rightfixed or 0) + partotal - distance
- if width > threshold then
- if pskip then
- setglue(pskip)
+ if lskip then
+ setglue(lskip,leftlocal and getwidth(lskip) or nil)
+ if distance > 0 then
+ insert_node_after(list,lskip,new_kern(distance))
end
- if rskip then
- setglue(rskip,rightlocal and getwidth(rskip) or nil)
- if distance > 0 then
- insert_node_before(list,rskip,new_kern(distance))
- end
- insert_node_before(list,rskip,linefiller(current,data,width,"right"))
- else
- insert_node_after(list,tail,linefiller(current,data,width,"right"))
- if distance > 0 then
- insert_node_after(list,tail,new_kern(distance))
- end
+ insert_node_after(list,lskip,linefiller(current,data,width,"left"))
+ else
+ insert_node_before(list,head,linefiller(current,data,width,"left"))
+ if distance > 0 then
+ insert_node_before(list,head,new_kern(distance))
end
end
end
end
end
- end
- end
- end
- end
- return head
-end
-
-if LUATEXVERSION >= 1.080 then
-
- function nodes.linefillers.handler(head) -- traverse_list
- for current, subtype, list in nexthlist, head do -- LUATEXVERSION >= 1.080
- if list and subtype == line_code then
- -- why doesn't leftskip take the attributes
- -- or list[linefiller] or maybe first match (maybe we need a fast helper for that)
- local a = getattr(current,a_linefiller)
- if a then
- local class = a % 1000
- local data = data[class]
- if data then
- local location = data.location
- local scope = data.scope
- local distance = data.distance
- local threshold = data.threshold
- local leftlocal = false
- local rightlocal = false
- --
- if scope == v_right then
- leftlocal = true
- elseif scope == v_left then
- rightlocal = true
- elseif scope == v_local then
- leftlocal = true
- rightlocal = true
- end
- --
- if location == v_left or location == v_both then
- local lskip = nil -- leftskip
- local iskip = nil -- indentation
- local head = list
- while head do
- local id = getid(head)
- if id == glue_code then
- if getsubtype(head) == leftskip_code then
- lskip = head
- else
- break
- end
- elseif id == localpar_code or id == dir_code then
- -- go on
- elseif id == hlist_code then
- if getsubtype(head) == indent_code then
- iskip = head
- end
- break
- else
- break
- end
- head = getnext(head)
- end
- if head then
- local indentation = iskip and getwidth(iskip) or 0
- local leftfixed = lskip and getwidth(lskip) or 0
- local lefttotal = lskip and effective_glue(lskip,current) or 0
- local width = lefttotal - (leftlocal and leftfixed or 0) + indentation - distance
- if width > threshold then
- if iskip then
- setwidth(iskip,0)
- end
- if lskip then
- setglue(lskip,leftlocal and getwidth(lskip) or nil)
- if distance > 0 then
- insert_node_after(list,lskip,new_kern(distance))
- end
- insert_node_after(list,lskip,linefiller(current,data,width,"left"))
- else
- insert_node_before(list,head,linefiller(current,data,width,"left"))
- if distance > 0 then
- insert_node_before(list,head,new_kern(distance))
- end
- end
- end
+ --
+ if location == v_right or location == v_both then
+ local pskip = nil -- parfillskip
+ local rskip = nil -- rightskip
+ local tail = find_tail(list)
+ while tail and getid(tail) == glue_code do
+ local subtype = getsubtype(tail)
+ if subtype == rightskip_code then
+ rskip = tail
+ elseif subtype == parfillskip_code then
+ pskip = tail
+ else
+ break
end
+ tail = getprev(tail)
end
- --
- if location == v_right or location == v_both then
- local pskip = nil -- parfillskip
- local rskip = nil -- rightskip
- local tail = find_tail(list)
- while tail and getid(tail) == glue_code do
- local subtype = getsubtype(tail)
- if subtype == rightskip_code then
- rskip = tail
- elseif subtype == parfillskip_code then
- pskip = tail
- else
- break
+ if tail then
+ local rightfixed = rskip and getwidth(rskip) or 0
+ local righttotal = rskip and effective_glue(rskip,current) or 0
+ local parfixed = pskip and getwidth(pskip) or 0
+ local partotal = pskip and effective_glue(pskip,current) or 0
+ local width = righttotal - (rightlocal and rightfixed or 0) + partotal - distance
+ if width > threshold then
+ if pskip then
+ setglue(pskip)
end
- tail = getprev(tail)
- end
- if tail then
- local rightfixed = rskip and getwidth(rskip) or 0
- local righttotal = rskip and effective_glue(rskip,current) or 0
- local parfixed = pskip and getwidth(pskip) or 0
- local partotal = pskip and effective_glue(pskip,current) or 0
- local width = righttotal - (rightlocal and rightfixed or 0) + partotal - distance
- if width > threshold then
- if pskip then
- setglue(pskip)
+ if rskip then
+ setglue(rskip,rightlocal and getwidth(rskip) or nil)
+ if distance > 0 then
+ insert_node_before(list,rskip,new_kern(distance))
end
- if rskip then
- setglue(rskip,rightlocal and getwidth(rskip) or nil)
- if distance > 0 then
- insert_node_before(list,rskip,new_kern(distance))
- end
- insert_node_before(list,rskip,linefiller(current,data,width,"right"))
- else
- insert_node_after(list,tail,linefiller(current,data,width,"right"))
- if distance > 0 then
- insert_node_after(list,tail,new_kern(distance))
- end
+ insert_node_before(list,rskip,linefiller(current,data,width,"right"))
+ else
+ insert_node_after(list,tail,linefiller(current,data,width,"right"))
+ if distance > 0 then
+ insert_node_after(list,tail,new_kern(distance))
end
end
end
@@ -780,9 +652,8 @@ if LUATEXVERSION >= 1.080 then
end
end
end
- return head
end
-
+ return head
end
local enable = false
@@ -895,13 +766,11 @@ interfaces.implement {
t.depth
)
setattrlist(n,true)
- if LUATEXFUNCTIONALITY >= 6710 then
- if l then
- setfield(n,"left",l)
- end
- if r then
- setfield(n,"right",r)
- end
+ if l then
+ setfield(n,"left",l)
+ end
+ if r then
+ setfield(n,"right",r)
end
context(tonode(n))
end
diff --git a/tex/context/base/mkiv/pack-rul.lua b/tex/context/base/mkiv/pack-rul.lua
index fbffa4ec3..c89335220 100644
--- a/tex/context/base/mkiv/pack-rul.lua
+++ b/tex/context/base/mkiv/pack-rul.lua
@@ -57,6 +57,7 @@ local flush_node = nuts.flush
local nexthlist = nuts.traversers.hlist
local nextvlist = nuts.traversers.vlist
+local nextlist = nuts.traversers.list
local checkformath = false
@@ -79,24 +80,26 @@ local function doreshapeframedbox(n)
if boxwidth ~= 0 then -- and h.subtype == vlist_code
local list = getlist(box)
if list then
- local function check(n,repack)
+ local hdone = false
+ for n, id, subtype, list in nextlist, list do -- no dir etc needed
local width, height, depth = getwhd(n)
if not firstheight then
firstheight = height
end
lastdepth = depth
noflines = noflines + 1
- local l = getlist(n)
- if l then
- if repack then
- local subtype = getsubtype(n)
+ if list then
+ if id == hlist_code then
if subtype == box_code or subtype == line_code then
- lastlinelength = list_dimensions(l,getdir(n))
+ -- lastlinelength = list_dimensions(list,getdir(n))
+ lastlinelength = list_dimensions(list,getdirection(n))
else
lastlinelength = width
end
+ hdone = true
else
lastlinelength = width
+ -- vdone = true
end
if lastlinelength > maxwidth then
maxwidth = lastlinelength
@@ -110,26 +113,14 @@ local function doreshapeframedbox(n)
totalwidth = totalwidth + lastlinelength
end
end
- local hdone = false
- for h in nexthlist, list do -- no dir etc needed
- check(h,true)
- hdone = true
- end
- -- local vdone = false
- for v in nextvlist, list do -- no dir etc needed
- check(v,false)
- -- vdone = true
- end
if not firstheight then
-- done)
elseif maxwidth ~= 0 then
if hdone then
- for h in nexthlist, list do
- local l = getlist(h)
- if l then
- local subtype = getsubtype(h)
+ for h, id, subtype, list in nextlist, list do
+ if list and id == hlist_code then
if subtype == box_code or subtype == line_code then
- local p = hpack(l,maxwidth,'exactly',getdir(h)) -- multiple return value
+ local p = hpack(list,maxwidth,'exactly',getdir(h)) -- multiple return value
local set, order, sign = getboxglue(p)
setboxglue(h,set,order,sign)
setlist(p)
@@ -167,108 +158,6 @@ local function doreshapeframedbox(n)
texsetdimen("global","framedaveragewidth",averagewidth)
end
-if LUATEXVERSION >= 1.080 then
-
- local traverse_list = node.direct.traverse_list
-
- local nextlist = nuts.traversers.list
-
- -- local function doreshapeframedbox(n)
- doreshapeframedbox = function(n)
- local box = getbox(n)
- local noflines = 0
- local nofnonzero = 0
- local firstheight = nil
- local lastdepth = nil
- local lastlinelength = 0
- local minwidth = 0
- local maxwidth = 0
- local totalwidth = 0
- local averagewidth = 0
- local boxwidth = getwidth(box)
- if boxwidth ~= 0 then -- and h.subtype == vlist_code
- local list = getlist(box)
- if list then
- local hdone = false
- for n, id, subtype, list in nextlist, list do -- no dir etc needed
- local width, height, depth = getwhd(n)
- if not firstheight then
- firstheight = height
- end
- lastdepth = depth
- noflines = noflines + 1
- if list then
- if id == hlist_code then
- if subtype == box_code or subtype == line_code then
- -- lastlinelength = list_dimensions(list,getdir(n))
- lastlinelength = list_dimensions(list,getdirection(n))
- else
- lastlinelength = width
- end
- hdone = true
- else
- lastlinelength = width
- -- vdone = true
- end
- if lastlinelength > maxwidth then
- maxwidth = lastlinelength
- end
- if lastlinelength < minwidth or minwidth == 0 then
- minwidth = lastlinelength
- end
- if lastlinelength > 0 then
- nofnonzero = nofnonzero + 1
- end
- totalwidth = totalwidth + lastlinelength
- end
- end
- if not firstheight then
- -- done)
- elseif maxwidth ~= 0 then
- if hdone then
- for h, id, subtype, list in nextlist, list do
- if list and id == hlist_code then
- if subtype == box_code or subtype == line_code then
- local p = hpack(list,maxwidth,'exactly',getdir(h)) -- multiple return value
- local set, order, sign = getboxglue(p)
- setboxglue(h,set,order,sign)
- setlist(p)
- flush_node(p)
- elseif checkformath and subtype == equation_code then
- -- display formulas use a shift
- if nofnonzero == 1 then
- setshift(h,0)
- end
- end
- setwidth(h,maxwidth)
- end
- end
- end
- -- if vdone then
- -- for v in nextvlist, list do
- -- local width = getwidth(n)
- -- if width > maxwidth then
- -- setwidth(v,maxwidth)
- -- end
- -- end
- -- end
- setwidth(box,maxwidth)
- averagewidth = noflines > 0 and totalwidth/noflines or 0
- else -- e.g. empty math {$ $} or \hbox{} or ...
- setwidth(box,0)
- end
- end
- end
- texsetcount("global","framednoflines",noflines)
- texsetdimen("global","framedfirstheight",firstheight or 0) -- also signal
- texsetdimen("global","framedlastdepth",lastdepth or 0)
- texsetdimen("global","framedminwidth",minwidth)
- texsetdimen("global","framedmaxwidth",maxwidth)
- texsetdimen("global","framedaveragewidth",averagewidth)
- end
-
-end
-
local function doanalyzeframedbox(n) -- traverse_list
local box = getbox(n)
local noflines = 0
@@ -277,7 +166,7 @@ local function doanalyzeframedbox(n) -- traverse_list
if getwidth(box) ~= 0 then
local list = getlist(box)
if list then
- local function check(n)
+ for n in nexthlist, list do
local width, height, depth = getwhd(n)
if not firstheight then
firstheight = height
@@ -285,11 +174,13 @@ local function doanalyzeframedbox(n) -- traverse_list
lastdepth = depth
noflines = noflines + 1
end
- for h in nexthlist, list do
- check(h)
- end
- for v in nextvlist, list do
- check(v)
+ for n in nextvlist, list do
+ local width, height, depth = getwhd(n)
+ if not firstheight then
+ firstheight = height
+ end
+ lastdepth = depth
+ noflines = noflines + 1
end
end
end
@@ -315,16 +206,11 @@ local function maxboxwidth(box)
end
local lastlinelength = 0
local maxwidth = 0
- local function check(n,repack)
+ for n, subtype in nexthlist, list do -- no dir etc needed
local l = getlist(n)
if l then
- if repack then
- local subtype = getsubtype(n)
- if subtype == box_code or subtype == line_code then
- lastlinelength = list_dimensions(l,getdir(n))
- else
- lastlinelength = getwidth(n)
- end
+ if subtype == box_code or subtype == line_code then
+ lastlinelength = list_dimensions(l,getdir(n))
else
lastlinelength = getwidth(n)
end
@@ -333,11 +219,14 @@ local function maxboxwidth(box)
end
end
end
- for h in nexthlist, list do -- no dir etc needed
- check(h,true)
- end
- for v in nextvlist, list do -- no dir etc needed
- check(v,false)
+ for n, subtype in nextvlist, list do -- no dir etc needed
+ local l = getlist(n)
+ if l then
+ lastlinelength = getwidth(n)
+ if lastlinelength > maxwidth then
+ maxwidth = lastlinelength
+ end
+ end
end
return maxwidth
end
diff --git a/tex/context/base/mkiv/page-lin.lua b/tex/context/base/mkiv/page-lin.lua
index e59bb4ed1..0e5f74694 100644
--- a/tex/context/base/mkiv/page-lin.lua
+++ b/tex/context/base/mkiv/page-lin.lua
@@ -284,8 +284,8 @@ end
local function listisnumbered(list)
if list then
- for n in nexthlist, list do -- LUATEXVERSION >= 1.080
- if getsubtype(n) == line_code then
+ for n, subtype in nexthlist, list do
+ if subtype == line_code then
local a = getattr(n,a_linenumber)
if a then
-- a quick test for lines (only valid when \par before \stoplinenumbering)
@@ -384,8 +384,7 @@ function boxed.stage_one(n,nested)
local skip = false
local function check()
- for n in nexthlist, list do -- LUATEXVERSION >= 1.080
- local subtype = getsubtype(n)
+ for n, subtype in nexthlist, list do
if subtype ~= line_code then
-- go on
elseif getheight(n) == 0 and getdepth(n) == 0 then
@@ -451,7 +450,7 @@ function boxed.stage_one(n,nested)
if not list then
return
end
- for n in nextvlist, list do -- LUATEXVERSION >= 1.080
+ for n in nextvlist, list do
local p = properties[n]
if p and p.columngap then
if trace_numbers then
@@ -474,7 +473,7 @@ function boxed.stage_two(n,m)
if #current_list > 0 then
m = m or lines.scratchbox
local t, tn = { }, 0
- for l in nexthlist, getlist(getbox(m)) do -- LUATEXVERSION >= 1.080
+ for l in nexthlist, getlist(getbox(m)) do
tn = tn + 1
t[tn] = copy_node(l) -- use take_box instead
end
diff --git a/tex/context/base/mkiv/scrp-ini.lua b/tex/context/base/mkiv/scrp-ini.lua
index cc74df16b..8c493650b 100644
--- a/tex/context/base/mkiv/scrp-ini.lua
+++ b/tex/context/base/mkiv/scrp-ini.lua
@@ -889,15 +889,13 @@ setmetatableindex(cache_nop,function(t,k) local v = { } t[k] = v return v end)
-- playing nice
function autofontfeature.handler(head)
- for n in nextchar, head do
+ for n, font, char in nextchar, head do
-- if getattr(n,a_scriptinjection) then
-- -- already tagged by script feature, maybe some day adapt
-- else
- local char = getchar(n)
local script = otfscripts[char]
if script then
local dynamic = getattr(n,0) or 0
- local font = getfont(n)
if dynamic > 0 then
local slot = cache_yes[font]
local attr = slot[script]
@@ -933,53 +931,6 @@ function autofontfeature.handler(head)
return head
end
-if LUATEXVERSION >= 1.080 then
-
- function autofontfeature.handler(head)
- for n, font, char in nextchar, head do
- -- if getattr(n,a_scriptinjection) then
- -- -- already tagged by script feature, maybe some day adapt
- -- else
- local script = otfscripts[char]
- if script then
- local dynamic = getattr(n,0) or 0
- if dynamic > 0 then
- local slot = cache_yes[font]
- local attr = slot[script]
- if not attr then
- attr = mergecontext(dynamic,name,2)
- slot[script] = attr
- if trace_scripts then
- report_scripts("script: %s, trigger %C, dynamic: %a, variant: %a",script,char,attr,"extended")
- end
- end
- if attr ~= 0 then
- n[0] = attr
- -- maybe set scriptinjection when associated
- end
- else
- local slot = cache_nop[font]
- local attr = slot[script]
- if not attr then
- attr = registercontext(font,script,2)
- slot[script] = attr
- if trace_scripts then
- report_scripts("script: %s, trigger %C, dynamic: %s, variant: %a",script,char,attr,"normal")
- end
- end
- if attr ~= 0 then
- setattr(n,0,attr)
- -- maybe set scriptinjection when associated
- end
- end
- end
- -- end
- end
- return head
- end
-
-end
-
function autofontfeature.enable()
report_scripts("globally enabled")
enableaction("processors","scripts.autofontfeature.handler")
diff --git a/tex/context/base/mkiv/spac-chr.lua b/tex/context/base/mkiv/spac-chr.lua
index 98b07adf5..d666956e5 100644
--- a/tex/context/base/mkiv/spac-chr.lua
+++ b/tex/context/base/mkiv/spac-chr.lua
@@ -151,8 +151,8 @@ end
function characters.replacenbspaces(head)
local wipe = false
- for current in nextglyph, head do -- can be anytime so no traverse_char
- if getchar(current) == 0x00A0 then
+ for current, font, char in nextglyph, head do -- can be anytime so no traverse_char
+ if char == 0x00A0 then
if wipe then
head = remove_node(h,current,true)
wipe = false
@@ -169,30 +169,6 @@ function characters.replacenbspaces(head)
return head
end
-if LUATEXVERSION >= 1.080 then
-
- function characters.replacenbspaces(head)
- local wipe = false
- for current, font, char in nextglyph, head do -- can be anytime so no traverse_char
- if char == 0x00A0 then
- if wipe then
- head = remove_node(h,current,true)
- wipe = false
- end
- local h = nbsp(head,current)
- if h then
- wipe = current
- end
- end
- end
- if wipe then
- head = remove_node(head,current,true)
- end
- return head
- end
-
-end
-
-- This initialization might move someplace else if we need more of it. The problem is that
-- this module depends on fonts so we have an order problem.
@@ -353,8 +329,7 @@ characters.methods = methods
function characters.handler(head)
local wipe = false
- for current in nextchar, head do
- local char = getchar(current)
+ for current, char in nextchar, head do
local method = methods[char]
if method then
if wipe then
@@ -375,31 +350,3 @@ function characters.handler(head)
end
return head
end
-
-if LUATEXVERSION >= 1.080 then
-
- function characters.handler(head)
- local wipe = false
- for current, char in nextchar, head do
- local method = methods[char]
- if method then
- if wipe then
- head = remove_node(head,wipe,true)
- wipe = false
- end
- if trace_characters then
- report_characters("replacing character %C, description %a",char,lower(chardata[char].description))
- end
- local h = method(head,current)
- if h then
- wipe = current
- end
- end
- end
- if wipe then
- head = remove_node(head,wipe,true)
- end
- return head
- end
-
-end
diff --git a/tex/context/base/mkiv/spac-par.mkiv b/tex/context/base/mkiv/spac-par.mkiv
index 4dd3db243..3d25fa3ad 100644
--- a/tex/context/base/mkiv/spac-par.mkiv
+++ b/tex/context/base/mkiv/spac-par.mkiv
@@ -79,17 +79,17 @@
\setvalue{\??paragraphintro\v!first}#1%
{\global\settrue\c_spac_paragraphs_intro_first
- \global\t_spac_paragraphs_intro_first\expandafter{\the\t_spac_paragraphs_intro_first#1}%
+ \gtoksapp\t_spac_paragraphs_intro_first{#1}%
\glet\insertparagraphintro\spac_paragraphs_flush_intro}
\setvalue{\??paragraphintro\v!next}#1%
{\global\settrue\c_spac_paragraphs_intro_next
- \global\t_spac_paragraphs_intro_next\expandafter{\the\t_spac_paragraphs_intro_next#1}%
+ \gtoksapp\t_spac_paragraphs_intro_next{#1}%
\glet\insertparagraphintro\spac_paragraphs_flush_intro}
\setvalue{\??paragraphintro\v!each}#1%
{\global\settrue\c_spac_paragraphs_intro_each
- \global\t_spac_paragraphs_intro_each\expandafter{\the\t_spac_paragraphs_intro_each#1}%
+ \gtoksapp\t_spac_paragraphs_intro_each{#1}%
\glet\insertparagraphintro\spac_paragraphs_flush_intro}
%D We can say:
@@ -130,7 +130,7 @@
\unexpanded\def\flushatparagraph#1%
{\global\c_spac_paragraphs_intro_first\plusone
- \global\t_spac_paragraphs_intro_first\expandafter{\the\t_spac_paragraphs_intro_first#1}%
+ \gtoksapp\t_spac_paragraphs_intro_first{#1}%
\glet\insertparagraphintro\spac_paragraphs_flush_intro}
%D Here comes the flusher (we misuse the one level expansion of token
diff --git a/tex/context/base/mkiv/spac-ver.mkiv b/tex/context/base/mkiv/spac-ver.mkiv
index c241f4f2c..0b53d24b1 100644
--- a/tex/context/base/mkiv/spac-ver.mkiv
+++ b/tex/context/base/mkiv/spac-ver.mkiv
@@ -900,11 +900,14 @@
\dosetstrut}
\unexpanded\def\setcharstrut#1%
- {\setbox\strutbox\hbox{#1}% hm, maybe hpack i.e. why apply fonts .. conceptual choice
+ {\setbox\strutbox\hbox{#1}% no \hpack, in case we have smallcaps
\strutht\ht\strutbox
\strutdp\dp\strutbox
\dosetstrut}
+\unexpanded\def\settightstrut
+ {\setcharstrut{(}}
+
\unexpanded\def\setfontstrut
{\setcharstrut{(gplQT}}
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 329abcef6..980f5d987 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index b109d4155..7434187b1 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-pag.mkiv b/tex/context/base/mkiv/strc-pag.mkiv
index e25b47f12..949806c82 100644
--- a/tex/context/base/mkiv/strc-pag.mkiv
+++ b/tex/context/base/mkiv/strc-pag.mkiv
@@ -152,7 +152,7 @@
\setupsubpagenumber
[\c!way=\v!by\v!part,
- \c!state=\v!stop]
+ \c!state=\v!start] % was stop but start looks better in logging
% Counters
diff --git a/tex/context/base/mkiv/supp-box.mkiv b/tex/context/base/mkiv/supp-box.mkiv
index 7a073fc84..1ac51f7cc 100644
--- a/tex/context/base/mkiv/supp-box.mkiv
+++ b/tex/context/base/mkiv/supp-box.mkiv
@@ -19,6 +19,10 @@
% This file is partially cleaned up.
+%D First some defaults:
+
+\fixupboxesmode\plusone
+
% handy to have
%
% \hbox to \hsize
diff --git a/tex/context/base/mkiv/symb-ini.mkiv b/tex/context/base/mkiv/symb-ini.mkiv
index ae1a2a711..abf857675 100644
--- a/tex/context/base/mkiv/symb-ini.mkiv
+++ b/tex/context/base/mkiv/symb-ini.mkiv
@@ -114,13 +114,23 @@
\expandafter\symb_place_normal_b
\fi}
+% \def\symb_place_normal_a[#1][#2]%
+% {\edef\currentsymbol{#2}%
+% \ifcsname\??symbol#1:#2\endcsname
+% \symb_place_indeed{#1:#2}%
+% \else
+% \symb_place_normal_c
+% \fi}
+
\def\symb_place_normal_a[#1][#2]%
{\edef\currentsymbol{#2}%
\ifcsname\??symbol#1:#2\endcsname
- \symb_place_indeed{#1:#2}%
+ \symb_place_indeed{#1:#2}% maybe use \lastnamescs
+ \else\ifcsname\??symboldefault#1\endcsname
+ \symb_place_named{#1}% maybe use \lastnamescs
\else
\symb_place_normal_c
- \fi}
+ \fi\fi}
\def\symb_place_normal_b[#1][#2]%
{\edef\currentsymbol{#1}%
diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv
index b62dbfd7f..2a2e891dc 100644
--- a/tex/context/base/mkiv/syst-ini.mkiv
+++ b/tex/context/base/mkiv/syst-ini.mkiv
@@ -56,6 +56,8 @@
\chardef\ampersandasciicode 38
\chardef\singlequoteasciicode 39 % '
\chardef\primeasciicode 39 % '
+\chardef\leftparentasciicode 40
+\chardef\rightparentasciicode 41
\chardef\hyphenasciicode 45
\chardef\forwardslashasciicode 47 % /
\chardef\colonasciicode 58
diff --git a/tex/context/base/mkiv/type-ini.mkvi b/tex/context/base/mkiv/type-ini.mkvi
index ea8260ecd..ac5f6af2f 100644
--- a/tex/context/base/mkiv/type-ini.mkvi
+++ b/tex/context/base/mkiv/type-ini.mkvi
@@ -208,19 +208,15 @@
{\global\advance\c_font_typescripts_n_of_preloaded\plusone
\expandafter\normalgdef\csname\??typescriptcache\the\c_font_typescripts_n_of_preloaded\endcsname
{\starttypescript#definitions\stoptypescript}%
- %\normalexpanded{\global\t_font_typescripts{\the\expandafter\t_font_typescripts\noexpand\csname\??typescriptcache\the\c_font_typescripts_n_of_preloaded\endcsname}}}
- \global\t_font_typescripts\expandafter\expandafter\expandafter
- {\expandafter\the\expandafter\t_font_typescripts
- \csname\??typescriptcache\the\c_font_typescripts_n_of_preloaded\endcsname}}
+ \gtoksapp\t_font_typescripts\expandafter
+ {\csname\??typescriptcache\the\c_font_typescripts_n_of_preloaded\endcsname}}
\def\font_typescripts_collection_start_store#definitions\stoptypescriptcollection
{\global\advance\c_font_typescripts_n_of_preloaded\plusone
\expandafter\normalgdef\csname\??typescriptcache\the\c_font_typescripts_n_of_preloaded\endcsname
{\starttypescriptcollection#definitions\stoptypescriptcollection}%
- %\normalexpanded{\global\t_font_typescripts{\the\expandafter\t_font_typescripts\noexpand\csname\??typescriptcache\the\c_font_typescripts_n_of_preloaded\endcsname}}}
- \global\t_font_typescripts\expandafter\expandafter\expandafter
- {\expandafter\the\expandafter\t_font_typescripts
- \csname\??typescriptcache\the\c_font_typescripts_n_of_preloaded\endcsname}}
+ \gtoksapp\t_font_typescripts\expandafter
+ {\csname\??typescriptcache\the\c_font_typescripts_n_of_preloaded\endcsname}}
\def\font_typescripts_load_file#filename%
{\setfalse\c_font_typescripts_quit
diff --git a/tex/context/base/mkiv/typo-cln.lua b/tex/context/base/mkiv/typo-cln.lua
index a2ebe6a0a..e5dd2271f 100644
--- a/tex/context/base/mkiv/typo-cln.lua
+++ b/tex/context/base/mkiv/typo-cln.lua
@@ -58,8 +58,7 @@ local resetter = { -- this will become an entry in char-def
function cleaners.handler(head)
local inline = false
- for n in nextglyph, head do
- local char = getchar(n)
+ for n, font, char in nextglyph, head do
if resetter[char] then
inline = false
elseif not inline then
@@ -81,34 +80,6 @@ function cleaners.handler(head)
return head
end
-if LUATEXVERSION >= 1.080 then
-
- function cleaners.handler(head)
- local inline = false
- for n, font, char in nextglyph, head do
- if resetter[char] then
- inline = false
- elseif not inline then
- local a = getattr(n,a_cleaner)
- if a == 1 then -- currently only one cleaner so no need to be fancy
- local upper = uccodes[char]
- if type(upper) == "table" then
- -- some day, not much change that \SS ends up here
- else
- setchar(n,upper)
- if trace_autocase then
- report_autocase("")
- end
- end
- end
- inline = true
- end
- end
- return head
- end
-
-end
-
-- see typo-cap for a more advanced settings handler .. not needed now
local enabled = false
diff --git a/tex/context/base/mkiv/typo-lin.lua b/tex/context/base/mkiv/typo-lin.lua
index fe780dfe7..862240524 100644
--- a/tex/context/base/mkiv/typo-lin.lua
+++ b/tex/context/base/mkiv/typo-lin.lua
@@ -252,8 +252,8 @@ function paragraphs.normalize(head,islocal)
if l_width ~= 0 or l_stretch ~= 0 or l_shrink ~= 0 then
local last = nil -- a nut
local done = false
- for line in nexthlist, head do -- LUATEXVERSION >= 1.080
- if getsubtype(line) == line_code and not getprop(line,"line") then
+ for line, subtype in nexthlist, head do
+ if subtype == line_code and not getprop(line,"line") then
if done then
last = line
else
@@ -280,8 +280,8 @@ function paragraphs.normalize(head,islocal)
end
end
-- normalizer
- for line in nexthlist, head do -- LUATEXVERSION >= 1.080
- if getsubtype(line) == line_code and not getprop(line,"line") then
+ for line, subtype in nexthlist, head do
+ if subtype == line_code and not getprop(line,"line") then
normalize(line)
if done then
last = line
diff --git a/tex/context/base/mkiv/typo-pnc.lua b/tex/context/base/mkiv/typo-pnc.lua
index e9b947807..786fd7d3f 100644
--- a/tex/context/base/mkiv/typo-pnc.lua
+++ b/tex/context/base/mkiv/typo-pnc.lua
@@ -68,8 +68,8 @@ local mapping = periodkerns.mapping
local factors = periodkerns.factors
function periodkerns.handler(head)
- for current in nextglyph, head do
- if getchar(current) == period then
+ for current, font, char in nextglyph, head do
+ if char == period then
local a = getattr(current,a_periodkern)
if a then
local factor = mapping[a]
@@ -135,79 +135,6 @@ function periodkerns.handler(head)
return head
end
-if LUATEXVERSION >= 1.080 then
-
- function periodkerns.handler(head)
- for current, font, char in nextglyph, head do
- if char == period then
- local a = getattr(current,a_periodkern)
- if a then
- local factor = mapping[a]
- if factor then
- local prev, next = getboth(current)
- if prev and next and getid(prev) == glyph_code and getid(next) == glyph_code then
- local pchar = getchar(prev)
- local pcode = categories[getchar(prev)]
- if pcode == "lu" or pcode == "ll" then
- local nchar = getchar(next)
- local ncode = categories[getchar(next)]
- if ncode == "lu" or ncode == "ll" then
- local next2 = getnext(next)
- if next2 and getid(next2) == glyph_code and getchar(next2) == period then
- -- A.B.
- local fontspace, inserted
- if factor ~= 0 then
- fontspace = parameters[getfont(current)].space -- can be sped up
- inserted = factor * fontspace
- insert_after(head,current,new_kern(inserted))
- if trace then
- report("inserting space at %C . [%p] %C .",pchar,inserted,nchar)
- end
- end
- local next3 = getnext(next2)
- if next3 and getid(next3) == glue_code and getsubtype(next3) == spaceskip_code then
- local width = getwidth(next3)
- local space = fontspace or parameters[getfont(current)].space -- can be sped up
- if width > space then -- space + extraspace
- local next4 = getnext(next3)
- if next4 and getid(next4) == glyph_code then
- local fchar = getchar(next4)
- if categories[fchar] ~= "lu" then
- -- A.B.<glue>X
- if trace then
- if inserted then
- report("reverting space at %C . [%p] %C . [%p->%p] %C",pchar,inserted,nchar,width,space,fchar)
- else
- report("reverting space at %C . %C . [%p->%p] %C",pchar,nchar,width,space,fchar)
- end
- end
- setwidth(next3,space)
- else
- if trace then
- if inserted then
- report("keeping space at %C . [%p] %C . [%p] %C",pchar,inserted,nchar,width,fchar)
- else
- report("keeping space at %C . %C . [%p] %C",pchar,nchar,width,fchar)
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- return head
- end
-
-
-end
-
local enabled = false
function periodkerns.set(factor)
diff --git a/tex/context/base/mkiv/util-str.lua b/tex/context/base/mkiv/util-str.lua
index 29305f3bb..48c265659 100644
--- a/tex/context/base/mkiv/util-str.lua
+++ b/tex/context/base/mkiv/util-str.lua
@@ -51,9 +51,14 @@ local stripzero = patterns.stripzero
local stripzeros = patterns.stripzeros
local newline = patterns.newline
local endofstring = patterns.endofstring
+local anything = patterns.anything
local whitespace = patterns.whitespace
+local space = patterns.space
local spacer = patterns.spacer
local spaceortab = patterns.spaceortab
+local digit = patterns.digit
+local sign = patterns.sign
+local period = patterns.period
-- local function points(n)
-- n = tonumber(n)
@@ -106,7 +111,6 @@ number.basepoints = basepoints
local rubish = spaceortab^0 * newline
local anyrubish = spaceortab + newline
-local anything = patterns.anything
local stripped = (spaceortab^1 / "") * newline
local leading = rubish^0 / ""
local trailing = (anyrubish^1 * endofstring) / ""
@@ -174,7 +178,7 @@ local pattern =
+ newline * Cp() / function(position)
extra, start = 0, position
end
- + patterns.anything
+ + anything
)^1)
function strings.tabtospace(str,tab)
@@ -217,27 +221,31 @@ end
-- return str
-- end
-local space = spacer^0
-local nospace = space/""
-local endofline = nospace * newline
+local optionalspace = spacer^0
+local nospace = optionalspace/""
+local endofline = nospace * newline
-local stripend = (whitespace^1 * endofstring)/""
+local stripend = (whitespace^1 * endofstring)/""
-local normalline = (nospace * ((1-space*(newline+endofstring))^1) * nospace)
+local normalline = (nospace * ((1-optionalspace*(newline+endofstring))^1) * nospace)
-local stripempty = endofline^1/""
-local normalempty = endofline^1
-local singleempty = endofline * (endofline^0/"")
-local doubleempty = endofline * endofline^-1 * (endofline^0/"")
+local stripempty = endofline^1/""
+local normalempty = endofline^1
+local singleempty = endofline * (endofline^0/"")
+local doubleempty = endofline * endofline^-1 * (endofline^0/"")
+local stripstart = stripempty^0
-local stripstart = stripempty^0
+local intospace = whitespace^1/" "
+local noleading = whitespace^1/""
+local notrailing = noleading * endofstring
-local p_prune_normal = Cs ( stripstart * ( stripend + normalline + normalempty )^0 )
-local p_prune_collapse = Cs ( stripstart * ( stripend + normalline + doubleempty )^0 )
-local p_prune_noempty = Cs ( stripstart * ( stripend + normalline + singleempty )^0 )
-local p_retain_normal = Cs ( ( normalline + normalempty )^0 )
-local p_retain_collapse = Cs ( ( normalline + doubleempty )^0 )
-local p_retain_noempty = Cs ( ( normalline + singleempty )^0 )
+local p_prune_normal = Cs ( stripstart * ( stripend + normalline + normalempty )^0 )
+local p_prune_collapse = Cs ( stripstart * ( stripend + normalline + doubleempty )^0 )
+local p_prune_noempty = Cs ( stripstart * ( stripend + normalline + singleempty )^0 )
+local p_prune_intospace = Cs ( noleading * ( notrailing + intospace + 1 )^0 )
+local p_retain_normal = Cs ( ( normalline + normalempty )^0 )
+local p_retain_collapse = Cs ( ( normalline + doubleempty )^0 )
+local p_retain_noempty = Cs ( ( normalline + singleempty )^0 )
-- function striplines(str,prune,collapse,noempty)
-- if prune then
@@ -263,6 +271,7 @@ local striplinepatterns = {
["prune"] = p_prune_normal,
["prune and collapse"] = p_prune_collapse, -- default
["prune and no empty"] = p_prune_noempty,
+ ["prune and to space"] = p_prune_intospace,
["retain"] = p_retain_normal,
["retain and collapse"] = p_retain_collapse,
["retain and no empty"] = p_retain_noempty,
@@ -277,6 +286,10 @@ function strings.striplines(str,how)
return str and lpegmatch(striplinepatterns[how],str) or str
end
+function strings.collapse(str) -- maybe also in strings
+ return str and lpegmatch(p_prune_intospace,str) or str
+end
+
-- also see: string.collapsespaces
strings.striplong = strings.striplines -- for old times sake
@@ -292,13 +305,14 @@ strings.striplong = strings.striplines -- for old times sake
-- " zus wim jet",
-- " ",
-- }, "\n")
-
+--
-- local str = table.concat( {
-- " aaaa",
-- " bb",
-- " cccccc",
+-- " ",
-- }, "\n")
-
+--
-- for k, v in table.sortedhash(utilities.strings.striplinepatterns) do
-- logs.report("stripper","method: %s, result: [[%s]]",k,utilities.strings.striplines(str,k))
-- end
@@ -445,22 +459,19 @@ end
-- maybe to util-num
-local digit = patterns.digit
-local period = patterns.period
local two = digit * digit
local three = two * digit
local prefix = (Carg(1) * three)^1
-
local splitter = Cs (
(((1 - (three^1 * period))^1 + C(three)) * prefix + C((1-period)^1))
- * (P(1)/"" * Carg(2)) * C(2)
+ * (anything/"" * Carg(2)) * C(2)
)
local splitter3 = Cs (
- three * prefix * P(-1) +
- two * prefix * P(-1) +
- digit * prefix * P(-1) +
+ three * prefix * endofstring +
+ two * prefix * endofstring +
+ digit * prefix * endofstring +
three +
two +
digit
@@ -512,9 +523,9 @@ end
local p = Cs(
P("-")^0
* (P("0")^1/"")^0
- * (1-P("."))^0
- * (P(".") * P("0")^1 * P(-1)/"" + P(".")^0)
- * P(1-P("0")^1*P(-1))^0
+ * (1-period)^0
+ * (period * P("0")^1 * endofstring/"" + period^0)
+ * P(1-P("0")^1*endofstring)^0
)
function number.compactfloat(n,fmt)
@@ -533,12 +544,11 @@ end
local zero = P("0")^1 / ""
local plus = P("+") / ""
local minus = P("-")
-local separator = S(".")
-local digit = R("09")
+local separator = period
local trailing = zero^1 * #S("eE")
-local exponent = (S("eE") * (plus + Cs((minus * zero^0 * P(-1))/"") + minus) * zero^0 * (P(-1) * Cc("0") + P(1)^1))
+local exponent = (S("eE") * (plus + Cs((minus * zero^0 * endofstring)/"") + minus) * zero^0 * (endofstring * Cc("0") + anything^1))
local pattern_a = Cs(minus^0 * digit^1 * (separator/"" * trailing + separator * (trailing + digit)^0) * exponent)
-local pattern_b = Cs((exponent + P(1))^0)
+local pattern_b = Cs((exponent + anything)^0)
function number.sparseexponent(f,n)
if not n then
@@ -661,10 +671,10 @@ setmetatable(arguments, { __index =
end
})
-local prefix_any = C((S("+- .") + R("09"))^0)
-local prefix_sub = (C((S("+-") + R("09"))^0) + Cc(0))
- * P(".")
- * (C((S("+-") + R("09"))^0) + Cc(0))
+local prefix_any = C((sign + space + period + digit)^0)
+local prefix_sub = (C((sign + digit)^0) + Cc(0))
+ * period
+ * (C((sign + digit)^0) + Cc(0))
local prefix_tab = P("{") * C((1-P("}"))^0) * P("}") + C((1-R("az","AZ","09","%%"))^0)
-- we've split all cases as then we can optimize them (let's omit the fuzzy u)
@@ -1097,7 +1107,7 @@ local builder = Cs { "start",
)
+ V("*")
)
- * (P(-1) + Carg(1))
+ * (endofstring + Carg(1))
)^0,
--
["s"] = (prefix_any * P("s")) / format_s, -- %s => regular %s (string)
@@ -1169,7 +1179,7 @@ local preset = {
}
local direct =
- P("%") * (S("+- .") + R("09"))^0 * S("sqidfgGeExXo") * P(-1)
+ P("%") * (sign + space + period + digit)^0 * S("sqidfgGeExXo") * endofstring
/ [[local format = string.format return function(str) return format("%0",str) end]]
local function make(t,str)
@@ -1298,8 +1308,8 @@ strings.formatters.add = add
-- registered in the default instance (should we fall back on this one?)
-patterns.xmlescape = Cs((P("<")/"&lt;" + P(">")/"&gt;" + P("&")/"&amp;" + P('"')/"&quot;" + P(1))^0)
-patterns.texescape = Cs((C(S("#$%\\{}"))/"\\%1" + P(1))^0)
+patterns.xmlescape = Cs((P("<")/"&lt;" + P(">")/"&gt;" + P("&")/"&amp;" + P('"')/"&quot;" + anything)^0)
+patterns.texescape = Cs((C(S("#$%\\{}"))/"\\%1" + anything)^0)
patterns.luaescape = Cs(((1-S('"\n'))^1 + P('"')/'\\"' + P('\n')/'\\n"')^0) -- maybe also \0
patterns.luaquoted = Cs(Cc('"') * ((1-S('"\n'))^1 + P('"')/'\\"' + P('\n')/'\\n"')^0 * Cc('"'))
@@ -1355,7 +1365,6 @@ end
local dquote = patterns.dquote -- P('"')
local equote = patterns.escaped + dquote / '\\"' + 1
-local space = patterns.space
local cquote = Cc('"')
local pattern =
diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml
index 606cd6c16..c0e2a99f0 100644
--- a/tex/context/interface/mkiv/context-en.xml
+++ b/tex/context/interface/mkiv/context-en.xml
@@ -36577,6 +36577,7 @@
</cd:arguments>
</cd:command>
<cd:command file="spac-ver.mkiv" level="system" name="setfontstrut"/>
+ <cd:command file="spac-ver.mkiv" level="system" name="settightstrut"/>
<cd:command file="spac-ver.mkiv" level="system" name="setcapstrut"/>
<cd:command file="spac-ver.mkiv" level="system" name="setnostrut"/>
<cd:command file="spac-ver.mkiv" level="document" name="showstruts"/>
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index aa9814dbc..e295410fa 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index 771aa2c6e..06c1e082c 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-strut.xml b/tex/context/interface/mkiv/i-strut.xml
index 0653dd214..d686d6ee0 100644
--- a/tex/context/interface/mkiv/i-strut.xml
+++ b/tex/context/interface/mkiv/i-strut.xml
@@ -52,6 +52,8 @@
<cd:command name="setfontstrut" level="system" file="spac-ver.mkiv"/>
+ <cd:command name="settightstrut" level="system" file="spac-ver.mkiv"/>
+
<cd:command name="setcapstrut" level="system" file="spac-ver.mkiv"/>
<cd:command name="setnostrut" level="system" file="spac-ver.mkiv"/>
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index b9f8a6db9..cc03cce12 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 08/30/18 18:41:24
+-- merge date : 09/01/18 23:10:26
do -- begin closure to overcome local limits and interference
@@ -3811,9 +3811,14 @@ local stripzero=patterns.stripzero
local stripzeros=patterns.stripzeros
local newline=patterns.newline
local endofstring=patterns.endofstring
+local anything=patterns.anything
local whitespace=patterns.whitespace
+local space=patterns.space
local spacer=patterns.spacer
local spaceortab=patterns.spaceortab
+local digit=patterns.digit
+local sign=patterns.sign
+local period=patterns.period
local ptf=1/65536
local bpf=(7200/7227)/65536
local function points(n)
@@ -3848,7 +3853,6 @@ number.points=points
number.basepoints=basepoints
local rubish=spaceortab^0*newline
local anyrubish=spaceortab+newline
-local anything=patterns.anything
local stripped=(spaceortab^1/"")*newline
local leading=rubish^0/""
local trailing=(anyrubish^1*endofstring)/""
@@ -3899,7 +3903,7 @@ local pattern=Carg(1)/function(t)
end
end+newline*Cp()/function(position)
extra,start=0,position
- end+patterns.anything
+ end+anything
)^1)
function strings.tabtospace(str,tab)
return lpegmatch(pattern,str,1,tab or 7)
@@ -3915,19 +3919,23 @@ function string.utfpadding(s,n)
return nspaces[-n-l]
end
end
-local space=spacer^0
-local nospace=space/""
+local optionalspace=spacer^0
+local nospace=optionalspace/""
local endofline=nospace*newline
local stripend=(whitespace^1*endofstring)/""
-local normalline=(nospace*((1-space*(newline+endofstring))^1)*nospace)
+local normalline=(nospace*((1-optionalspace*(newline+endofstring))^1)*nospace)
local stripempty=endofline^1/""
local normalempty=endofline^1
local singleempty=endofline*(endofline^0/"")
local doubleempty=endofline*endofline^-1*(endofline^0/"")
local stripstart=stripempty^0
+local intospace=whitespace^1/" "
+local noleading=whitespace^1/""
+local notrailing=noleading*endofstring
local p_prune_normal=Cs (stripstart*(stripend+normalline+normalempty )^0 )
local p_prune_collapse=Cs (stripstart*(stripend+normalline+doubleempty )^0 )
local p_prune_noempty=Cs (stripstart*(stripend+normalline+singleempty )^0 )
+local p_prune_intospace=Cs (noleading*(notrailing+intospace+1 )^0 )
local p_retain_normal=Cs ((normalline+normalempty )^0 )
local p_retain_collapse=Cs ((normalline+doubleempty )^0 )
local p_retain_noempty=Cs ((normalline+singleempty )^0 )
@@ -3935,6 +3943,7 @@ local striplinepatterns={
["prune"]=p_prune_normal,
["prune and collapse"]=p_prune_collapse,
["prune and no empty"]=p_prune_noempty,
+ ["prune and to space"]=p_prune_intospace,
["retain"]=p_retain_normal,
["retain and collapse"]=p_retain_collapse,
["retain and no empty"]=p_retain_noempty,
@@ -3945,6 +3954,9 @@ strings.striplinepatterns=striplinepatterns
function strings.striplines(str,how)
return str and lpegmatch(striplinepatterns[how],str) or str
end
+function strings.collapse(str)
+ return str and lpegmatch(p_prune_intospace,str) or str
+end
strings.striplong=strings.striplines
function strings.nice(str)
str=gsub(str,"[:%-+_]+"," ")
@@ -4002,16 +4014,14 @@ function number.signed(i)
return "-",-i
end
end
-local digit=patterns.digit
-local period=patterns.period
local two=digit*digit
local three=two*digit
local prefix=(Carg(1)*three)^1
local splitter=Cs (
- (((1-(three^1*period))^1+C(three))*prefix+C((1-period)^1))*(P(1)/""*Carg(2))*C(2)
+ (((1-(three^1*period))^1+C(three))*prefix+C((1-period)^1))*(anything/""*Carg(2))*C(2)
)
local splitter3=Cs (
- three*prefix*P(-1)+two*prefix*P(-1)+digit*prefix*P(-1)+three+two+digit
+ three*prefix*endofstring+two*prefix*endofstring+digit*prefix*endofstring+three+two+digit
)
patterns.formattednumber=splitter
function number.formatted(n,sep1,sep2)
@@ -4036,7 +4046,7 @@ function number.formatted(n,sep1,sep2)
end
end
local p=Cs(
- P("-")^0*(P("0")^1/"")^0*(1-P("."))^0*(P(".")*P("0")^1*P(-1)/""+P(".")^0)*P(1-P("0")^1*P(-1))^0
+ P("-")^0*(P("0")^1/"")^0*(1-period)^0*(period*P("0")^1*endofstring/""+period^0)*P(1-P("0")^1*endofstring)^0
)
function number.compactfloat(n,fmt)
if n==0 then
@@ -4053,12 +4063,11 @@ end
local zero=P("0")^1/""
local plus=P("+")/""
local minus=P("-")
-local separator=S(".")
-local digit=R("09")
+local separator=period
local trailing=zero^1*#S("eE")
-local exponent=(S("eE")*(plus+Cs((minus*zero^0*P(-1))/"")+minus)*zero^0*(P(-1)*Cc("0")+P(1)^1))
+local exponent=(S("eE")*(plus+Cs((minus*zero^0*endofstring)/"")+minus)*zero^0*(endofstring*Cc("0")+anything^1))
local pattern_a=Cs(minus^0*digit^1*(separator/""*trailing+separator*(trailing+digit)^0)*exponent)
-local pattern_b=Cs((exponent+P(1))^0)
+local pattern_b=Cs((exponent+anything)^0)
function number.sparseexponent(f,n)
if not n then
n=f
@@ -4163,8 +4172,8 @@ setmetatable(arguments,{ __index=function(t,k)
return v
end
})
-local prefix_any=C((S("+- .")+R("09"))^0)
-local prefix_sub=(C((S("+-")+R("09"))^0)+Cc(0))*P(".")*(C((S("+-")+R("09"))^0)+Cc(0))
+local prefix_any=C((sign+space+period+digit)^0)
+local prefix_sub=(C((sign+digit)^0)+Cc(0))*period*(C((sign+digit)^0)+Cc(0))
local prefix_tab=P("{")*C((1-P("}"))^0)*P("}")+C((1-R("az","AZ","09","%%"))^0)
local format_s=function(f)
n=n+1
@@ -4478,7 +4487,7 @@ local builder=Cs { "start",
+V(">")
+V("<")
)+V("*")
- )*(P(-1)+Carg(1))
+ )*(endofstring+Carg(1))
)^0,
["s"]=(prefix_any*P("s"))/format_s,
["q"]=(prefix_any*P("q"))/format_q,
@@ -4533,7 +4542,7 @@ local preset={
["%02x"]=function(n) return xx[n] end,
["%02X"]=function(n) return XX[n] end,
}
-local direct=P("%")*(S("+- .")+R("09"))^0*S("sqidfgGeExXo")*P(-1)/[[local format = string.format return function(str) return format("%0",str) end]]
+local direct=P("%")*(sign+space+period+digit)^0*S("sqidfgGeExXo")*endofstring/[[local format = string.format return function(str) return format("%0",str) end]]
local function make(t,str)
local f=preset[str]
if f then
@@ -4592,8 +4601,8 @@ local function add(t,name,template,preamble)
end
end
strings.formatters.add=add
-patterns.xmlescape=Cs((P("<")/"&lt;"+P(">")/"&gt;"+P("&")/"&amp;"+P('"')/"&quot;"+P(1))^0)
-patterns.texescape=Cs((C(S("#$%\\{}"))/"\\%1"+P(1))^0)
+patterns.xmlescape=Cs((P("<")/"&lt;"+P(">")/"&gt;"+P("&")/"&amp;"+P('"')/"&quot;"+anything)^0)
+patterns.texescape=Cs((C(S("#$%\\{}"))/"\\%1"+anything)^0)
patterns.luaescape=Cs(((1-S('"\n'))^1+P('"')/'\\"'+P('\n')/'\\n"')^0)
patterns.luaquoted=Cs(Cc('"')*((1-S('"\n'))^1+P('"')/'\\"'+P('\n')/'\\n"')^0*Cc('"'))
if oldfashioned then
@@ -4607,7 +4616,6 @@ else
end
local dquote=patterns.dquote
local equote=patterns.escaped+dquote/'\\"'+1
-local space=patterns.space
local cquote=Cc('"')
local pattern=Cs(dquote*(equote-P(-2))^0*dquote)
+Cs(cquote*(equote-space)^0*space*equote^0*cquote)
@@ -31112,7 +31120,7 @@ end
local start={ "pdf","mode","font" }
local push={ "pdf","page","q" }
local pop={ "pdf","page","Q" }
-if not LUATEXFUNCTIONALITY or LUATEXFUNCTIONALITY<6472 then
+if not LUATEXFUNCTIONALITY or LUATEXFUNCTIONALITY<6472 then
start={ "nop" }
end
local function initialize(tfmdata,kind,value)