summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv')
-rw-r--r--tex/context/base/mkiv/back-exp.lua6
-rw-r--r--tex/context/base/mkiv/buff-ini.lua10
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/data-tmp.lua2
-rw-r--r--tex/context/base/mkiv/font-cft.lua2
-rw-r--r--tex/context/base/mkiv/font-mis.lua2
-rw-r--r--tex/context/base/mkiv/font-ocm.lua12
-rw-r--r--tex/context/base/mkiv/font-osd.lua18
-rw-r--r--tex/context/base/mkiv/font-otl.lua5
-rw-r--r--tex/context/base/mkiv/font-oto.lua72
-rw-r--r--tex/context/base/mkiv/font-otr.lua68
-rw-r--r--tex/context/base/mkiv/font-ots.lua57
-rw-r--r--tex/context/base/mkiv/font-oup.lua109
-rw-r--r--tex/context/base/mkiv/font-ttf.lua10
-rw-r--r--tex/context/base/mkiv/good-gen.lua12
-rw-r--r--tex/context/base/mkiv/l-dir.lua12
-rw-r--r--tex/context/base/mkiv/l-io.lua3
-rw-r--r--tex/context/base/mkiv/l-lpeg.lua12
-rw-r--r--tex/context/base/mkiv/lpdf-wid.lua27
-rw-r--r--tex/context/base/mkiv/math-ini.lua14
-rw-r--r--tex/context/base/mkiv/math-map.lua6
-rw-r--r--tex/context/base/mkiv/mlib-mpf.lua25
-rw-r--r--tex/context/base/mkiv/mult-def.lua4
-rw-r--r--tex/context/base/mkiv/mult-fun.lua13
-rw-r--r--tex/context/base/mkiv/mult-low.lua2
-rw-r--r--tex/context/base/mkiv/page-mix.lua9
-rw-r--r--tex/context/base/mkiv/publ-dat.lua8
-rw-r--r--tex/context/base/mkiv/publ-fnd.lua4
-rw-r--r--tex/context/base/mkiv/spac-ver.lua26
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin24938 -> 24885 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin250485 -> 250312 bytes
-rw-r--r--tex/context/base/mkiv/strc-syn.lua22
-rw-r--r--tex/context/base/mkiv/util-prs.lua8
-rw-r--r--tex/context/base/mkiv/util-tab.lua14
35 files changed, 409 insertions, 189 deletions
diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua
index 51c32ec1d..4f29e09d6 100644
--- a/tex/context/base/mkiv/back-exp.lua
+++ b/tex/context/base/mkiv/back-exp.lua
@@ -325,9 +325,9 @@ local styletemplate = [[
local numbertoallign = {
[0] = "justify", ["0"] = "justify", [variables.normal ] = "justify",
- [1] = "right", ["1"] = "right", [variables.flushright] = "right",
- [2] = "center", ["2"] = "center", [variables.middle ] = "center",
- [3] = "left", ["3"] = "left", [variables.flushleft ] = "left",
+ "right", ["1"] = "right", [variables.flushright] = "right",
+ "center", ["2"] = "center", [variables.middle ] = "center",
+ "left", ["3"] = "left", [variables.flushleft ] = "left",
}
function wrapups.allusedstyles(filename)
diff --git a/tex/context/base/mkiv/buff-ini.lua b/tex/context/base/mkiv/buff-ini.lua
index 8a8ec67c7..6c844342a 100644
--- a/tex/context/base/mkiv/buff-ini.lua
+++ b/tex/context/base/mkiv/buff-ini.lua
@@ -121,6 +121,11 @@ local function exists(name)
return cache[name]
end
+local function getcontent(name)
+ local buffer = name and cache[name]
+ return buffer and buffer.data or ""
+end
+
local function empty(name)
if find(getcontent(name),"%S") then
return false
@@ -129,11 +134,6 @@ local function empty(name)
end
end
-local function getcontent(name)
- local buffer = name and cache[name]
- return buffer and buffer.data or ""
-end
-
local function getlines(name)
local buffer = name and cache[name]
return buffer and splitlines(buffer.data)
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 61325b615..da7aa9dc0 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2021.08.10 12:37}
+\newcontextversion{2021.08.19 19:40}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 74e3cea56..d837240b4 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -45,7 +45,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2021.08.10 12:37}
+\edef\contextversion{2021.08.19 19:40}
%D Kind of special:
diff --git a/tex/context/base/mkiv/data-tmp.lua b/tex/context/base/mkiv/data-tmp.lua
index 9a8a586cd..1948f1ea5 100644
--- a/tex/context/base/mkiv/data-tmp.lua
+++ b/tex/context/base/mkiv/data-tmp.lua
@@ -74,7 +74,7 @@ local usedreadables = { }
local compilelua = luautilities.compile
local luasuffixes = luautilities.suffixes
-caches.base = caches.base or "luatex-cache" -- can be local
+caches.base = caches.base or (LUATEXENGINE and LUATEXENGINE .. "-cache") or "luatex-cache" -- can be local
caches.more = caches.more or "context" -- can be local
caches.defaults = { "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" }
diff --git a/tex/context/base/mkiv/font-cft.lua b/tex/context/base/mkiv/font-cft.lua
index cf6c232a6..267c63f7a 100644
--- a/tex/context/base/mkiv/font-cft.lua
+++ b/tex/context/base/mkiv/font-cft.lua
@@ -439,7 +439,7 @@ do
},
colorschemes = {
default = {
- [1] = { t_string },
+ { t_string },
}
},
files = {
diff --git a/tex/context/base/mkiv/font-mis.lua b/tex/context/base/mkiv/font-mis.lua
index a72f1bf42..9bb8d4cc1 100644
--- a/tex/context/base/mkiv/font-mis.lua
+++ b/tex/context/base/mkiv/font-mis.lua
@@ -21,7 +21,7 @@ local readers = otf.readers
if readers then
- otf.version = otf.version or 3.118
+ otf.version = otf.version or 3.119
otf.cache = otf.cache or containers.define("fonts", "otl", otf.version, true)
function fonts.helpers.getfeatures(name,save)
diff --git a/tex/context/base/mkiv/font-ocm.lua b/tex/context/base/mkiv/font-ocm.lua
index ef0b02a14..e54799b23 100644
--- a/tex/context/base/mkiv/font-ocm.lua
+++ b/tex/context/base/mkiv/font-ocm.lua
@@ -40,16 +40,16 @@ callback.register("provide_charproc_data",function(action,f,...)
end)
local defaults = {
- [1] = function() return 0, 0 end,
- [2] = function() return 0, 0 end,
- [3] = function() return 0.001, "" end,
+ function() return 0, 0 end,
+ function() return 0, 0 end,
+ function() return 0.001, "" end,
}
local function registeractions(t)
return {
- [1] = t.preroll or defaults[1],
- [2] = t.collect or defaults[2],
- [3] = t.wrapup or defaults[3],
+ t.preroll or defaults[1],
+ t.collect or defaults[2],
+ t.wrapup or defaults[3],
}
end
diff --git a/tex/context/base/mkiv/font-osd.lua b/tex/context/base/mkiv/font-osd.lua
index a9ea878c0..b4e753182 100644
--- a/tex/context/base/mkiv/font-osd.lua
+++ b/tex/context/base/mkiv/font-osd.lua
@@ -630,7 +630,8 @@ local function initializedevanagi(tfmdata)
local h = coverage[k]
if h then
for k, v in next, h do
- found = v and v.ligature
+ -- found = v and v.ligature
+ found = v and (tonumber(v) or v.ligature)
if found then
pre_base_reordering_consonants[found] = true
break
@@ -647,7 +648,8 @@ local function initializedevanagi(tfmdata)
end
else
for k, v in next, r do
- found = v and v.ligature
+ -- found = v and v.ligature
+ found = v and (tonumber(v) or v.ligature)
if found then
pre_base_reordering_consonants[found] = true
break
@@ -696,7 +698,8 @@ local function initializedevanagi(tfmdata)
for k, v in next, halant do
local h = r[k]
if h then
- reph = h.ligature or false
+ -- reph = h.ligature or false
+ reph = tonumber(h) or h.ligature or false
break
end
end
@@ -713,7 +716,8 @@ local function initializedevanagi(tfmdata)
for k, v in next, halant do
local h = r[k]
if h then
- reph = h.ligature or false
+ -- reph = h.ligature or false
+ reph = tonumber(h) or h.ligature or false
break
end
end
@@ -757,7 +761,8 @@ local function initializedevanagi(tfmdata)
local h = coverage[k]
if h then
for k, v in next, h do
- found = v and v.ligature
+ -- found = v and v.ligature
+ found = v and (tonumber(v) or v.ligature)
if found then
pre_base_reordering_consonants[found] = true
break
@@ -774,7 +779,8 @@ local function initializedevanagi(tfmdata)
end
else
for k, v in next, h do
- found = v and v.ligature
+ -- found = v and v.ligature
+ found = v and (tonumber(v) or v.ligature)
if found then
pre_base_reordering_consonants[found] = true
break
diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua
index 74f209b0a..ae2dda4f3 100644
--- a/tex/context/base/mkiv/font-otl.lua
+++ b/tex/context/base/mkiv/font-otl.lua
@@ -52,7 +52,7 @@ local report_otf = logs.reporter("fonts","otf loading")
local fonts = fonts
local otf = fonts.handlers.otf
-otf.version = 3.118 -- beware: also sync font-mis.lua and in mtx-fonts
+otf.version = 3.119 -- beware: also sync font-mis.lua and in mtx-fonts
otf.cache = containers.define("fonts", "otl", otf.version, true)
otf.svgcache = containers.define("fonts", "svg", otf.version, true)
otf.pngcache = containers.define("fonts", "png", otf.version, true)
@@ -218,6 +218,9 @@ function otf.load(filename,sub,instance)
if cleanup == 0 then
checkmemory(used,threshold,tracememory)
end
+ if context then
+ otfreaders.condense(data)
+ end
otfreaders.pack(data)
report_otf("loading done")
report_otf("saving %a in cache",filename)
diff --git a/tex/context/base/mkiv/font-oto.lua b/tex/context/base/mkiv/font-oto.lua
index 6f5f2fb41..0f667bcc2 100644
--- a/tex/context/base/mkiv/font-oto.lua
+++ b/tex/context/base/mkiv/font-oto.lua
@@ -170,7 +170,7 @@ end
local function makefake(tfmdata,name,present)
local private = getprivate(tfmdata)
local character = { intermediate = true, ligatures = { } }
- resources.unicodes[name] = private
+ tfmdata.resources.unicodes[name] = private
tfmdata.characters[private] = character
tfmdata.descriptions[private] = { name = name }
present[name] = private
@@ -178,43 +178,55 @@ local function makefake(tfmdata,name,present)
end
local function make_1(present,tree,name)
- for k, v in next, tree do
- if k == "ligature" then
- present[name] = v
+ if tonumber(tree) then
+ present[name] = v
+ else
+ for k, v in next, tree do
+ if k == "ligature" then
+ present[name] = v
+ else
+ make_1(present,v,name .. "_" .. k)
+ end
+ end
+ end
+end
+
+local function make_3(present,tfmdata,characters,tree,name,preceding,unicode,done,v)
+ local character = characters[preceding]
+ if not character then
+ if trace_baseinit then
+ report_prepare("weird ligature in lookup %a, current %C, preceding %C",sequence.name,v,preceding)
+ end
+ character = makefake(tfmdata,name,present)
+ end
+ local ligatures = character.ligatures
+ if ligatures then
+ ligatures[unicode] = { char = v }
+ else
+ character.ligatures = { [unicode] = { char = v } }
+ end
+ if done then
+ local d = done[name]
+ if not d then
+ done[name] = { "dummy", v }
else
- make_1(present,v,name .. "_" .. k)
+ d[#d+1] = v
end
end
end
local function make_2(present,tfmdata,characters,tree,name,preceding,unicode,done)
- for k, v in next, tree do
- if k == "ligature" then
- local character = characters[preceding]
- if not character then
- if trace_baseinit then
- report_prepare("weird ligature in lookup %a, current %C, preceding %C",sequence.name,v,preceding)
- end
- character = makefake(tfmdata,name,present)
- end
- local ligatures = character.ligatures
- if ligatures then
- ligatures[unicode] = { char = v }
+ if tonumber(tree) then
+ make_3(present,tfmdata,characters,tree,name,preceding,unicode,done,tree)
+ else
+ for k, v in next, tree do
+ if k == "ligature" then
+ make_3(present,tfmdata,characters,tree,name,preceding,unicode,done,v)
else
- character.ligatures = { [unicode] = { char = v } }
+ local code = present[name] or unicode
+ local name = name .. "_" .. k
+ make_2(present,tfmdata,characters,v,name,code,k,done)
end
- if done then
- local d = done[name]
- if not d then
- done[name] = { "dummy", v }
- else
- d[#d+1] = v
- end
- end
- else
- local code = present[name] or unicode
- local name = name .. "_" .. k
- make_2(present,tfmdata,characters,v,name,code,k,done)
end
end
end
diff --git a/tex/context/base/mkiv/font-otr.lua b/tex/context/base/mkiv/font-otr.lua
index 2f8934508..3b5edebc4 100644
--- a/tex/context/base/mkiv/font-otr.lua
+++ b/tex/context/base/mkiv/font-otr.lua
@@ -682,15 +682,15 @@ local weights = {
}
local widths = {
- [1] = "ultracondensed",
- [2] = "extracondensed",
- [3] = "condensed",
- [4] = "semicondensed",
- [5] = "normal",
- [6] = "semiexpanded",
- [7] = "expanded",
- [8] = "extraexpanded",
- [9] = "ultraexpanded",
+ "ultracondensed",
+ "extracondensed",
+ "condensed",
+ "semicondensed",
+ "normal",
+ "semiexpanded",
+ "expanded",
+ "extraexpanded",
+ "ultraexpanded",
}
setmetatableindex(weights, function(t,k)
@@ -703,31 +703,31 @@ setmetatableindex(widths,function(t,k)
return "normal"
end)
-local panoseweights = {
- [ 0] = "normal",
- [ 1] = "normal",
- [ 2] = "verylight",
- [ 3] = "light",
- [ 4] = "thin",
- [ 5] = "book",
- [ 6] = "medium",
- [ 7] = "demi",
- [ 8] = "bold",
- [ 9] = "heavy",
- [10] = "black",
+local panoseweights = { [0] =
+ "normal",
+ "normal",
+ "verylight",
+ "light",
+ "thin",
+ "book",
+ "medium",
+ "demi",
+ "bold",
+ "heavy",
+ "black",
}
-local panosewidths = {
- [ 0] = "normal",
- [ 1] = "normal",
- [ 2] = "normal",
- [ 3] = "normal",
- [ 4] = "normal",
- [ 5] = "expanded",
- [ 6] = "condensed",
- [ 7] = "veryexpanded",
- [ 8] = "verycondensed",
- [ 9] = "monospaced",
+local panosewidths = { [0] =
+ "normal",
+ "normal",
+ "normal",
+ "normal",
+ "normal",
+ "expanded",
+ "condensed",
+ "veryexpanded",
+ "verycondensed",
+ "monospaced",
}
-- We implement a reader per table.
@@ -2522,6 +2522,10 @@ function readers.compact(fontdata)
report("the %a helper is not yet implemented","compact")
end
+function readers.condense(fontdata)
+ report("the %a helper is not yet implemented","condense")
+end
+
-- plug in
local extenders = { }
diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua
index 30d79c407..8e8be6f95 100644
--- a/tex/context/base/mkiv/font-ots.lua
+++ b/tex/context/base/mkiv/font-ots.lua
@@ -763,7 +763,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
while current do
local char = ischar(current,currentfont)
if char then
- local lg = ligature[char]
+ local lg = not tonumber(ligature) and ligature[char]
if lg then
stop = current
ligature = lg
@@ -776,14 +776,14 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
end
end
if stop then
- local lig = ligature.ligature
- if lig then
+ local ligature = tonumber(ligature) or ligature.ligature
+ if ligature then
if trace_ligatures then
local stopchar = getchar(stop)
- head, start = markstoligature(head,start,stop,lig)
+ head, start = markstoligature(head,start,stop,ligature)
logprocess("%s: replacing %s upto %s by ligature %s case 1",pref(dataset,sequence),gref(startchar),gref(stopchar),gref(getchar(start)))
else
- head, start = markstoligature(head,start,stop,lig)
+ head, start = markstoligature(head,start,stop,ligature)
end
return head, start, true, false
else
@@ -799,7 +799,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
if skiphash and skiphash[char] then
current = getnext(current)
else
- local lg = ligature[char]
+ local lg = not tonumber(ligature) and ligature[char]
if lg then
if marks[char] then
hasmarks = true
@@ -833,20 +833,20 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
local match
if replace then
local char = ischar(replace,currentfont)
- if char and ligature[char] then
+ if char and (not tonumber(ligature) and ligature[char]) then
match = true
end
end
if not match and pre then
local char = ischar(pre,currentfont)
- if char and ligature[char] then
+ if char and (not tonumber(ligature) and ligature[char]) then
match = true
end
end
if not match and not pre or not replace then
local n = getnext(discfound)
local char = ischar(n,currentfont)
- if char and ligature[char] then
+ if char and (not tonumber(ligature) and ligature[char]) then
match = true
end
end
@@ -890,24 +890,26 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
return head, start, true, true
end
end
- local lig = ligature.ligature
- if lig then
+ local ligature = tonumber(ligature) or ligature.ligature
+ if ligature then
if stop then
if trace_ligatures then
local stopchar = getchar(stop)
- -- head, start = toligature(head,start,stop,lig,dataset,sequence,skiphash,discfound,hasmarks)
- head, start = toligature(head,start,stop,lig,dataset,sequence,skiphash,false,hasmarks)
- logprocess("%s: replacing %s upto %s by ligature %s case 2",pref(dataset,sequence),gref(startchar),gref(stopchar),gref(lig))
+ -- head, start = toligature(head,start,stop,ligature,dataset,sequence,skiphash,discfound,hasmarks)
+ head, start = toligature(head,start,stop,ligature,dataset,sequence,skiphash,false,hasmarks)
+ logprocess("%s: replacing %s upto %s by ligature %s case 2",pref(dataset,sequence),gref(startchar),gref(stopchar),gref(ligature))
+ -- we can have a rare case of multiple disc in a lig but that makes no sense language wise but if really
+ -- needed we could backtrack if we're in a disc node
else
- -- head, start = toligature(head,start,stop,lig,dataset,sequence,skiphash,discfound,hasmarks)
- head, start = toligature(head,start,stop,lig,dataset,sequence,skiphash,false,hasmarks)
+ -- head, start = toligature(head,start,stop,ligature,dataset,sequence,skiphash,discfound,hasmarks)
+ head, start = toligature(head,start,stop,ligature,dataset,sequence,skiphash,false,hasmarks)
end
else
-- weird but happens (in some arabic font)
resetinjection(start)
- setchar(start,lig)
+ setchar(start,ligature)
if trace_ligatures then
- logprocess("%s: replacing %s by (no real) ligature %s case 3",pref(dataset,sequence),gref(startchar),gref(lig))
+ logprocess("%s: replacing %s by (no real) ligature %s case 3",pref(dataset,sequence),gref(startchar),gref(ligature))
end
end
return head, start, true, false
@@ -1484,7 +1486,7 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup
current = getnext(current)
-- end
else
- local lg = ligatures[schar]
+ local lg = not tonumber(ligatures) and ligatures[schar]
if lg then
ligatures = lg
last = current
@@ -1503,7 +1505,7 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup
end
end
end
- local ligature = ligatures.ligature
+ local ligature = tonumber(ligatures) or ligatures.ligature
if ligature then
if chainindex then
stop = last
@@ -1978,7 +1980,9 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck)
local chainproc = chainprocs[chainkind]
if chainproc then
local ok
- head, start, ok = chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash)
+ -- HH: chainindex 1 added here (for KAI to check too), there are weird ligatures e.g.
+ -- char + mark -> char where mark has to disappear
+ head, start, ok = chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,1)
if ok then
done = true
end
@@ -2471,6 +2475,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
local ck = contexts[k]
local seq = ck[3]
local f = ck[4] -- first current
+local last = start
if not startchar or not seq[f][startchar] then
-- report("no hit in %a at %i of %i contexts",sequence.type,k,nofcontexts)
goto next
@@ -2481,7 +2486,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
else
local l = ck[5] -- last current
local current = start
- local last = start
+-- local last = start
-- current match
@@ -3409,7 +3414,7 @@ local function t_run_single(start,stop,font,attr,lookupcache)
while s do
local char = ischar(s,font)
if char then
- local lg = lookupmatch[char]
+ local lg = not tonumber(lookupmatch) and lookupmatch[char]
if lg then
if sstop then
d = 1
@@ -3439,7 +3444,7 @@ local function t_run_single(start,stop,font,attr,lookupcache)
break
end
end
- if l and l.ligature then -- so we test for ligature
+ if l and (tonumber(l) or l.ligature) then -- so we test for ligature
lastd = d
end
-- why not: if not l then break elseif l.ligature then return d end
@@ -3580,7 +3585,7 @@ local function t_run_multiple(start,stop,font,attr,steps,nofsteps)
while s do
local char = ischar(s)
if char then
- local lg = lookupmatch[char]
+ local lg = not tonumber(lookupmatch) and lookupmatch[char]
if lg then
if sstop then
d = 1
@@ -3610,7 +3615,7 @@ local function t_run_multiple(start,stop,font,attr,steps,nofsteps)
break
end
end
- if l and l.ligature then
+ if l and (tonumber(l) or l.ligature) then
lastd = d
end
end
diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua
index 4e70bf936..4c3d562c2 100644
--- a/tex/context/base/mkiv/font-oup.lua
+++ b/tex/context/base/mkiv/font-oup.lua
@@ -44,6 +44,9 @@ directives.register("otf.checksofthyphen",function(v)
check_soft_hyphen = v -- only for testing
end)
+-- After (!) the unicodes have been resolved we compact ligature tables so before that happens
+-- we don't need to check for numbers.
+
local function replaced(list,index,replacement)
if type(list) == "number" then
return replacement
@@ -1043,6 +1046,10 @@ function readers.getcomponents(fontdata) -- handy for resolving ligatures when n
local function traverse(p,k,v)
if k == "ligature" then
collected[v] = { unpack(l) }
+ elseif tonumber(v) then
+ insert(l,k)
+ collected[v] = { unpack(l) }
+ remove(l)
else
insert(l,k)
for k, vv in next, v do
@@ -1230,7 +1237,6 @@ local function tabstr_flat(t)
end
local function tabstr_mixed(t) -- indexed
- local s = { }
local n = #t
if n == 0 then
return ""
@@ -1244,6 +1250,7 @@ local function tabstr_mixed(t) -- indexed
return tostring(k) -- number or string
end
else
+ local s = { }
for i=1,n do
local k = t[i]
if k == true then
@@ -1353,6 +1360,21 @@ function readers.pack(data)
end
end
+ -- local function pack_indexed(v) -- less code
+ -- local tag = concat(v," ")
+ -- local ht = h[tag]
+ -- if ht then
+ -- c[ht] = c[ht] + 1
+ -- else
+ -- ht = nt + 1
+ -- t[ht] = v
+ -- c[ht] = 1
+ -- h[tag] = ht
+ -- nt = ht
+ -- end
+ -- return ht
+ -- end
+
local function pack_mixed(v)
local tag = tabstr_mixed(v)
local ht = h[tag]
@@ -2801,6 +2823,91 @@ function readers.compact(data)
end
end
+if CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0 then
+
+ local done = 0
+
+ local function condense_1(k,v,t)
+ if type(v) == "table" then
+ local u = false
+ local l = false
+ for k, v in next, v do
+ if k == "ligature" then
+ l = v
+ if u then
+ break
+ end
+ elseif u then
+ break
+ else
+ u = true
+ end
+ end
+ if l and not u then
+ t[k] = l
+ done = done + 1
+ end
+ if u then
+ for k, vv in next, v do
+ if k ~= "ligature" then
+ condense_1(k,vv,v)
+ end
+ end
+ end
+ end
+ end
+
+ local function condensesteps_1(lookup)
+ done = 0
+ if lookup.type == "gsub_ligature" then
+ local steps = lookup.steps
+ if steps then
+ for i=1,#steps do
+ local step = steps[i]
+ local coverage = step.coverage
+ if coverage then
+ for k, v in next, coverage do
+ if condense_1(k,v,coverage) then
+ coverage[k] = v.ligature
+ done = done + 1
+ end
+ end
+ end
+ end
+ end
+ end
+ return done
+ end
+
+ function readers.condense(data)
+ if not data or data.condensed then
+ return
+ else
+ data.condensed = true
+ end
+ local resources = data.resources
+ local condensed = 0
+ local function condense(what)
+ local lookups = resources[what]
+ if lookups then
+ for i=1,#lookups do
+ condensed = condensed + condensesteps_1(lookups[i])
+ end
+ elseif trace_optimizations then
+ report_optimizations("no lookups in %a",what)
+ end
+ end
+ condense("sequences")
+ condense("sublookups")
+ if trace_optimizations then
+ if condensed > 0 then
+ report_optimizations("%i ligatures condensed",condensed)
+ end
+ end
+ end
+
+end
+
local function mergesteps(t,k)
if k == "merged" then
local merged = { }
diff --git a/tex/context/base/mkiv/font-ttf.lua b/tex/context/base/mkiv/font-ttf.lua
index d8abed329..fc987d74c 100644
--- a/tex/context/base/mkiv/font-ttf.lua
+++ b/tex/context/base/mkiv/font-ttf.lua
@@ -269,6 +269,16 @@ local function applyaxis(glyph,shape,deltas,dowidth)
else
local n1 = dpoints[d1]
local n3 = dpoints[d3]
+ -- Some day I need to figure out these extra points but
+ -- I'll wait till the standard is more clear and fonts
+ -- become better (ntg-context: fraunces.ttf > abcdef).
+ if n1 > nofpoints then
+ n1 = nofpoints
+ end
+ if n3 > nofpoints then
+ n3 = nofpoints
+ end
+ --
local p1 = points[n1]
local p3 = points[n3]
local p1x = p1[1]
diff --git a/tex/context/base/mkiv/good-gen.lua b/tex/context/base/mkiv/good-gen.lua
index cee6b3172..1747727c1 100644
--- a/tex/context/base/mkiv/good-gen.lua
+++ b/tex/context/base/mkiv/good-gen.lua
@@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['good-gen'] = {
local type, next = type, next
local lower = string.lower
-
+local filesuffix, replacesuffix = file.suffix, file.replacesuffix
local fonts = fonts
----- trace_goodies = false trackers.register("fonts.goodies", function(v) trace_goodies = v end)
@@ -134,6 +134,16 @@ function fontgoodies.filenames.resolve(name)
return fn
end
end
+ elseif filesuffix(name) == "any" then
+ -- This is a bit weird place but it's a kind of fallback option in case
+ -- we can't resolve due to a name conflict.
+ local sequence = fonts.readers.sequence
+ for i=1,#sequence do
+ local fn = replacesuffix(name,sequence[i])
+ if findfile(fn) ~= "" then
+ return fn
+ end
+ end
else
-- no lookup, just use the regular mechanism
end
diff --git a/tex/context/base/mkiv/l-dir.lua b/tex/context/base/mkiv/l-dir.lua
index 325039cb1..ac8e2f4e8 100644
--- a/tex/context/base/mkiv/l-dir.lua
+++ b/tex/context/base/mkiv/l-dir.lua
@@ -230,18 +230,18 @@ if onwindows then -- we could sanitize here
-- pattern = Ct {
pattern = {
- [1] = (Cs(P(".") + slash^1) + Cs(R("az","AZ") * P(":") * slash^0) + Cc("./")) * V(2) * V(3),
- [2] = Cs(((1-S("*?/\\"))^0 * slash)^0),
- [3] = Cs(P(1)^0)
+ (Cs(P(".") + slash^1) + Cs(R("az","AZ") * P(":") * slash^0) + Cc("./")) * V(2) * V(3),
+ Cs(((1-S("*?/\\"))^0 * slash)^0),
+ Cs(P(1)^0)
}
else -- assume unix
-- pattern = Ct {
pattern = {
- [1] = (C(P(".") + P("/")^1) + Cc("./")) * V(2) * V(3),
- [2] = C(((1-S("*?/"))^0 * P("/"))^0),
- [3] = C(P(1)^0)
+ (C(P(".") + P("/")^1) + Cc("./")) * V(2) * V(3),
+ C(((1-S("*?/"))^0 * P("/"))^0),
+ C(P(1)^0)
}
end
diff --git a/tex/context/base/mkiv/l-io.lua b/tex/context/base/mkiv/l-io.lua
index f72995abd..6bf7a97bd 100644
--- a/tex/context/base/mkiv/l-io.lua
+++ b/tex/context/base/mkiv/l-io.lua
@@ -291,7 +291,8 @@ end
io.noflines = noflines
--- inlined is faster ... beware, better use util-fil
+-- inlined is faster ... beware, better use util-fil so these are obsolete
+-- and will go
local nextchar = {
[ 4] = function(f)
diff --git a/tex/context/base/mkiv/l-lpeg.lua b/tex/context/base/mkiv/l-lpeg.lua
index 77e5cf12d..5f3bea08c 100644
--- a/tex/context/base/mkiv/l-lpeg.lua
+++ b/tex/context/base/mkiv/l-lpeg.lua
@@ -665,12 +665,12 @@ end
-- lpeg.print(lpeg.P("a","b","c"))
-- lpeg.print(lpeg.S("a","b","c"))
--- print(lpeg.counter("äáàa",lpeg.P("á") + lpeg.P("à")))
--- print(lpeg.counter("äáàa",lpeg.UP("áà")))
--- print(lpeg.counter("äáàa",lpeg.US("àá")))
--- print(lpeg.counter("äáàa",lpeg.UR("aá")))
--- print(lpeg.counter("äáàa",lpeg.UR("àá")))
--- print(lpeg.counter("äáàa",lpeg.UR(0x0000,0xFFFF)))
+-- print(lpeg.counter(lpeg.P("á") + lpeg.P("à"))("äáàa"))
+-- print(lpeg.counter(lpeg.UP("áà"))("äáàa"))
+-- print(lpeg.counter(lpeg.US("àá"))("äáàa"))
+-- print(lpeg.counter(lpeg.UR("aá"))("äáàa"))
+-- print(lpeg.counter(lpeg.UR("àá"))("äáàa"))
+-- print(lpeg.counter(lpeg.UR(0x0000,0xFFFF)))
function lpeg.is_lpeg(p)
return p and lpegtype(p) == "pattern"
diff --git a/tex/context/base/mkiv/lpdf-wid.lua b/tex/context/base/mkiv/lpdf-wid.lua
index 1e91ecd56..e856ddaf4 100644
--- a/tex/context/base/mkiv/lpdf-wid.lua
+++ b/tex/context/base/mkiv/lpdf-wid.lua
@@ -25,7 +25,7 @@ if not modules then modules = { } end modules ['lpdf-wid'] = {
-- html5 media in pdf then.
--
-- See mail by Michal Vlasák to the mailing list that discusses current support in
--- viewers and also mentions a few fixes wrt embedding media.
+-- viewers and also mentions (and submitted) a few fixes wrt embedding media.
local tonumber, next = tonumber, next
local gmatch, gsub, find, lower = string.gmatch, string.gsub, string.find, string.lower
@@ -60,6 +60,7 @@ local v_auto = variables.auto
local v_embed = variables.embed
local v_max = variables.max
local v_yes = variables.yes
+local v_compress = variables.compress
local pdfconstant = lpdf.constant
local pdfnull = lpdf.null
@@ -649,6 +650,7 @@ local function insertrenderingwindow(specification)
Subtype = pdfconstant("Screen"),
P = pdfreference(pdfpagereference(page)),
A = a, -- needed in order to make the annotation clickable (i.e. don't bark)
+ T = pdfunicode(label), -- for JS
Border = bs,
C = bc,
AA = actions,
@@ -662,7 +664,7 @@ end
-- some dictionaries can have a MH (must honor) or BE (best effort) capsule
local function insertrendering(specification)
- local label = specification.label
+ local label = specification.label
local option = settings_to_hash(specification.option)
if not mf[label] then
local filename = specification.filename
@@ -693,7 +695,7 @@ local function insertrendering(specification)
-- }
-- }
local parameters = pdfdictionary {
- Type = pdfconstant(MediaPermissions),
+ Type = pdfconstant("MediaPermissions"),
TF = pdfstring("TEMPALWAYS"), -- TEMPNEVER TEMPEXTRACT TEMPACCESS TEMPALWAYS / needed for acrobat/wmp
}
local descriptor = pdfdictionary {
@@ -707,7 +709,7 @@ local function insertrendering(specification)
descriptor = codeinjections.embedfile {
file = filename,
mimetype = mimetype, -- yes or no
- compress = false,
+ compress = option[v_compress] or false,
forcereference = true,
}
end
@@ -723,7 +725,7 @@ local function insertrendering(specification)
local rendition = pdfdictionary {
Type = pdfconstant("Rendition"),
S = pdfconstant("MR"),
- N = label,
+ N = pdfunicode(label),
C = pdfreference(pdfflushobject(clip)),
}
mf[label] = pdfreference(pdfflushobject(rendition))
@@ -761,6 +763,21 @@ function codeinjections.processrendering(label)
end
end
+-- needed mapping for access from JS
+
+local function flushrenderings()
+ if next(mf) then
+ local r = pdfarray()
+ for label, reference in sortedhash(mf) do
+ r[#r+1] = pdfunicode(label)
+ r[#r+1] = reference -- already a reference
+ end
+ lpdf.addtonames("Renditions",pdfreference(pdfflushobject(pdfdictionary{ Names = r })))
+ end
+end
+
+lpdf.registerdocumentfinalizer(flushrenderings,"renderings")
+
function codeinjections.insertrenderingwindow(specification)
local label = specification.label
codeinjections.processrendering(label)
diff --git a/tex/context/base/mkiv/math-ini.lua b/tex/context/base/mkiv/math-ini.lua
index 19bf86802..2a8129ca7 100644
--- a/tex/context/base/mkiv/math-ini.lua
+++ b/tex/context/base/mkiv/math-ini.lua
@@ -120,13 +120,13 @@ local accents = allocate {
local codes = allocate {
ordinary = 0, [0] = "ordinary",
- largeoperator = 1, [1] = "largeoperator",
- binaryoperator = 2, [2] = "binaryoperator",
- relation = 3, [3] = "relation",
- openingsymbol = 4, [4] = "openingsymbol",
- closingsymbol = 5, [5] = "closingsymbol",
- punctuation = 6, [6] = "punctuation",
- variable = 7, [7] = "variable",
+ largeoperator = 1, "largeoperator",
+ binaryoperator = 2, "binaryoperator",
+ relation = 3, "relation",
+ openingsymbol = 4, "openingsymbol",
+ closingsymbol = 5, "closingsymbol",
+ punctuation = 6, "punctuation",
+ variable = 7, "variable",
}
local extensibles = allocate {
diff --git a/tex/context/base/mkiv/math-map.lua b/tex/context/base/mkiv/math-map.lua
index 97860b923..5f93b43fc 100644
--- a/tex/context/base/mkiv/math-map.lua
+++ b/tex/context/base/mkiv/math-map.lua
@@ -689,9 +689,9 @@ local issygreek = regular_tf.symbols
local isgreek = merged(islcgreek,isucgreek,issygreek)
local greekremapping = {
- [1] = { what = "unchanged" }, -- upright
- [2] = { what = "upright", it = "tf", bi = "bf" }, -- upright
- [3] = { what = "italic", tf = "it", bf = "bi" }, -- italic
+ { what = "unchanged" }, -- upright
+ { what = "upright", it = "tf", bi = "bf" }, -- upright
+ { what = "italic", tf = "it", bf = "bi" }, -- italic
}
local usedremap = { }
diff --git a/tex/context/base/mkiv/mlib-mpf.lua b/tex/context/base/mkiv/mlib-mpf.lua
index 7452c0111..7e2a01ffb 100644
--- a/tex/context/base/mkiv/mlib-mpf.lua
+++ b/tex/context/base/mkiv/mlib-mpf.lua
@@ -247,7 +247,7 @@ do
-- writers
- local function mpp(value)
+ local function rawmpp(value)
n = n + 1
local t = type(value)
if t == "number" then
@@ -268,13 +268,13 @@ do
local function mpprint(first,second,...)
if second == nil then
if first ~= nil then
- mpp(first)
+ rawmpp(first)
end
else
for i=1,select("#",first,second,...) do
local value = (select(i,first,second,...))
if value ~= nil then
- mpp(value)
+ rawmpp(value)
end
end
end
@@ -653,6 +653,25 @@ do
for k, v in next, aux do mp[k] = v end
+ -- mp.print = table.setmetatablecall(aux, function(t,...)
+ -- mpprint(...)
+ -- end)
+
+ mp.print = table.setmetatablecall(aux, function(t,first,second,...)
+ if second == nil then
+ if first ~= nil then
+ rawmpp(first)
+ end
+ else
+ for i=1,select("#",first,second,...) do
+ local value = (select(i,first,second,...))
+ if value ~= nil then
+ rawmpp(value)
+ end
+ end
+ end
+ end)
+
end
do
diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua
index af7804506..a06deffe5 100644
--- a/tex/context/base/mkiv/mult-def.lua
+++ b/tex/context/base/mkiv/mult-def.lua
@@ -15390,6 +15390,10 @@ return {
["pe"]="eight",
["ro"]="eight",
},
+ ["compress"]={
+ ["en"]="compress",
+ ["nl"]="comprimeer",
+ },
["embed"]={
["en"]="embed",
["fr"]="integrer",
diff --git a/tex/context/base/mkiv/mult-fun.lua b/tex/context/base/mkiv/mult-fun.lua
index 50ced6ead..9f6c8456c 100644
--- a/tex/context/base/mkiv/mult-fun.lua
+++ b/tex/context/base/mkiv/mult-fun.lua
@@ -189,10 +189,17 @@ return {
"setmacro", "setdimen", "setcount", "settoks",
"setglobalmacro", "setglobaldimen", "setglobalcount", "setglobaltoks",
--
- "positionpath", "positioncurve", "positionxy", "positionpxy",
- "positionwhd", "positionpage", "positionregion", "positionbox",
+ "positionpath", "positioncurve", "positionxy", "positionparagraph", "positioncolumn",
+ "positionwhd", "positionpage", "positionregion", "positionbox", "positionx", "positiony",
"positionanchor", "positioninregion", "positionatanchor",
--
+ "getposboxesv, getmultipars",
+ "getpospage", "getposparagraph", "getposcolumn", "getposregion",
+ "getposx", "getposy", "getposwidth", "getposheight", "getposdepth",
+ "getposleftskip", "getposrightskip", "getposhsize", "getposparindent", "getposhangindent", "getposhangafter",
+ "getposxy", "getposupperleft", "getposlowerleft", "getposupperright", "getposlowerright".
+ "getposllx", "getposlly", "getposurx", "getposury" ;
+ --
"wdpart", "htpart", "dppart",
--
"texvar", "texstr",
@@ -201,7 +208,7 @@ return {
--
"utfnum", "utflen", "utfsub",
--
- "newhash", "disposehash", "inhash", "tohash",
+ "newhash", "disposehash", "inhash", "tohash", "fromhash",
--
"isarray", "prefix", "isobject",
--
diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua
index 5985faf73..59320507a 100644
--- a/tex/context/base/mkiv/mult-low.lua
+++ b/tex/context/base/mkiv/mult-low.lua
@@ -357,7 +357,7 @@ return {
--
"quitcondition", "truecondition", "falsecondition",
--
- "tracingall", "tracingnone", "loggingall",
+ "tracingall", "tracingnone", "loggingall", "tracingcatcodes",
"showluatokens",
--
"aliasmacro",
diff --git a/tex/context/base/mkiv/page-mix.lua b/tex/context/base/mkiv/page-mix.lua
index 374ba8866..7828b7e56 100644
--- a/tex/context/base/mkiv/page-mix.lua
+++ b/tex/context/base/mkiv/page-mix.lua
@@ -59,7 +59,7 @@ local getnext = nuts.getnext
local getprev = nuts.getprev
local getid = nuts.getid
local getlist = nuts.getlist
-local getindex = nuts.getindex
+local getindex = nuts.getindex or nuts.getsubtype -- luatex catch
local getbox = nuts.getbox
local getattr = nuts.getattr
local getwhd = nuts.getwhd
@@ -79,6 +79,8 @@ local new_glue = nodepool.glue
local points = number.points
+local setinsertcontent = tex.setinsertcontent or tex.setbox
+
local settings_to_hash = utilities.parsers.settings_to_hash
local variables = interfaces.variables
@@ -986,9 +988,8 @@ local function getsplit(result,n)
for i=1,#list-1 do
setdepth(list[i],0)
end
- local b = vpack(l) -- multiple arguments, todo: fastvpack
--- setbox("global",c,b) -- when we wrap in a box
- tex.setinsertcontent(c,tonode(b)) -- when we wrap in a box
+ local b = vpack(l) -- multiple arguments, todo: fastvpack
+ setinsertcontent(c,tonode(b)) -- when we wrap in a box
r.inserts[c] = nil
end
diff --git a/tex/context/base/mkiv/publ-dat.lua b/tex/context/base/mkiv/publ-dat.lua
index f09e97a8d..382f70471 100644
--- a/tex/context/base/mkiv/publ-dat.lua
+++ b/tex/context/base/mkiv/publ-dat.lua
@@ -632,13 +632,13 @@ do
local r_value = reference * Carg(1) / resolve
local balanced = P {
- [1] = ((escape * (left+right)) + (collapsed + r_value + 1 - (left+right))^1 + V(2))^0,
- [2] = left * V(1) * right,
+ ((escape * (left+right)) + (collapsed + r_value + 1 - (left+right))^1 + V(2))^0,
+ left * V(1) * right,
}
-- local unbalanced = P {
- -- [1] = left * V(2) * right,
- -- [2] = ((escape * (left+right)) + (collapsed + 1 - (left+right))^1 + V(1))^0,
+ -- left * V(2) * right,
+ -- ((escape * (left+right)) + (collapsed + 1 - (left+right))^1 + V(1))^0,
-- }
local unbalanced = (left/"") * balanced * (right/"") * P(-1)
diff --git a/tex/context/base/mkiv/publ-fnd.lua b/tex/context/base/mkiv/publ-fnd.lua
index 32d0c11be..5ba173365 100644
--- a/tex/context/base/mkiv/publ-fnd.lua
+++ b/tex/context/base/mkiv/publ-fnd.lua
@@ -147,8 +147,8 @@ local p_expression = P("match")/"" * Cs(p_compare)
) / test_key_value
local pattern = Cs {
- [1] = V(2) * (p_combine * V(2))^0,
- [2] = p_expression,
+ V(2) * (p_combine * V(2))^0,
+ p_expression,
}
-- -- -- -- -- -- -- -- -- -- -- -- --
diff --git a/tex/context/base/mkiv/spac-ver.lua b/tex/context/base/mkiv/spac-ver.lua
index 5ab8196c8..efc157a2b 100644
--- a/tex/context/base/mkiv/spac-ver.lua
+++ b/tex/context/base/mkiv/spac-ver.lua
@@ -710,19 +710,19 @@ local function snap_topskip(current,method)
return w, 0
end
-local categories = {
- [0] = "discard",
- [1] = "largest",
- [2] = "force",
- [3] = "penalty",
- [4] = "add",
- [5] = "disable",
- [6] = "nowhite",
- [7] = "goback",
- [8] = "packed",
- [9] = "overlay",
- [10] = "enable",
- [11] = "notopskip",
+local categories = { [0] =
+ "discard",
+ "largest",
+ "force",
+ "penalty",
+ "add",
+ "disable",
+ "nowhite",
+ "goback",
+ "packed",
+ "overlay",
+ "enable",
+ "notopskip",
}
categories = allocate(table.swapped(categories,categories))
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 67e5b7a47..61569f5d1 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 42d1b8d7b..163af8eee 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-syn.lua b/tex/context/base/mkiv/strc-syn.lua
index 6b50da4ac..f8b78b940 100644
--- a/tex/context/base/mkiv/strc-syn.lua
+++ b/tex/context/base/mkiv/strc-syn.lua
@@ -86,12 +86,12 @@ function synonyms.register(class,kind,spec)
local tag = definition.tag or ""
data.metadata.kind = kind -- runtime, not saved in format (yet)
if not hash[tag] then
- if definition.used == nil then
- definition.used = false
- end
- if definition.shown == nil then
- definition.shown = false
- end
+-- if definition.used == nil then
+-- definition.used = false
+-- end
+-- if definition.shown == nil then
+-- definition.shown = false
+-- end
local entries = data.entries
entries[#entries+1] = spec
hash[tag] = spec
@@ -121,24 +121,26 @@ end
function synonyms.isused(class,tag)
local data = tobesaved[class]
local okay = data.hash[tag]
- return okay and okay.definition.used
+ return okay and okay.definition.used or false
end
function synonyms.isshown(class,tag)
local data = tobesaved[class]
local okay = data.hash[tag]
- return okay and okay.definition.shown
+ return okay and okay.definition.shown or false
end
function synonyms.resetused(class)
for tag, data in next, tobesaved[class].hash do
- data.definition.used = false
+-- data.definition.used = false
+ data.definition.used = nil
end
end
function synonyms.resetshown(class)
for tag, data in next, tobesaved[class].hash do
- data.definition.shown = false
+-- data.definition.shown = false
+ data.definition.shown = nil
end
end
diff --git a/tex/context/base/mkiv/util-prs.lua b/tex/context/base/mkiv/util-prs.lua
index 7e2bf0110..6fcc66082 100644
--- a/tex/context/base/mkiv/util-prs.lua
+++ b/tex/context/base/mkiv/util-prs.lua
@@ -55,9 +55,13 @@ local nobracket = 1 - (lbracket + rbracket)
local escape, left, right = P("\\"), P('{'), P('}')
+-- lpegpatterns.balanced = P {
+-- [1] = ((escape * (left+right)) + (1 - (left+right)) + V(2))^0,
+-- [2] = left * V(1) * right
+-- }
lpegpatterns.balanced = P {
- [1] = ((escape * (left+right)) + (1 - (left+right)) + V(2))^0,
- [2] = left * V(1) * right
+ ((escape * (left+right)) + (1 - (left+right)) + V(2))^0,
+ left * V(1) * right
}
local nestedbraces = P { lbrace * (nobrace + V(1))^0 * rbrace }
diff --git a/tex/context/base/mkiv/util-tab.lua b/tex/context/base/mkiv/util-tab.lua
index 9f7112eb9..a92b47b3f 100644
--- a/tex/context/base/mkiv/util-tab.lua
+++ b/tex/context/base/mkiv/util-tab.lua
@@ -417,9 +417,9 @@ if JITSUPPORTED then
else
- local f_v = formatters["[%q]=%q,"]
- local f_t = formatters["[%q]="]
- local f_q = formatters["%q,"]
+ -- local f_v = formatters["[%q]=%q,"]
+ -- local f_t = formatters["[%q]="]
+ -- local f_q = formatters["%q,"]
function table.fastserialize(t,prefix) -- todo, move local function out
local r = { type(prefix) == "string" and prefix or "return" }
@@ -720,6 +720,7 @@ local function serialize(root,name,specification)
local t -- = { }
local n = 1
+ -- local m = 0 -- no gain
local unknown = false
local function do_serialize(root,name,depth,level,indexed)
@@ -850,6 +851,12 @@ local function serialize(root,name,specification)
n = n + 1 t[n] = f_key_str_value_str(depth,tostring(k),tostring(v))
end
end
+ -- if n > 100000 then -- no gain
+ -- local k = m + 1
+ -- t[k] = concat(t,"\n",k,n)
+ -- n = k
+ -- m = k
+ -- end
end
end
if level > 0 then
@@ -898,6 +905,7 @@ local function serialize(root,name,specification)
n = n + 1
t[n] = f_table_finish()
return concat(t,"\n")
+ -- return concat(t,"\n",1,n) -- no gain
end
table.serialize = serialize