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/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-otc.lua13
-rw-r--r--tex/context/base/mkiv/font-ots.lua115
-rw-r--r--tex/context/base/mkiv/font-pre.mkiv14
-rw-r--r--tex/context/base/mkiv/font-tra.mkiv31
-rw-r--r--tex/context/base/mkiv/lang-dis.lua28
-rw-r--r--tex/context/base/mkiv/lxml-css.mkiv1
-rw-r--r--tex/context/base/mkiv/node-tra.lua20
-rw-r--r--tex/context/base/mkiv/page-lay.mkiv17
-rw-r--r--tex/context/base/mkiv/page-otr.mkvi7
-rw-r--r--tex/context/base/mkiv/page-set.mkiv2
-rw-r--r--tex/context/base/mkiv/page-sid.mkiv320
-rw-r--r--tex/context/base/mkiv/spac-grd.mkiv34
-rw-r--r--tex/context/base/mkiv/spac-ver.lua27
-rw-r--r--tex/context/base/mkiv/spac-ver.mkiv4
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25823 -> 25753 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin426104 -> 426092 bytes
-rw-r--r--tex/context/base/mkiv/trac-set.lua12
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin818534 -> 818485 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60775 -> 60766 bytes
-rw-r--r--tex/context/modules/mkiv/s-pages-statistics.mkiv8
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua84
25 files changed, 335 insertions, 410 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index a6c702685..4ac67aef0 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{2017.09.28 10:07}
+\newcontextversion{2017.10.01 14:32}
%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 72af2dd25..29f91651b 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{2017.09.28 10:07}
+\edef\contextversion{2017.10.01 14:32}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index a37e7187f..79c533955 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{2017.09.28 10:07}
+\newcontextversion{2017.10.01 14:32}
%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 fb967c947..57ae76dcd 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -41,7 +41,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.09.28 10:07}
+\edef\contextversion{2017.10.01 14:32}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-otc.lua b/tex/context/base/mkiv/font-otc.lua
index 8059ad272..2bad62d60 100644
--- a/tex/context/base/mkiv/font-otc.lua
+++ b/tex/context/base/mkiv/font-otc.lua
@@ -11,6 +11,7 @@ local type, next = type, next
local lpegmatch = lpeg.match
local utfbyte, utflen, utfsplit = utf.byte, utf.len, utf.split
local match = string.match
+local sortedhash = table.sortedhash
-- we assume that the other otf stuff is loaded already
@@ -449,7 +450,7 @@ local function addfeature(data,feature,specifications)
local lookups = rule.lookups or false
local subtype = nil
if lookups and sublookups then
- for k, v in next, lookups do
+ for k, v in sortedhash(lookups) do
local t = type(v)
if t == "table" then
-- already ok
@@ -501,7 +502,8 @@ local function addfeature(data,feature,specifications)
replacements, -- 7
subtype, -- 8
}
- for unic in next, sequence[start] do
+-- for unic in next, sequence[start] do
+ for unic in sortedhash(sequence[start]) do
local cu = coverage[unic]
if not cu then
coverage[unic] = rulehash -- can now be done cleaner i think
@@ -551,9 +553,9 @@ local function addfeature(data,feature,specifications)
local s = sequences[i]
local f = s.features
if f then
- for k in next, f do
+ for k in sortedhash(f) do -- next, f do
if k == position then
- index = i
+ index = i
break
end
end
@@ -1103,7 +1105,6 @@ local function blockligatures(str)
after[i] = { after[i] }
end
end
-
else
before = nil
current = utfsplit(ti)
@@ -1123,7 +1124,9 @@ local function blockligatures(str)
lookups = { 1 }, -- not shared !
}
revert[new] = {
+ -- before = before,
current = { one, zwj },
+ -- after = { two, unpack(after) },
after = { two },
lookups = { 1 }, -- not shared !
}
diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua
index 3d0606caf..55c5354da 100644
--- a/tex/context/base/mkiv/font-ots.lua
+++ b/tex/context/base/mkiv/font-ots.lua
@@ -299,9 +299,9 @@ local registermessage = (tracers and tracers.steppers.message) or function()
-- local function checkdisccontent(d)
-- local pre, post, replace = getdisc(d)
--- if pre then for n in traverse_id(glue_code,pre) do print("pre",nodes.idstostring(pre)) break end end
--- if post then for n in traverse_id(glue_code,post) do print("pos",nodes.idstostring(post)) break end end
--- if replace then for n in traverse_id(glue_code,replace) do print("rep",nodes.idstostring(replace)) break end end
+-- if pre then for n in traverse_id(glue_code,pre) do report("pre: %s",nodes.idstostring(pre)) break end end
+-- if post then for n in traverse_id(glue_code,post) do report("pos: %s",nodes.idstostring(post)) break end end
+-- if replace then for n in traverse_id(glue_code,replace) do report("rep: %s",nodes.idstostring(replace)) break end end
-- end
local function logprocess(...)
@@ -322,7 +322,7 @@ local gref do
local f_unicode = formatters["U+%X"] -- was ["%U"]
local f_uniname = formatters["U+%X (%s)"] -- was ["%U (%s)"]
- local f_unilist = formatters["% t (% t)"]
+ local f_unilist = formatters["% t"]
gref = function(n) -- currently the same as in font-otb
if type(n) == "number" then
@@ -334,16 +334,20 @@ local gref do
return f_unicode(n)
end
elseif n then
- local num, nam = { }, { }
+ local t = { }
for i=1,#n do
local ni = n[i]
if tonumber(ni) then -- later we will start at 2
local di = descriptions[ni]
- num[i] = f_unicode(ni)
- nam[i] = di and di.name or "-"
+ local nn = di and di.name
+ if nn then
+ t[#t+1] = f_uniname(ni,nn)
+ else
+ t[#t+1] = f_unicode(ni)
+ end
end
end
- return f_unilist(num,nam)
+ return f_unilist(t)
else
return "<error in node mode tracing>"
end
@@ -1386,6 +1390,8 @@ this function (move code inline and handle the marks by a separate function). We
assume rather stupid ligatures (no complex disc nodes).</p>
--ldx]]--
+-- compare to handlers.gsub_ligature which is more complex ... why
+
function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
local mapping = currentlookup.mapping
if mapping == nil then
@@ -2189,7 +2195,6 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck)
end
end
end
-
local done = false
if lookaheaddisc then
@@ -2217,7 +2222,7 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck)
head = lookaheaddisc
end
local pre, post, replace = getdisc(lookaheaddisc)
- local new = copy_node_list(cf)
+ local new = copy_node_list(cf) -- br, how often does that happen
local cnew = new
if pre then
setlink(find_node_tail(cf),pre)
@@ -2275,10 +2280,7 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck)
break
end
end
- if cnext then
- setprev(cnext,backtrackdisc)
- end
- setnext(backtrackdisc,cnext)
+ setlink(backtrackdisc,cnext)
setprev(cf)
setnext(cl)
local pre, post, replace, pretail, posttail, replacetail = getdisc(backtrackdisc,true)
@@ -2337,16 +2339,17 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck)
return head, start, done
end
-local function chaintrac(head,start,dataset,sequence,rlmode,skiphash,ck,match)
+local function chaintrac(head,start,dataset,sequence,rlmode,skiphash,ck,match,discseen,sweepnode)
local rule = ck[1]
local lookuptype = ck[8] or ck[2]
local nofseq = #ck[3]
local first = ck[4]
local last = ck[5]
local char = getchar(start)
- logwarning("%s: rule %s %s at char %s for (%s,%s,%s) chars, lookuptype %a",
+ logwarning("%s: rule %s %s at char %s for (%s,%s,%s) chars, lookuptype %a, %sdisc seen, %ssweeping",
cref(dataset,sequence),rule,match and "matches" or "nomatch",
- gref(char),first-1,last-first+1,nofseq-last,lookuptype)
+ gref(char),first-1,last-first+1,nofseq-last,lookuptype,
+ discseen and "" or "no ", sweepnode and "" or "not ")
end
-- The next one is quite optimized but still somewhat slow, fonts like ebgaramond
@@ -2356,6 +2359,9 @@ end
-- instead. This is one of the cases where it makes the code more readable and we
-- might even gain a bit performance.
+-- when we have less replacements (lookups) then current matches we can push too much into
+-- the previous disc .. such be it (<before><disc><current=fl><after> with only f done)
+
local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,skiphash)
-- optimizing for rlmode gains nothing
local sweepnode = sweepnode
@@ -2363,7 +2369,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
local postreplace
local prereplace
local checkdisc
- local diskseen -- = false
+ local discseen -- = false
if sweeptype then
if sweeptype == "replace" then
postreplace = true
@@ -2396,7 +2402,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
local startchar = nofcontext == 1 or ischar(start,currentfont) -- only needed in a chain
- for k=1,nofcontexts do
+ for k=1,nofcontexts do -- does this disc mess work well with n > 1
local ck = contexts[k]
local seq = ck[3]
@@ -2459,7 +2465,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
end
elseif id == disc_code then
-- elseif id == disc_code and (not discs or discs[last]) then
- diskseen = true
+ discseen = true
discfound = last
notmatchpre[last] = nil
notmatchpost[last] = true
@@ -2479,9 +2485,10 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
break
end
end
- if n <= l then
- notmatchpre[last] = true
- end
+ -- commented, for Kai to check
+ -- if n <= l then
+ -- notmatchpre[last] = true
+ -- end
else
notmatchpre[last] = true
end
@@ -2568,12 +2575,13 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
elseif id == disc_code then
-- elseif id == disc_code and (not discs or discs[prev]) then
-- the special case: f i where i becomes dottless i ..
- diskseen = true
+ discseen = true
discfound = prev
notmatchpre[prev] = true
notmatchpost[prev] = nil
notmatchreplace[prev] = nil
local pre, post, replace, pretail, posttail, replacetail = getdisc(prev,true)
+ -- weird test: needs checking
if pre ~= start and post ~= start and replace ~= start then
if post then
local n = n
@@ -2615,6 +2623,8 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
end
end
end
+ else
+ notmatchreplace[prev] = true -- new, for Kai to check
end
end
prev = getprev(prev)
@@ -2653,7 +2663,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
if s > l then
local current = last and getnext(last)
if not current and postreplace then
- current = getnext(sweepnode)
+ current = getnext(sweepnode)
end
if current then
local discfound -- = nil
@@ -2696,7 +2706,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
end
elseif id == disc_code then
-- elseif id == disc_code and (not discs or discs[current]) then
- diskseen = true
+ discseen = true
discfound = current
notmatchpre[current] = nil
notmatchpost[current] = true
@@ -2735,7 +2745,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
end
else
notmatchreplace[current] = true
- -- different than others, needs checking if "not" is okay
+ -- different than others, needs checking if "not" is okay so for Kai to check
if not notmatchpre[current] then
goto next
else
@@ -2744,13 +2754,9 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
end
end
else
- -- skip 'm
+ notmatchreplace[current] = true -- new, for Kai to check
end
current = getnext(current)
- -- elseif id == glue_code and seq[n][32] and isspace(current,threshold,id) then
- -- elseif seq[n][32] and spaces[current] then
- -- n = n + 1
- -- current = getnext(current)
elseif id == glue_code then
local sn = seq[n]
if (sn[32] and spaces[current]) or sn[0xFFFC] then
@@ -2775,9 +2781,9 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
end
if trace_contexts then
- chaintrac(head,start,dataset,sequence,rlmode,skipped and skiphash,ck,true)
+ chaintrac(head,start,dataset,sequence,rlmode,skipped and skiphash,ck,true,discseen,sweepnode)
end
- if diskseen or sweepnode then
+ if discseen or sweepnode then
head, start, done = chaindisk(head,start,dataset,sequence,rlmode,skipped and skiphash,ck)
else
head, start, done = chainrun(head,start,last,dataset,sequence,rlmode,skipped and skiphash,ck)
@@ -2789,10 +2795,10 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
end
::next::
-- if trace_chains then
- -- chaintrac(head,start,dataset,sequence,rlmode,skipped and skiphash,ck,false)
+ -- chaintrac(head,start,dataset,sequence,rlmode,skipped and skiphash,ck,false,discseen,sweepnode)
-- end
end
- if diskseen then
+ if discseen then
notmatchpre = { }
notmatchpost = { }
notmatchreplace = { }
@@ -3079,7 +3085,7 @@ local function comprun(disc,c_run,...) -- vararg faster than the whole list
--
if pre then
sweepnode = disc
- sweeptype = "pre" -- in alternative code preinjections is uc_c_sed (also used then for properties, saves a variable)
+ sweeptype = "pre" -- in alternative code preinjections is used (also used then for properties, saves a variable)
local new, done = c_run(pre,...)
if done then
pre = new
@@ -3116,6 +3122,9 @@ local function comprun(disc,c_run,...) -- vararg faster than the whole list
return getnext(disc), renewed
end
+-- if we can hyphenate in a lig then unlikely a lig so we
+-- could have a option here to ignore lig
+
local function testrun(disc,t_run,c_run,...)
if trace_testruns then
report_disc("test",disc)
@@ -3126,7 +3135,6 @@ local function testrun(disc,t_run,c_run,...)
return
end
local pre, post, replace, pretail, posttail, replacetail = getdisc(disc,true)
- local done = false
if (post or replace) and prev then
if post then
setlink(posttail,next)
@@ -3142,7 +3150,7 @@ local function testrun(disc,t_run,c_run,...)
local d_replace = t_run(replace,next,...)
if d_post > 0 or d_replace > 0 then
local d = d_replace > d_post and d_replace or d_post
- local head = getnext(disc)
+ local head = getnext(disc) -- is: next
local tail = head
for i=1,d do
tail = getnext(tail)
@@ -3150,7 +3158,8 @@ local function testrun(disc,t_run,c_run,...)
head, tail = flattendisk(head,tail)
end
end
- local next = getnext(tail)
+-- local next = getnext(tail)
+ next = getnext(tail)
setnext(tail)
setprev(head)
local new = copy_node_list(head)
@@ -3164,7 +3173,7 @@ local function testrun(disc,t_run,c_run,...)
else
replace = new
end
- setlink(disc,next)
+-- setlink(disc,next)
else
-- we stay inside the disc
if posttail then
@@ -3172,14 +3181,14 @@ local function testrun(disc,t_run,c_run,...)
else
post = nil
end
- setnext(replacetail)
if replacetail then
setnext(replacetail)
else
replace = nil
end
- setprev(next,disc)
+-- setprev(next,disc) -- setlink(dics,next)
end
+setlink(disc,next)
-- pre, post, replace, pretail, posttail, replacetail = getdisc(disc,true)
end
--
@@ -3221,10 +3230,9 @@ local function testrun(disc,t_run,c_run,...)
sweeptype = nil
if renewed then
setdisc(disc,pre,post,replace)
- return next, true
- else
- return next, done
end
+ -- next can have changed (copied list)
+ return getnext(disc), renewed
end
-- We can make some assumptions with respect to discretionaries. First of all it is very
@@ -3300,6 +3308,8 @@ local function c_run_single(head,font,attr,lookupcache,step,dataset,sequence,rlm
return head, done
end
+-- only replace?
+
local function t_run_single(start,stop,font,attr,lookupcache)
local lastd = nil
while start ~= stop do
@@ -3321,6 +3331,8 @@ local function t_run_single(start,stop,font,attr,lookupcache)
s = ss
ss = nil
end
+ -- a bit weird: why multiple ... anyway we can't have a disc in a disc
+ -- how about post ...
while getid(s) == disc_code do
ss = getnext(s)
s = getfield(s,"replace")
@@ -3361,6 +3373,8 @@ local function t_run_single(start,stop,font,attr,lookupcache)
if l and l.ligature then
lastd = d
end
+ else
+ -- no match (yet)
end
else
-- go on can be a mixed one
@@ -3643,8 +3657,10 @@ do
-- fonts per processor call), especially for fonts with lots of contextual lookups.
local fastdisc = true
+ local testdics = false
- directives.register("otf.fastdisc",function(v) fastdisc = v end)
+ directives.register("otf.fastdisc",function(v) fastdisc = v end) -- normally enabled
+ directives.register("otf.testdisc",function(v) testdisc = v end) -- only for myself
-- using a merged combined hash as first test saves some 30% on ebgaramond and
-- about 15% on arabtype .. then moving the a test also saves a bit (even when
@@ -3734,6 +3750,7 @@ do
local topstack = 0
local typ = sequence.type
local gpossing = typ == "gpos_single" or typ == "gpos_pair" -- store in dataset
+ local forcetestrun = testdisc or typ == "gsub_ligature"
local handler = handlers[typ] -- store in dataset
local steps = sequence.steps
local nofsteps = sequence.nofsteps
@@ -3843,7 +3860,7 @@ do
local ok
if gpossing then
start, ok = kernrun(start,k_run_single, font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler)
- elseif typ == "gsub_ligature" then
+ elseif forcetestrun then
start, ok = testrun(start,t_run_single,c_run_single,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler)
else
start, ok = comprun(start,c_run_single, font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler)
@@ -3920,7 +3937,7 @@ do
local ok
if gpossing then
start, ok = kernrun(start,k_run_multiple, font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler)
- elseif typ == "gsub_ligature" then
+ elseif forcetestrun then
start, ok = testrun(start,t_run_multiple,c_run_multiple,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler)
else
start, ok = comprun(start,c_run_multiple, font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler)
diff --git a/tex/context/base/mkiv/font-pre.mkiv b/tex/context/base/mkiv/font-pre.mkiv
index b754714eb..632cbe29c 100644
--- a/tex/context/base/mkiv/font-pre.mkiv
+++ b/tex/context/base/mkiv/font-pre.mkiv
@@ -783,11 +783,15 @@
%D don't want huge switches to the main bodyfont and style, so
%D here too we use a direct method.
-\let\infofont \relax % satisfy dep checker
-\let\infofontbold\relax % satisfy dep checker
-
-\definefont[infofont] [file:dejavusansmono at 6pt] % todo \the\everybodyfont
-\definefont[infofontbold][file:dejavusansmono-bold at 6pt] % todo \the\everybodyfont
+\let\infofont \relax
+\let\infofontbold \relax
+\let\smallinfofont \relax
+\let\smallinfofontbold\relax
+
+\definefont[infofont] [file:dejavusansmono*none at 6pt]
+\definefont[infofontbold] [file:dejavusansmono-bold*none at 6pt]
+\definefont[smallinfofont] [file:dejavusansmono*none at 3pt]
+\definefont[smallinfofontbold][file:dejavusansmono-bold*none at 3pt]
%D Optimization (later we overload in math). Also needed in order to get \type {\ss}
%D properly defined.
diff --git a/tex/context/base/mkiv/font-tra.mkiv b/tex/context/base/mkiv/font-tra.mkiv
index dfde72c63..930798320 100644
--- a/tex/context/base/mkiv/font-tra.mkiv
+++ b/tex/context/base/mkiv/font-tra.mkiv
@@ -323,6 +323,37 @@
\stopotfsample
\endgroup}
+%D \startbuffer
+%D \startotfcompositionlist{Serif*default @ 11pt}{l2r}%
+%D \showotfcompositionsample{effe}
+%D \stopotfcompositionlist
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
+
+\unexpanded\def\showotfcompositionlist#1#2#3%
+ {\begingroup
+ \definedfont[#1]%
+ \setbox\scratchbox\hbox\bgroup
+ \setotfcompositiondirection{#2}%
+ #3%
+ \egroup
+ \strut
+ \def|##1|{\kern\onepoint\string|\kern\onepoint##1\kern\onepoint\string|\kern\onepoint}%
+ \cldcontext{nodes.listtoutf(tex.box[\number\scratchbox].list,"{\\kern\\onepoint}",true)}%
+ \endgroup}
+
+\unexpanded\def\startotfcompositionlist#1#2#3\stopotfcompositionlist
+ {\begingroup
+ \unexpanded\def\showotfcompositionsample##1%
+ {\NC\type{##1}\NC\showotfcompositionlist{#1}{#2}{##1}\NC\definedfont[#1]##1\NC\NR}%
+ \starttabulate[|||| ]
+ #3%
+ \stoptabulate
+ \endgroup}
+
+\let\stopotfcompositionlist\relax
+
% new
\unexpanded\def\savefont[#1]% not yet in i-*.xml
diff --git a/tex/context/base/mkiv/lang-dis.lua b/tex/context/base/mkiv/lang-dis.lua
index 0dfb1ce08..ec470234f 100644
--- a/tex/context/base/mkiv/lang-dis.lua
+++ b/tex/context/base/mkiv/lang-dis.lua
@@ -251,15 +251,25 @@ interfaces.implement {
actions = languages.showdiscretionaries
}
-local toutf = nodes.listtoutf
-
-function languages.serializediscretionary(d) -- will move to tracer
- local pre, post, replace = getdisc(d)
- return string.formatters["{%s}{%s}{%s}"](
- pre and toutf(pre) or "",
- post and toutf(post) or "",
- replace and toutf(replace) or ""
- )
+do
+
+ local toutf = nodes.listtoutf
+ local utfchar = utf.char
+ local f_disc = string.formatters["{%s}{%s}{%s}"]
+ local replace = lpeg.replacer( {
+ [utfchar(0x200C)] = "|",
+ [utfchar(0x200D)] = "|",
+ }, nil, true)
+
+ local function convert(list)
+ return list and replace(toutf(list)) or ""
+ end
+
+ function languages.serializediscretionary(d) -- will move to tracer
+ local pre, post, replace = getdisc(d)
+ return f_disc(convert(pre),convert(post),convert(replace))
+ end
+
end
-- --
diff --git a/tex/context/base/mkiv/lxml-css.mkiv b/tex/context/base/mkiv/lxml-css.mkiv
index 79de85c08..33d372569 100644
--- a/tex/context/base/mkiv/lxml-css.mkiv
+++ b/tex/context/base/mkiv/lxml-css.mkiv
@@ -37,3 +37,4 @@
% \stoptexdefinition
\endinput
+
diff --git a/tex/context/base/mkiv/node-tra.lua b/tex/context/base/mkiv/node-tra.lua
index d5165c50b..fab9d51ac 100644
--- a/tex/context/base/mkiv/node-tra.lua
+++ b/tex/context/base/mkiv/node-tra.lua
@@ -297,34 +297,38 @@ nodes.showsimplelist = function(h,depth) showsimplelist(h,depth,0) end
local function listtoutf(h,joiner,textonly,last,nodisc)
local w = { }
+ local n = 0
while h do
local c, id = isglyph(h)
if c then
- w[#w+1] = c >= 0 and utfchar(c) or formatters["<%i>"](c)
+ n = n + 1 ; w[n] = c >= 0 and utfchar(c) or formatters["<%i>"](c)
if joiner then
- w[#w+1] = joiner
+ n = n + 1 ; w[n] = joiner
end
elseif id == disc_code then
local pre, pos, rep = getdisc(h)
if not nodisc then
- w[#w+1] = formatters["[%s|%s|%s]"] (
+ n = n + 1 ; w[n] = formatters["[%s|%s|%s]"] (
pre and listtoutf(pre,joiner,textonly) or "",
pos and listtoutf(pos,joiner,textonly) or "",
rep and listtoutf(rep,joiner,textonly) or ""
)
elseif rep then
- w[#w+1] = listtoutf(rep,joiner,textonly) or ""
+ n = n + 1 ; w[n] = listtoutf(rep,joiner,textonly) or ""
+ end
+ if joiner then
+ n = n + 1 ; w[n] = joiner
end
elseif textonly then
if id == glue_code then
if getwidth(h) > 0 then
- w[#w+1] = " "
+ n = n + 1 ; w[n] = " "
end
elseif id == hlist_code or id == vlist_code then
- w[#w+1] = "[]"
+ n = n + 1 ; w[n] = "[]"
end
else
- w[#w+1] = "[-]"
+ n = n + 1 ; w[n] = "[-]"
end
if h == last then
break
@@ -332,7 +336,7 @@ local function listtoutf(h,joiner,textonly,last,nodisc)
h = getnext(h)
end
end
- return concat(w)
+ return concat(w,"",1,(w[n] == joiner) and (n-1) or n)
end
function nodes.listtoutf(h,joiner,textonly,last,nodisc)
diff --git a/tex/context/base/mkiv/page-lay.mkiv b/tex/context/base/mkiv/page-lay.mkiv
index 6eec90149..ae04a34e0 100644
--- a/tex/context/base/mkiv/page-lay.mkiv
+++ b/tex/context/base/mkiv/page-lay.mkiv
@@ -1604,7 +1604,7 @@
\setuppapersize
[A4] % [samesized]
-%D A few goodies:
+%D A few goodies, first a full page layout:
\definelayout
[\v!page]
@@ -1631,9 +1631,24 @@
\c!lines=0,
\c!grid=\v!no]
+%D A quick and dirty one:
+
\definelayout
[\v!middle]
[\c!width=\v!middle,
\c!height=\v!middle]
+%D One for testing examples (5mm is often the non printable area):
+
+\definelayout
+ [\v!tight]
+
+\definelayout
+ [\v!tight]
+ [\v!page]
+ [\c!backspace=5mm,
+ \c!cutspace=5mm,
+ \c!topspace=5mm,
+ \c!bottomspace=5mm]
+
\protect \endinput
diff --git a/tex/context/base/mkiv/page-otr.mkvi b/tex/context/base/mkiv/page-otr.mkvi
index 22d622db8..172363da5 100644
--- a/tex/context/base/mkiv/page-otr.mkvi
+++ b/tex/context/base/mkiv/page-otr.mkvi
@@ -114,8 +114,9 @@
c:\number\mofcolumns,\space
v:\the\vsize ,\space
g:\the\pagegoal ,\space
- t:\the\pagetotal ,\space
+ t:\the\pagetotal
\ifdim\pagetotal>\pagegoal
+ ,\space
d:\the\dimexpr\pagetotal-\pagegoal\relax
\fi}}
@@ -188,10 +189,10 @@
\page_otf_set_engine_output_routine\page_otr_triggered_output_routine
-\installoutputroutine\synchronizeoutput
+\installoutputroutine\synchronizeoutput % use \triggerpagebuilder instead
{\ifvoid\normalpagebox\else
\unvbox\normalpagebox
- \pagediscards
+ \pagediscards % does more harm than good .. needs thinking
\fi}
\installoutputroutine\discardpage
diff --git a/tex/context/base/mkiv/page-set.mkiv b/tex/context/base/mkiv/page-set.mkiv
index 0d62df75a..261aabf7a 100644
--- a/tex/context/base/mkiv/page-set.mkiv
+++ b/tex/context/base/mkiv/page-set.mkiv
@@ -614,7 +614,7 @@
\ifinotr % else problems with floats, see extreme
\pagegoal\vsize % niet nodig, tenzij binnen otr
\fi
- \synchronizeoutput % fails on example
+ \synchronizeoutput % fails on example, try \triggerpagebuilder instead
% \allowbreak % hm
\fi
\synchronizenotes
diff --git a/tex/context/base/mkiv/page-sid.mkiv b/tex/context/base/mkiv/page-sid.mkiv
index f32a443be..2f5acaee6 100644
--- a/tex/context/base/mkiv/page-sid.mkiv
+++ b/tex/context/base/mkiv/page-sid.mkiv
@@ -15,18 +15,19 @@
\unprotect
-% These macro deal with side floats. We started with Daniel Comenetz macros as published
-% in TUGBoat Volume 14 (1993), No.\ 1: Anchored Figures at Either Margin. I extended and
-% patched the macros to suite our needs which results in a messy module. Therefore, this
-% module badly needs an update because it's now a mixture of old and new macros.
+%D These macro deal with side floats. We started with Daniel Comenetz macros as
+%D published in TUGBoat Volume 14 (1993), No.\ 1: Anchored Figures at Either Margin.
+%D I extended and patched the macros to suite our needs which results in a messy
+%D module. Therefore, this module badly needs an update because it's now a mixture
+%D of old and new macros.
% Interesting cases where it goes wrong:
%
% \placefigure[left]{}{} \dorecurse{3}{\input ward } {\par} \input ward
%
-% Here we get an unwanted carried over hangindent and parindent. A solution is to associate
-% it with the local par node instead. This is something to discuss with Taco as it could be
-% a new luatex/mkiv feature: explicitly set par properties.
+% Here we get an unwanted carried over hangindent and parindent. A solution is to
+% associate it with the local par node instead. This is something to discuss with
+% Taco as it could be a new luatex/mkiv feature: explicitly set par properties.
% Maybe I should just rewrite the lot.
@@ -50,9 +51,6 @@
\newconditional \c_page_sides_short % needs checking .. best write this from scratch
\newconditional \c_page_sides_flag
-\newconditional \c_page_sides_r_eq % messy, needs checking anyway
-\newconditional \c_page_sides_l_eq % messy, needs checking anyway
-
\newdimen \d_page_sides_shift
\newdimen \d_page_sides_extrashift
\newdimen \d_page_sides_leftshift
@@ -63,6 +61,7 @@
\newdimen \d_page_sides_topskip
\newdimen \d_page_sides_bottomskip
\newdimen \d_page_sides_downshift
+\newdimen \d_page_sides_pagetotal
\setnewconstant \c_page_sides_method \plusone % 0=raw 1=safe (.99) 2=tight (-1pt)
\setnewconstant \c_page_sides_align \zerocount
@@ -77,15 +76,10 @@
\def\page_sides_process_float_cutspace {\global\c_page_sides_float_type\pluseight\page_sides_handle_float}
\def\page_sides_process_float_margin {\global\c_page_sides_float_type\pluseight\page_sides_handle_float}
-\let\logsidefloat\relax
-
\newif\iftracesidefloats % public (might change)
% end of public variables
-\def\page_sides_insert_info
- {\page_floats_report_total}
-
\def\page_sides_apply_horizontal_shift
{\ifdim\d_page_sides_maximum>\zeropoint
\ifcase\c_page_sides_float_type
@@ -190,7 +184,7 @@
\def\page_sides_flush_floats
{\par
- \ifnum\dimexpr\d_page_sides_vsize-\pagetotal\relax>\zeropoint
+ \ifdim\dimexpr\d_page_sides_vsize-\pagetotal\relax>\zeropoint
\page_sides_flush_floats_indeed
\fi
% also here if used at all \global\holdinginserts\zerocount
@@ -200,7 +194,7 @@
\unexpanded\def\doifelsesidefloat
{\par
- \ifnum\dimexpr\d_page_sides_vsize-\pagetotal\relax>\zeropoint
+ \ifdim\dimexpr\d_page_sides_vsize-\pagetotal\relax>\zeropoint
\expandafter\firstoftwoarguments
\else
\expandafter\secondoftwoarguments
@@ -208,36 +202,6 @@
\let\doifsidefloatelse\doifelsesidefloat
-% \def\page_sides_flush_floats_indeed
-% {\global\advance\d_page_sides_vsize-\d_page_sides_bottomskip
-% \begingroup
-% \let\page_sides_flush_floats\relax
-% \forgetall
-% \doloop
-% {\strut
-% \iftracesidefloats
-% \color[darkgray]{\ruledhbox{\strut\kern\d_page_sides_width}}%
-% \fi
-% \par
-% % \ifdim\dimexpr\d_page_sides_vsize-\pagetotal\relax>\zeropoint
-% \ifdim\dimexpr\d_page_sides_vsize-\d_page_sides_bottomskip-\pagetotal\relax>\zeropoint
-% \ifnum\recurselevel>\plushundred % safeguard, sort of deadcycles
-% \exitloop
-% \fi
-% \else
-% \exitloop
-% \fi}%
-% \endgroup
-% \ifdim\parskip>\zeropoint % why this test ?
-% \ifdim\d_page_sides_bottomskip>\parskip
-% % \nowhitespace
-% % \vskip\d_page_sides_bottomskip
-% \blank[\v!nowhite,\the\dimexpr\d_page_sides_bottomskip]
-% \fi
-% \else
-% \blank[\the\d_page_sides_bottomskip]% new, so needs checking
-% \fi}
-
\installcorenamespace{sidefloatsteps}
\setvalue{\??sidefloatsteps\v!line }{\strut}
@@ -249,63 +213,59 @@
% we don't officially know what kind of float we flush
\def\page_sides_flush_floats_indeed
- {\global\advance\d_page_sides_vsize-\d_page_sides_bottomskip
- \begingroup
- \let\page_sides_flush_floats\relax
- \edef\m_pages_strut{\executeifdefined{\??sidefloatsteps\rootfloatparameter\c!step}\strut}%
- \forgetall
- \doloop
- {\iftracesidefloats
- \dontleavehmode
- \ruledhpack{\m_pages_strut\kern\d_page_sides_width}%
- \else
- \m_pages_strut
- \fi
- \par
- \nointerlineskip
- % \ifdim\dimexpr\d_page_sides_vsize-\d_page_sides_bottomskip-\pagetotal\relax>\zeropoint
- \ifdim\dimexpr\d_page_sides_vsize-\pagetotal\relax>\zeropoint
- \ifnum\recurselevel>\plushundred % safeguard, sort of deadcycles
- \exitloop
+ {% the \d_page_sides_bottomskip == \rootfloatparameter\c!sidespaceafter is embedded
+ % in the progression of the float
+ \global\advance\d_page_sides_vsize-\d_page_sides_bottomskip\relax
+ \ifdim\dimexpr\d_page_sides_vsize-\pagetotal\relax>\zeropoint % new per 2017-09-28
+ \begingroup
+ \let\page_sides_flush_floats\relax
+ \edef\m_pages_strut
+ {\ifcsname\??sidefloatsteps\rootfloatparameter\c!step\endcsname
+ \lastnamedcs
+ \else
+ \strut
+ \fi}%
+ \forgetall
+ \doloop
+ {\iftracesidefloats
+ \dontleavehmode
+ \ruledhpack{\m_pages_strut\kern\d_page_sides_width}%
+ \else
+ \m_pages_strut
\fi
- \else
- \exitloop
- \fi}%
- \endgroup
+ \par
+ \nointerlineskip
+ \ifdim\dimexpr\d_page_sides_vsize-\pagetotal\relax>\zeropoint
+ \ifnum\recurselevel>\plushundred % safeguard, sort of deadcycles
+ %\writestatus{sidefloats}{\recurselevel\space empty lines forced, quitting}%
+ \exitloop
+ \fi
+ \else
+ %\writestatus{sidefloats}{\recurselevel\space empty lines forced}%
+ \exitloop
+ \fi}%
+ \endgroup
+ \else
+ % no need as the par just fits next to the previous float
+ \fi
\ifdim\parskip>\zeropoint % why this test ?
\ifdim\d_page_sides_bottomskip>\parskip
- % \nowhitespace
- % \vskip\d_page_sides_bottomskip
-% \blank[\v!nowhite,\the\dimexpr\d_page_sides_bottomskip]
- \blank[\v!nowhite,\rootfloatparameter\c!sidespaceafter]
+ \blank[\v!nowhite,\rootfloatparameter\c!sidespaceafter]%
\fi
\else
-% \blank[\the\d_page_sides_bottomskip]% new, so needs checking
- \blank[\rootfloatparameter\c!sidespaceafter]% new, so needs checking
+ \blank[\rootfloatparameter\c!sidespaceafter]%
\fi}
-% alternative method (unsnapped)
-%
-% \def\page_sides_flush_floats_indeed
-% {\privatescratchdimen\dimexpr\d_page_sides_vsize-\d_page_sides_bottomskip-\pagetotal\relax
-% \ifdim\parskip>\zeropoint % why this test ?
-% \ifdim\privatescratchdimen>\parskip
-% \blank[\v!nowhite,\the\privatescratchdimen] % better in stages
-% \fi
-% \else
-% \blank[\the\privatescratchdimen]
-% \fi}
-
\def\page_sides_check_floats_after_par
{\page_sides_check_floats_indeed
- \ifdim\oldpagetotal=\pagetotal \else
+ \ifdim\d_page_sides_pagetotal=\pagetotal \else
\global\let\page_sides_check_floats\page_sides_check_floats_indeed
\page_sides_flush_floats
\global\c_page_sides_n_of_lines\zerocount % here !
\fi}
\unexpanded\def\page_sides_flush_floats_after_par
- {\xdef\oldpagetotal{\the\pagetotal}%
+ {\global\d_page_sides_pagetotal\pagetotal
\global\let\page_sides_check_floats\page_sides_check_floats_after_par}
\unexpanded\def\page_sides_forget_floats
@@ -318,30 +278,6 @@
\let\page_otr_sides_pop_penalties \relax
\let\page_otr_sides_push_penalties\relax
-% \def\page_otr_sides_push_penalties % needed ? and right
-% {\widowpenalty\plusone
-% \clubpenalty\plustwo
-% \brokenpenalty\plusone
-% \let\page_otr_sides_push_penalties\relax
-% \edef\page_otr_sides_pop_penalties
-% {\widowpenalty \the\widowpenalty
-% \clubpenalty \the\clubpenalty
-% \brokenpenalty\the\brokenpenalty
-% \let\page_otr_sides_pop_penalties\relax}}
-%
-% shouldn't that be:
-%
-% \def\page_otr_sides_push_penalties % needed?
-% {\let\page_otr_sides_push_penalties\relax
-% \edef\page_otr_sides_pop_penalties
-% {\widowpenalty \the\widowpenalty
-% \clubpenalty \the\clubpenalty
-% \brokenpenalty\the\brokenpenalty
-% \let\page_otr_sides_pop_penalties\relax}%
-% \widowpenalty\plusone
-% \clubpenalty\plustwo
-% \brokenpenalty\plusone}
-
\def\page_sides_restore_output_penalty
{\ifnum\outputpenalty=\plustenthousand \else
\penalty\outputpenalty
@@ -363,7 +299,7 @@
\def\page_sides_output_routine_yes % we need to rework this ... add pagediscards and such
{\unvbox\normalpagebox % bah, and the discards?
-% \pagediscards
+% \pagediscards % not good
\setbox\b_page_sides_bottom\lastbox
\ifdim\wd\b_page_sides_bottom>\d_page_sides_hsize
\penalty-201 % hm, i really need to write this from scatch
@@ -377,17 +313,9 @@
\ifinner\else
\vadjust{\penalty\minusone}%
\fi
- \ifconditional\c_page_sides_l_eq
- \global\setfalse\c_page_sides_l_eq
- \else
- \global\advance\d_page_sides_hsize -\wd\b_page_sides_bottom
- \ifconditional\c_page_sides_r_eq
- \global\setfalse\c_page_sides_r_eq
- \else
- \global\divide\d_page_sides_hsize \plustwo
- \fi
- \hskip\d_page_sides_hsize % \kern
- \fi
+ \global\advance\d_page_sides_hsize -\wd\b_page_sides_bottom
+ \global\divide\d_page_sides_hsize \plustwo
+ \hskip\d_page_sides_hsize % \kern
\fi
\box\b_page_sides_bottom
\page_sides_restore_output_penalty
@@ -410,51 +338,6 @@
\fi
\fi}
-% The clean way:
-%
-% \global\setbox\floatbox\hbox
-% {\ifcase\c_page_sides_float_type
-% \vbox{#1}%
-% \or % 1
-% \kern\d_page_sides_leftshift
-% \kern\d_page_sides_shift
-% \vbox{#1}%
-% \kern-\d_page_sides_extrashift
-% \or % 2
-% \kern\d_page_sides_shift
-% \vbox{#1}%
-% \kern-\d_page_sides_extrashift
-% \or % 3
-% \kern\d_page_sides_shift
-% \vbox{#1}%
-% \kern-\d_page_sides_extrashift
-% \or % 4
-% \kern\d_page_sides_leftshift
-% \kern\d_page_sides_shift
-% \vbox{#1\removedepth}%
-% \kern-\d_page_sides_extrashift
-% \or % 5
-% \kern-\d_page_sides_extrashift
-% \vbox{#1}%
-% \kern\d_page_sides_shift
-% \kern\d_page_sides_rightshift
-% \or % 6
-% \kern-\d_page_sides_extrashift
-% \vbox{#1}%
-% \kern\d_page_sides_shift
-% \or % 7
-% \kern-\d_page_sides_extrashift
-% \vbox{#1}%
-% \kern\d_page_sides_shift
-% \or % 8
-% \kern-\d_page_sides_extrashift
-% \vbox{#1}%
-% \kern\d_page_sides_shift
-% \kern\d_page_sides_rightshift
-% \fi}
-%
-% The compact way:
-
\def\page_sides_relocate_float#1%
{\global\setbox\floatbox\hpack
{\ifnum\c_page_sides_float_type=\plusfour
@@ -554,8 +437,8 @@
\def\page_sides_place_float_normal
{\page_sides_push_float_inline\firstofoneargument}
-% The following needs some more work .. consider this a quick hack. We
-% probably need an mkiv hanging grid option.
+%D The following needs some more work .. consider this a quick hack. We probably
+%D need an mkiv hanging grid option.
\def\page_sides_place_snap_to_grid#1%
{\edef\p_grid{\floatparameter\c!grid}%
@@ -576,7 +459,7 @@
\reseteverypar % needed !
\parskip\zeropoint % needed !
\page_sides_set_skips
- \page_sides_insert_info
+ \page_floats_report_total
\relax
\lefttoright % \textdir TLT\relax % or \ifconditional\displaylefttoright below (more work)
\strc_floats_mark_par_as_free
@@ -626,24 +509,24 @@
\global\d_page_sides_hsize \dimexpr\hsize-\d_page_sides_width\relax
\global\d_page_sides_height\dimexpr\ht\floatbox+\dp\floatbox+\d_page_sides_topskip\relax
\global\d_page_sides_vsize \dimexpr\d_page_sides_height+\d_page_sides_page_total\relax
- \dimen0\d_page_sides_vsize
- \dimen2\pagegoal
+ \scratchdimenone\d_page_sides_vsize
+ \scratchdimentwo\pagegoal
\relax
\ifcase\c_page_sides_method
% method 0 : raw
\or
% method 1 : safe
- \dimen2 .99\pagegoal
+ \scratchdimentwo .99\pagegoal
\or
% method 2 : tight
- \advance\dimen0 -\onepoint
+ \advance\scratchdimenone -\onepoint
\fi
\relax % really needed ! ! ! !
- \ifdim\dimen0>\dimen2
+ \ifdim\scratchdimenone>\scratchdimentwo
\global\setfalse\c_page_floats_room
\else
\ifdim\dimexpr\pagegoal-\d_page_sides_vsize\relax<\d_page_sides_bottomskip
- % just weird: \global\advance\d_page_sides_vsize \dimen0
+ % just weird: \global\advance\d_page_sides_vsize \scratchdimenone
\global\settrue\c_page_sides_short
\page_otr_sides_push_penalties
% why was this \global\holdinginserts\plusone
@@ -654,41 +537,6 @@
\global\settrue\c_page_floats_room
\fi}
-% \def\page_sides_prepare_space
-% {\par
-% % no longer needed \whitespace
-% \begingroup
-% \forgetall
-% \reseteverypar
-% \verticalstrut
-% \vskip-\struttotal
-% \endgroup}
-
-% \installtextracker
-% {sidefloats.anchor}
-% {\let\page_sides_anchor\page_sides_anchor_yes}
-% {\let\page_sides_anchor\page_sides_anchor_nop}
-%
-% \def\page_sides_anchor_yes
-% {\darkred
-% \hskip-5\emwidth
-% \vrule\s!height.05\exheight\s!depth.05\exheight\s!width10\emwidth}
-%
-% \def\page_sides_anchor_nop
-% {\strut}
-%
-% \let\page_sides_anchor\page_sides_anchor_nop
-%
-% \def\page_sides_prepare_space
-% {\par
-% \begingroup
-% \reseteverypar
-% \dontleavehmode\hpack to \zeropoint{\page_sides_anchor\hss\strut}%
-% \vskip-\parskip
-% \vskip-\struttotal
-% \inhibitblank
-% \endgroup}
-
\def\page_sides_prepare_space
{\fakenextstrutline
\inhibitblank}
@@ -803,42 +651,6 @@
\penalty\zerocount
\endgroup}
-% Display math
-%
-% If we need this, it will be redone but redefining
-% these macros does not really work out in the current
-% situation.
-%
-% \ifx\normalleqno\undefined
-%
-% \let\floatrighteqo=\eqno
-% \let\floatleftleqo=\leqno
-%
-% \else
-%
-% \let\floatrighteqo=\normaleqno
-% \let\floatleftleqo=\normalleqno
-%
-% \fi
-%
-% \ifx\normaleqno\undefined
-%
-% \def\normaleqno
-% {\ifconditional\c_page_sides_short
-% \global\settrue\c_page_sides_r_eq
-% \fi
-% \floatrighteqo}
-%
-% \else
-%
-% \def\eqno
-% {\ifconditional\c_page_sides_short
-% \global\settrue\c_page_sides_r_eq
-% \fi
-% \floatrighteqo}
-%
-% \fi
-
\def\adjustsidefloatdisplaylines % public, will change
{\aftergroup\page_sides_adjust_display_lines}
@@ -847,12 +659,8 @@
\noindent
\ignorespaces}
-% We need to hook it into the other otr's. This code will be adapted
-% once we rename the callers.
-
-% \def as they can be redefined!
-
-% some will become obsolete
+%D We need to hook it into the other otr's. This code will be adapted once we rename
+%D the callers. We use \type {\def} as they can be redefined! Some will become obsolete
\def\checksidefloat {\page_sides_check_floats}
\def\flushsidefloats {\page_sides_flush_floats}
diff --git a/tex/context/base/mkiv/spac-grd.mkiv b/tex/context/base/mkiv/spac-grd.mkiv
index 899b6e890..66e582879 100644
--- a/tex/context/base/mkiv/spac-grd.mkiv
+++ b/tex/context/base/mkiv/spac-grd.mkiv
@@ -303,18 +303,7 @@
% This is new (and experimental) and might replace some of the above. beware it doesn't always work
% out well, e.g. when used grouped and such (e.g. before display math doesn't work out well).
-\unexpanded\def\spac_fake_next_line_new
- {\par
- \begingroup
- \reseteverypar
- \dontleavehmode\hpack{\strut}\par
- \clf_fakenextstrutline
- \ifdim\pagetotal>\lineheight
- \pagetotal\dimexpr\pagetotal-\lineheight\relax
- \fi
- \endgroup}
-
-% \unexpanded\def\spac_fake_next_line_old
+% \unexpanded\def\fakenextstrutline
% {\par
% \begingroup
% \reseteverypar
@@ -323,7 +312,24 @@
% \vskip-\struttotal
% \endgroup}
-%let\fakenextstrutline\spac_fake_next_line_old
-\let\fakenextstrutline\spac_fake_next_line_new
+% \unexpanded\def\fakenextstrutline
+% {\par
+% \begingroup
+% \reseteverypar
+% \dontleavehmode\hpack{\strut}\par
+% \clf_fakenextstrutline
+% \ifdim\pagetotal>\lineheight
+% \pagetotal\dimexpr\pagetotal-\lineheight\relax
+% \fi
+% \endgroup}
+
+\unexpanded\def\fakenextstrutline
+ {\par
+ \begingroup
+ \reseteverypar
+ \forgetall
+ \dontleavehmode\hpack{\strut}\par
+ \clf_removelastline
+ \endgroup}
\protect \endinput
diff --git a/tex/context/base/mkiv/spac-ver.lua b/tex/context/base/mkiv/spac-ver.lua
index e7183b569..cafab12ad 100644
--- a/tex/context/base/mkiv/spac-ver.lua
+++ b/tex/context/base/mkiv/spac-ver.lua
@@ -54,6 +54,8 @@ local texset = tex.set
local texsetdimen = tex.setdimen
local texnest = tex.nest
+local buildpage = tex.triggerbuildpage
+
local variables = interfaces.variables
local implement = interfaces.implement
@@ -737,14 +739,16 @@ storage.register("builders/vspacing/data/skip", vspacingdata.skip, "builders.vsp
do -- todo: interface.variables and properties
- local P, C, R, S, Cc = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cc
+ local P, C, R, S, Cc, Cs = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cc, lpeg.Cs
vspacing.fixed = false
local map = vspacingdata.map
local skip = vspacingdata.skip
- local multiplier = C(S("+-")^0 * R("09")^1) * P("*")
+ local sign = S("+-")^0
+ local multiplier = C(sign * R("09")^1) * P("*")
+ local singlefier = Cs(sign * Cc(1))
local separator = S(", ")
local category = P(":") * C((1-separator)^1)
local keyword = C((1-category-separator)^1)
@@ -817,7 +821,7 @@ do -- todo: interface.variables and properties
end
end
- local splitter = ((multiplier + Cc(1)) * keyword * (category + Cc(false))) / handler
+ local splitter = ((multiplier + singlefier) * keyword * (category + Cc(false))) / handler
pattern = (splitter + separator^1)^0
function vspacing.analyze(str)
@@ -2091,6 +2095,23 @@ do
if head then
local head = remove_node(head,find_node_tail(head),true)
texlists.page_head = head
+ buildpage()
+ end
+ end
+ }
+
+ interfaces.implement {
+ name = "removelastline",
+ actions = function()
+ local head = texlists.page_head
+ if head then
+ local tail = find_node_tail(head)
+ if tail then
+ -- maybe check for hlist subtype 1
+ local head = remove_node(head,tail,true)
+ texlists.page_head = head
+ buildpage()
+ end
end
end
}
diff --git a/tex/context/base/mkiv/spac-ver.mkiv b/tex/context/base/mkiv/spac-ver.mkiv
index 4aa846dd0..8d55fc133 100644
--- a/tex/context/base/mkiv/spac-ver.mkiv
+++ b/tex/context/base/mkiv/spac-ver.mkiv
@@ -2117,10 +2117,6 @@
\definevspacingamount[\v!height] [\strutht] [\bodyfontstrutheight]
\definevspacingamount[\v!depth] [\strutdp] [\bodyfontstrutdepth]
-\definevspacingamount[-\v!line] [-\openlineheight] [-\bodyfontlineheight]
-\definevspacingamount[-\v!halfline] [-.5\openlineheight] [-.5\bodyfontlineheight]
-\definevspacingamount[-\v!quarterline][-.25\openlineheight][-.25\bodyfontlineheight]
-
\definevspacingamount[\v!standard] [.75\openlineheight] [.75\openlineheight] % mkii compatible
\def\bodyfontwhitespace
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 0fdfef63f..de691e00e 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 89a249d31..b4b799b4f 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/trac-set.lua b/tex/context/base/mkiv/trac-set.lua
index fccf52d3a..530915fe0 100644
--- a/tex/context/base/mkiv/trac-set.lua
+++ b/tex/context/base/mkiv/trac-set.lua
@@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['trac-set'] = { -- might become u
-- maybe this should be util-set.lua
local type, next, tostring, tonumber = type, next, tostring, tonumber
-local concat = table.concat
+local concat, sortedhash = table.concat, table.sortedhash
local format, find, lower, gsub, topattern = string.format, string.find, string.lower, string.gsub, string.topattern
local is_boolean = string.is_boolean
local settings_to_hash = utilities.parsers.settings_to_hash
@@ -26,6 +26,8 @@ local data = { }
-- We can initialize from the cnf file. This is sort of tricky as
-- later defined setters also need to be initialized then. If set
-- this way, we need to ensure that they are not reset later on.
+--
+-- The sorting is needed to get a predictable setters in case of *.
local trace_initialize = false -- only for testing during development
@@ -36,7 +38,7 @@ function setters.initialize(filename,name,values) -- filename only for diagnosti
-- trace_initialize = true
local data = setter.data
if data then
- for key, newvalue in next, values do
+ for key, newvalue in sortedhash(values) do
local newvalue = is_boolean(newvalue,newvalue,true) -- strict
local functions = data[key]
if functions then
@@ -91,7 +93,7 @@ local function set(t,what,newvalue)
done = { }
t.done = done
end
- for w, value in next, what do
+ for w, value in sortedhash(what) do
if value == "" then
value = newvalue
elseif not value then
@@ -100,7 +102,7 @@ local function set(t,what,newvalue)
value = is_boolean(value,value,true) -- strict
end
w = topattern(w,true,true)
- for name, functions in next, data do
+ for name, functions in sortedhash(data) do
if done[name] then
-- prevent recursion due to wildcards
elseif find(name,w) then
@@ -118,7 +120,7 @@ end
local function reset(t)
local data = t.data
if not data.frozen then
- for name, functions in next, data do
+ for name, functions in sortedthash(data) do
for i=1,#functions do
functions[i](false)
end
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index 5c5e1d2af..44cfc846c 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 1dc3ae1a7..47468dc06 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/modules/mkiv/s-pages-statistics.mkiv b/tex/context/modules/mkiv/s-pages-statistics.mkiv
index 375dd9949..54d49bb9f 100644
--- a/tex/context/modules/mkiv/s-pages-statistics.mkiv
+++ b/tex/context/modules/mkiv/s-pages-statistics.mkiv
@@ -82,9 +82,12 @@
}
\stopsetups
+\definecolor[system:page:otr:statistics][t=.8,a=1]
+
\defineoverlay
[system:page:otr:statistics]
- [{\framed
+ [{\starttransparent[system:page:otr:statistics]%
+ \framed
[\c!offset=\bodyfontsize,
\c!background=\v!color,
\c!strut=\v!no,
@@ -96,7 +99,8 @@
\c!align=\v!middle]
{\forgetall
\insidefloattrue
- \setups{system:page:otr:statistics}}}]
+ \setups{system:page:otr:statistics}}%
+ \stoptransparent}]
\unexpanded\def\page_one_command_package_show_state_indeed
{\scratchheight\ht\b_page_one_contents
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 38e94a091..18c00e569 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 : 09/28/17 10:07:40
+-- merge date : 10/01/17 14:32:33
do -- begin closure to overcome local limits and interference
@@ -22981,7 +22981,7 @@ end
local gref do
local f_unicode=formatters["U+%X"]
local f_uniname=formatters["U+%X (%s)"]
- local f_unilist=formatters["% t (% t)"]
+ local f_unilist=formatters["% t"]
gref=function(n)
if type(n)=="number" then
local description=descriptions[n]
@@ -22992,16 +22992,20 @@ local gref do
return f_unicode(n)
end
elseif n then
- local num,nam={},{}
+ local t={}
for i=1,#n do
local ni=n[i]
if tonumber(ni) then
local di=descriptions[ni]
- num[i]=f_unicode(ni)
- nam[i]=di and di.name or "-"
+ local nn=di and di.name
+ if nn then
+ t[#t+1]=f_uniname(ni,nn)
+ else
+ t[#t+1]=f_unicode(ni)
+ end
end
end
- return f_unilist(num,nam)
+ return f_unilist(t)
else
return "<error in node mode tracing>"
end
@@ -24580,7 +24584,7 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck)
head=lookaheaddisc
end
local pre,post,replace=getdisc(lookaheaddisc)
- local new=copy_node_list(cf)
+ local new=copy_node_list(cf)
local cnew=new
if pre then
setlink(find_node_tail(cf),pre)
@@ -24635,10 +24639,7 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck)
break
end
end
- if cnext then
- setprev(cnext,backtrackdisc)
- end
- setnext(backtrackdisc,cnext)
+ setlink(backtrackdisc,cnext)
setprev(cf)
setnext(cl)
local pre,post,replace,pretail,posttail,replacetail=getdisc(backtrackdisc,true)
@@ -24692,16 +24693,17 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck)
end
return head,start,done
end
-local function chaintrac(head,start,dataset,sequence,rlmode,skiphash,ck,match)
+local function chaintrac(head,start,dataset,sequence,rlmode,skiphash,ck,match,discseen,sweepnode)
local rule=ck[1]
local lookuptype=ck[8] or ck[2]
local nofseq=#ck[3]
local first=ck[4]
local last=ck[5]
local char=getchar(start)
- logwarning("%s: rule %s %s at char %s for (%s,%s,%s) chars, lookuptype %a",
+ logwarning("%s: rule %s %s at char %s for (%s,%s,%s) chars, lookuptype %a, %sdisc seen, %ssweeping",
cref(dataset,sequence),rule,match and "matches" or "nomatch",
- gref(char),first-1,last-first+1,nofseq-last,lookuptype)
+ gref(char),first-1,last-first+1,nofseq-last,lookuptype,
+ discseen and "" or "no ",sweepnode and "" or "not ")
end
local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,skiphash)
local sweepnode=sweepnode
@@ -24709,7 +24711,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
local postreplace
local prereplace
local checkdisc
- local diskseen
+ local discseen
if sweeptype then
if sweeptype=="replace" then
postreplace=true
@@ -24727,7 +24729,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
local done
local nofcontexts=contexts.n
local startchar=nofcontext==1 or ischar(start,currentfont)
- for k=1,nofcontexts do
+ for k=1,nofcontexts do
local ck=contexts[k]
local seq=ck[3]
local f=ck[4]
@@ -24783,7 +24785,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
goto next
end
elseif id==disc_code then
- diskseen=true
+ discseen=true
discfound=last
notmatchpre[last]=nil
notmatchpost[last]=true
@@ -24803,9 +24805,6 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
break
end
end
- if n<=l then
- notmatchpre[last]=true
- end
else
notmatchpre[last]=true
end
@@ -24884,7 +24883,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
end
break
elseif id==disc_code then
- diskseen=true
+ discseen=true
discfound=prev
notmatchpre[prev]=true
notmatchpost[prev]=nil
@@ -24930,6 +24929,8 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
end
end
end
+ else
+ notmatchreplace[prev]=true
end
end
prev=getprev(prev)
@@ -25003,7 +25004,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
goto next
end
elseif id==disc_code then
- diskseen=true
+ discseen=true
discfound=current
notmatchpre[current]=nil
notmatchpost[current]=true
@@ -25049,6 +25050,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
end
end
else
+ notmatchreplace[current]=true
end
current=getnext(current)
elseif id==glue_code then
@@ -25074,9 +25076,9 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
end
end
if trace_contexts then
- chaintrac(head,start,dataset,sequence,rlmode,skipped and skiphash,ck,true)
+ chaintrac(head,start,dataset,sequence,rlmode,skipped and skiphash,ck,true,discseen,sweepnode)
end
- if diskseen or sweepnode then
+ if discseen or sweepnode then
head,start,done=chaindisk(head,start,dataset,sequence,rlmode,skipped and skiphash,ck)
else
head,start,done=chainrun(head,start,last,dataset,sequence,rlmode,skipped and skiphash,ck)
@@ -25086,7 +25088,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
end
::next::
end
- if diskseen then
+ if discseen then
notmatchpre={}
notmatchpost={}
notmatchreplace={}
@@ -25340,7 +25342,6 @@ local function testrun(disc,t_run,c_run,...)
return
end
local pre,post,replace,pretail,posttail,replacetail=getdisc(disc,true)
- local done=false
if (post or replace) and prev then
if post then
setlink(posttail,next)
@@ -25356,7 +25357,7 @@ local function testrun(disc,t_run,c_run,...)
local d_replace=t_run(replace,next,...)
if d_post>0 or d_replace>0 then
local d=d_replace>d_post and d_replace or d_post
- local head=getnext(disc)
+ local head=getnext(disc)
local tail=head
for i=1,d do
tail=getnext(tail)
@@ -25364,7 +25365,7 @@ local function testrun(disc,t_run,c_run,...)
head,tail=flattendisk(head,tail)
end
end
- local next=getnext(tail)
+ next=getnext(tail)
setnext(tail)
setprev(head)
local new=copy_node_list(head)
@@ -25378,21 +25379,19 @@ local function testrun(disc,t_run,c_run,...)
else
replace=new
end
- setlink(disc,next)
else
if posttail then
setnext(posttail)
else
post=nil
end
- setnext(replacetail)
if replacetail then
setnext(replacetail)
else
replace=nil
end
- setprev(next,disc)
end
+setlink(disc,next)
end
local renewed=false
if pre then
@@ -25426,10 +25425,8 @@ local function testrun(disc,t_run,c_run,...)
sweeptype=nil
if renewed then
setdisc(disc,pre,post,replace)
- return next,true
- else
- return next,done
end
+ return getnext(disc),renewed
end
local nesting=0
local function c_run_single(head,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler)
@@ -25533,6 +25530,7 @@ local function t_run_single(start,stop,font,attr,lookupcache)
if l and l.ligature then
lastd=d
end
+ else
end
else
end
@@ -25762,7 +25760,9 @@ otf.helpers.txtdirstate=txtdirstate
otf.helpers.pardirstate=pardirstate
do
local fastdisc=true
- directives.register("otf.fastdisc",function(v) fastdisc=v end)
+ local testdics=false
+ directives.register("otf.fastdisc",function(v) fastdisc=v end)
+ directives.register("otf.testdisc",function(v) testdisc=v end)
local otfdataset=nil
local getfastdisc={ __index=function(t,k)
local v=usesfont(k,currentfont)
@@ -25815,6 +25815,7 @@ do
local topstack=0
local typ=sequence.type
local gpossing=typ=="gpos_single" or typ=="gpos_pair"
+ local forcetestrun=testdisc or typ=="gsub_ligature"
local handler=handlers[typ]
local steps=sequence.steps
local nofsteps=sequence.nofsteps
@@ -25912,7 +25913,7 @@ do
local ok
if gpossing then
start,ok=kernrun(start,k_run_single,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler)
- elseif typ=="gsub_ligature" then
+ elseif forcetestrun then
start,ok=testrun(start,t_run_single,c_run_single,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler)
else
start,ok=comprun(start,c_run_single,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler)
@@ -25984,7 +25985,7 @@ do
local ok
if gpossing then
start,ok=kernrun(start,k_run_multiple,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler)
- elseif typ=="gsub_ligature" then
+ elseif forcetestrun then
start,ok=testrun(start,t_run_multiple,c_run_multiple,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler)
else
start,ok=comprun(start,c_run_multiple,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler)
@@ -28765,6 +28766,7 @@ local type,next=type,next
local lpegmatch=lpeg.match
local utfbyte,utflen,utfsplit=utf.byte,utf.len,utf.split
local match=string.match
+local sortedhash=table.sortedhash
local trace_loading=false trackers.register("otf.loading",function(v) trace_loading=v end)
local report_otf=logs.reporter("fonts","otf loading")
local fonts=fonts
@@ -29160,7 +29162,7 @@ local function addfeature(data,feature,specifications)
local lookups=rule.lookups or false
local subtype=nil
if lookups and sublookups then
- for k,v in next,lookups do
+ for k,v in sortedhash(lookups) do
local t=type(v)
if t=="table" then
for i=1,#v do
@@ -29209,7 +29211,7 @@ local function addfeature(data,feature,specifications)
replacements,
subtype,
}
- for unic in next,sequence[start] do
+ for unic in sortedhash(sequence[start]) do
local cu=coverage[unic]
if not cu then
coverage[unic]=rulehash
@@ -29256,9 +29258,9 @@ local function addfeature(data,feature,specifications)
local s=sequences[i]
local f=s.features
if f then
- for k in next,f do
+ for k in sortedhash(f) do
if k==position then
- index=i
+ index=i
break
end
end