From f4c9d2d305f1214a144fcb23a66964761583234a Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 9 Feb 2018 01:00:38 +0100 Subject: 2018-02-09 00:12:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/data-exp.lua | 49 ++++++------- tex/context/base/mkiv/data-res.lua | 6 +- tex/context/base/mkiv/font-ots.lua | 119 ++++++++++++++++++++------------ tex/context/base/mkiv/lang-hyp.lua | 13 ++-- tex/context/base/mkiv/math-ini.mkiv | 11 +++ tex/context/base/mkiv/math-noa.lua | 28 +++++--- tex/context/base/mkiv/meta-imp-mat.mkiv | 40 +++++------ tex/context/base/mkiv/mult-low.lua | 2 +- tex/context/base/mkiv/node-dir.lua | 16 ++--- tex/context/base/mkiv/node-nut.lua | 38 ++++++++++ tex/context/base/mkiv/page-cst.lua | 2 +- tex/context/base/mkiv/page-sid.mkiv | 74 +++++++++++++++----- tex/context/base/mkiv/spac-ver.lua | 14 ++++ tex/context/base/mkiv/status-files.pdf | Bin 25617 -> 25634 bytes tex/context/base/mkiv/status-lua.pdf | Bin 252285 -> 251476 bytes 19 files changed, 279 insertions(+), 141 deletions(-) (limited to 'tex/context/base') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 12dc6435b..87fafab33 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.02.06 18:11} +\newcontextversion{2018.02.09 00:04} %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 3e021b819..708e85fbc 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2018.02.06 18:11} +\edef\contextversion{2018.02.09 00:04} %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 e471eff11..83f7a4a50 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.02.06 18:11} +\newcontextversion{2018.02.09 00:04} %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 2fde8b961..95178bd97 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{2018.02.06 18:11} +\edef\contextversion{2018.02.09 00:04} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/data-exp.lua b/tex/context/base/mkiv/data-exp.lua index e34c52efb..173ca9a4d 100644 --- a/tex/context/base/mkiv/data-exp.lua +++ b/tex/context/base/mkiv/data-exp.lua @@ -332,6 +332,7 @@ local scancache = { } local fullcache = { } ----- simplecache = { } local nofsharedscans = 0 +local addcasecraptoo = true -- experiment to let case matter a bit (still fuzzy) -- So, we assume either a lowercase name or a mixed case one but only one such case -- as having Foo fOo foo FoO FOo etc on the system is braindead in any sane project. @@ -352,11 +353,6 @@ local function scan(files,remap,spec,path,n,m,r,onlyone,tolerant) if onlyone then -- forget about it else - if type(paths) == "string" then - files[lower] = { paths, path } - else - paths[#paths+1] = path - end if name ~= lower then local rl = remap[lower] if not rl then @@ -365,6 +361,21 @@ local function scan(files,remap,spec,path,n,m,r,onlyone,tolerant) elseif trace_globbing and rl ~= name then report_globbing("confusing filename, name: %a, lower: %a, already: %a",name,lower,rl) end + if addcasecraptoo then + local paths = files[name] + if not paths then + files[name] = path + elseif type(paths) == "string" then + files[name] = { paths, path } + else + paths[#paths+1] = path + end + end + end + if type(paths) == "string" then + files[lower] = { paths, path } + else + paths[#paths+1] = path end end else -- probably unique anyway @@ -490,6 +501,12 @@ function resolvers.get_from_content(content,path,name) -- or (content,name) else -- this one does a lookup and resolves a remapped name local name = path + if addcasecraptoo then + local path = files[name] + if path then + return path, name + end + end local used = lower(name) local path = files[used] if path then @@ -500,28 +517,6 @@ end local nothing = function() end --- function resolvers.filtered_from_content(content,pattern) --- if content and type(pattern) == "string" then --- local pattern = lower(pattern) --- local files = content.files --- local remap = content.remap --- if files and remap then --- local n = next(files) --- local function iterator() --- while n do --- local k = n --- n = next(files,k) --- if find(k,pattern) then --- return files[k], remap and remap[k] or k --- end --- end --- end --- return iterator --- end --- end --- return nothing --- end - function resolvers.filtered_from_content(content,pattern) if content and type(pattern) == "string" then local pattern = lower(pattern) diff --git a/tex/context/base/mkiv/data-res.lua b/tex/context/base/mkiv/data-res.lua index d826d0987..9fb33f88d 100644 --- a/tex/context/base/mkiv/data-res.lua +++ b/tex/context/base/mkiv/data-res.lua @@ -972,7 +972,7 @@ end local function collect_files(names) -- potential files .. sort of too much when asking for just one file local filelist = { } -- but we need it for pattern matching later on local noffiles = 0 - local function check(hash,root,pathname,path,name) + local function check(hash,root,pathname,path,basename,name) if not pathname or find(path,pathname) then local variant = hash.type local search = filejoin(root,path,name) -- funny no concatinator @@ -1011,10 +1011,10 @@ local function collect_files(names) -- potential files .. sort of too much when local metadata = content.metadata local realroot = metadata and metadata.path or hashname if type(path) == "string" then - check(hash,realroot,pathname,path,name) + check(hash,realroot,pathname,path,basename,name) else for i=1,#path do - check(hash,realroot,pathname,path[i],name) + check(hash,realroot,pathname,path[i],basename,name) end end end diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index faed8ec1e..3e338f614 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -111,6 +111,8 @@ mechanisms. Both put some constraints on the code here.

-- -- Remark: Some optimizations made sense for 5.2 but seem less important for 5.3 but -- anyway served their purpose. +-- +-- Todo: just (0=l2r and 1=r2l) or maybe (r2l = true) local type, next, tonumber = type, next, tonumber local random = math.random @@ -141,7 +143,6 @@ local trace_bugs = false registertracker("otf.bugs", function local trace_details = false registertracker("otf.details", function(v) trace_details = v end) local trace_steps = false registertracker("otf.steps", function(v) trace_steps = v end) local trace_skips = false registertracker("otf.skips", function(v) trace_skips = v end) -local trace_directions = false registertracker("otf.directions", function(v) trace_directions = v end) local trace_plugins = false registertracker("otf.plugins", function(v) trace_plugins = v end) local trace_chains = false registertracker("otf.chains", function(v) trace_chains = v end) @@ -378,12 +379,10 @@ local function pref(dataset,sequence) end local function mref(rlmode) - if not rlmode or rlmode == 0 then - return "---" - elseif rlmode == -1 or rlmode == "+TRT" then - return "r2l" - else + if not rlmode or rlmode >= 0 then return "l2r" + else + return "r2l" end end @@ -3610,97 +3609,125 @@ end -- to be checked, nowadays we probably can assume properly matched directions -- so maybe we no longer need a stack +-- local function txtdirstate(start,stack,top,rlparmode) +-- local dir = getdir(start) +-- local new = 1 +-- if dir == "+TRT" then +-- top = top + 1 +-- stack[top] = dir +-- new = -1 +-- elseif dir == "+TLT" then +-- top = top + 1 +-- stack[top] = dir +-- elseif dir == "-TRT" or dir == "-TLT" then +-- if top == 1 then +-- top = 0 +-- new = rlparmode +-- else +-- top = top - 1 +-- if stack[top] == "+TRT" then +-- new = -1 +-- end +-- end +-- else +-- new = rlparmode +-- end +-- return getnext(start), top, new +-- end +-- +-- local function pardirstate(start) +-- local dir = getdir(start) +-- local new = 0 +-- if dir == "TLT" then +-- new = 1 +-- elseif dir == "TRT" then +-- new = -1 +-- end +-- return getnext(start), new, new +-- end + local function txtdirstate(start,stack,top,rlparmode) + local nxt = getnext(start) local dir = getdir(start) - local new = 1 if dir == "+TRT" then top = top + 1 stack[top] = dir - new = -1 + return nxt, top, -1 elseif dir == "+TLT" then top = top + 1 stack[top] = dir + return nxt, top, 1 elseif dir == "-TRT" or dir == "-TLT" then if top == 1 then - top = 0 - new = rlparmode + return nxt, 0, rlparmode else top = top - 1 if stack[top] == "+TRT" then - new = -1 + return nxt, top, -1 + else + return nxt, top, 1 end end else - new = rlparmode - end - if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, level %a",dir,mref(rlparmode),mref(new),top) + return nxt, top, rlparmode end - return getnext(start), top, new end local function pardirstate(start) + local nxt = getnext(start) local dir = getdir(start) - local new = 0 if dir == "TLT" then - new = 1 + return nxt, 1, 1 elseif dir == "TRT" then - new = -1 - end - if trace_directions then - report_process("directions after pardir %a: parmode %a",dir,mref(new)) + return nxt, -1, -1 + else + return nxt, 0, 0 end - return getnext(start), new, new end --- -- some day we move to this: +-- -- this will become: +-- +-- local getdirection = nuts.getdirection -- -- local function txtdirstate1(start,stack,top,rlparmode) +-- local nxt = getnext(start) -- local dir, sub = getdirection(start) --- local new -- if sub then -- if top == 1 then --- top = 0 --- new = rlparmode +-- return nxt, 0, rlparmode -- elseif dir < 2 then -- top = top - 1 -- if stack[top] == 1 then --- new = -1 +-- return nxt, top, -1 -- else --- new = 1 +-- return nxt, top, 1 -- end -- else --- new = rlparmode +-- return nxt, top, rlparmode -- end -- elseif dir == 1 then -- top = top + 1 -- stack[top] = 1 --- new = -1 +-- return nxt, top, -1 -- elseif dir == 0 then -- top = top + 1 -- stack[top] = 0 --- new = 1 +-- return nxt, top, 1 -- else --- new = rlparmode +-- return nxt, top, rlparmode -- end --- if trace_directions then --- report_process("directions after txtdir %a: parmode %a, txtmode %a, level %a",dir,mref(rlparmode),mref(new),top) --- end --- return getnext(start), top, new -- end -- --- local function pardirstate(start) +-- local function pardirstate1(start) +-- local nxt = getnext(start) -- local dir = getdirection(start) --- local new = 0 -- if dir == 0 then --- new = 1 +-- return nxt, 1, 1 -- elseif dir == 1 then --- new = -1 --- end --- if trace_directions then --- report_process("directions after pardir %a: parmode %a",dir,mref(new)) +-- return nxt, -1, -1 +-- else +-- return nxt, 0, 0 -- end --- return getnext(start), new, new -- end otf.helpers = otf.helpers or { } @@ -3812,6 +3839,7 @@ do end local initialrl = direction == "TRT" and -1 or 0 + -- local initialrl = (direction == 1 or direction == "TRT") and -1 or 0 local done = false -- local datasets = otf.dataset(tfmdata,font,attr) @@ -4095,6 +4123,7 @@ do local dirstack = { } -- could move outside function but we can have local runs local start = head local initialrl = direction == "TRT" and -1 or 0 + -- local initialrl = (direction == 1 or direction == "TRT") and -1 or 0 local rlmode = initialrl local rlparmode = initialrl local topstack = 0 diff --git a/tex/context/base/mkiv/lang-hyp.lua b/tex/context/base/mkiv/lang-hyp.lua index 53a368b07..f73a51b3a 100644 --- a/tex/context/base/mkiv/lang-hyp.lua +++ b/tex/context/base/mkiv/lang-hyp.lua @@ -1042,6 +1042,7 @@ featureset.hyphenonly = hyphenonly == v_yes local extrachars = nil local hyphenchars = nil local language = nil + local lastfont = nil local start = nil local stop = nil local word = { } -- we reuse this table @@ -1404,6 +1405,8 @@ featureset.hyphenonly = hyphenonly == v_yes local skipping = false + -- In "word word word." the sequences "word" and "." can be a different font! + while current and current ~= last do -- and current local code, id = isglyph(current) if code then @@ -1411,7 +1414,8 @@ featureset.hyphenonly = hyphenonly == v_yes current = getnext(current) else local lang = getlang(current) - if lang ~= language then + local font = getfont(current) + if lang ~= language or font ~= lastfont then if dictionary and size > charmin and leftmin + rightmin <= size then -- only german has many words starting with an uppercase character if categories[word[1]] == "lu" and getfield(start,"uchyph") < 0 then @@ -1423,10 +1427,10 @@ featureset.hyphenonly = hyphenonly == v_yes end end end - language = lang - if language > 0 then + lastfont = font + if language ~= lang and lang > 0 then -- - dictionary = dictionaries[language] + dictionary = dictionaries[lang] instance = dictionary.instance characters = dictionary.characters unicodes = dictionary.unicodes @@ -1457,6 +1461,7 @@ featureset.hyphenonly = hyphenonly == v_yes else size = 0 end + language = lang elseif language <= 0 then -- elseif size > 0 then diff --git a/tex/context/base/mkiv/math-ini.mkiv b/tex/context/base/mkiv/math-ini.mkiv index cf00c6773..4e00e200d 100644 --- a/tex/context/base/mkiv/math-ini.mkiv +++ b/tex/context/base/mkiv/math-ini.mkiv @@ -169,6 +169,17 @@ {\endgroup \stopimath} +\unexpanded\def\startpickupmath % for the moment private + {\ifconditional\indisplaymath + \startforceddisplaymath + \let\stoppickupmath\stopforceddisplaymath + \else + \startimath + \let\stoppickupmath\stopimath + \fi} + +\let\stoppickupmath\relax + % \unexpanded\def\rawmathcharacter#1% slow but only for tracing % {\begingroup % \ifmmode diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua index f20712b31..a00c94a52 100644 --- a/tex/context/base/mkiv/math-noa.lua +++ b/tex/context/base/mkiv/math-noa.lua @@ -1175,6 +1175,7 @@ do alternates = alternates, registered = registered, presets = { }, + resets = { }, hashes = setmetatableindex("table") } resources.mathalternates = mathalternates @@ -1239,7 +1240,7 @@ do local fontdata = fonts.hashes.identifiers local fontresources = fonts.hashes.resources - local function getalternate(fam,tag) + local function getalternate(fam,tag,current) local resources = fontresources[font_of_family(fam)] local attribute = unsetvalue if resources then @@ -1247,25 +1248,37 @@ do if mathalternates then local presets = mathalternates.presets if presets then + local resets = mathalternates.resets attribute = presets[tag] if not attribute then attribute = 0 local alternates = mathalternates.alternates for s in gmatch(tag,"[^, ]+") do - local a = alternates[s] -- or known[s] - if a then - attribute = attribute + a + if s == v_reset then + resets[tag] = true + current = unsetvalue + else + local a = alternates[s] -- or known[s] + if a then + attribute = bor(attribute,a) + end end end if attribute == 0 then attribute = unsetvalue end presets[tag] = attribute + elseif resets[tag] then + current = unsetvalue end end end end - return attribute + if attribute > 0 and current and current > 0 then + return bor(current,attribute) + else + return attribute + end end local function presetalternate(fam,tag) @@ -1280,10 +1293,7 @@ do local function setalternate(fam,tag) local a = texgetattribute(a_mathalternate) - local v = getalternate(fam,tag) - if a and a > 0 then - v = a + v - end + local v = getalternate(fam,tag,a) texsetattribute(a_mathalternate,v) end diff --git a/tex/context/base/mkiv/meta-imp-mat.mkiv b/tex/context/base/mkiv/meta-imp-mat.mkiv index 7443841ed..11a9ded34 100644 --- a/tex/context/base/mkiv/meta-imp-mat.mkiv +++ b/tex/context/base/mkiv/meta-imp-mat.mkiv @@ -121,69 +121,65 @@ % main handler - def math_stacker_draw(expr p) = - draw - p - withpen - pencircle - % xscaled (2OverlayLineWidth) - % yscaled (3OverlayLineWidth) - % rotated 45 ; - scaled (OverlayLineWidth) ; + def math_stacker_draw_accent(expr p) = + draw p withpen pencircle scaled OverlayLineWidth xyscaled (2,3) rotated 45 ; enddef ; + def math_stacker_draw_arrow(expr p) = + draw p withpen pencircle scaled OverlayLineWidth ; + enddef ; \stopMPextensions \startuniqueMPgraphic{math:stacker:\number"FE3B4}{axis,ex,em} - math_stacker_draw(math_stacker_overbracket_shape) ; + math_stacker_draw_accent(math_stacker_overbracket_shape) ; \stopuniqueMPgraphic \startuniqueMPgraphic{math:stacker:\number"FE3B5}{axis,ex,em} - math_stacker_draw(math_stacker_underbracket_shape) ; + math_stacker_draw_accent(math_stacker_underbracket_shape) ; \stopuniqueMPgraphic \startuniqueMPgraphic{math:stacker:\number"FE3DC}{axis,ex,em} - math_stacker_draw(math_stacker_overparent_shape) ; + math_stacker_draw_accent(math_stacker_overparent_shape) ; \stopuniqueMPgraphic \startuniqueMPgraphic{math:stacker:\number"FE3DD}{axis,ex,em} - math_stacker_draw(math_stacker_underparent_shape) ; + math_stacker_draw_accent(math_stacker_underparent_shape) ; \stopuniqueMPgraphic \startuniqueMPgraphic{math:stacker:\number"FE3DE}{axis,ex,em} - math_stacker_draw(math_stacker_overbrace_shape) ; + math_stacker_draw_accent(math_stacker_overbrace_shape) ; \stopuniqueMPgraphic \startuniqueMPgraphic{math:stacker:\number"FE3DF}{axis,ex,em} - math_stacker_draw(math_stacker_underbrace_shape) ; + math_stacker_draw_accent(math_stacker_underbrace_shape) ; \stopuniqueMPgraphic \startuniqueMPgraphic{math:stacker:\number"FE33E}{axis,ex,em} - math_stacker_draw(math_stacker_overbar_shape) ; + math_stacker_draw_accent(math_stacker_overbar_shape) ; \stopuniqueMPgraphic \startuniqueMPgraphic{math:stacker:\number"FE33F}{axis,ex,em} - math_stacker_draw(math_stacker_underbar_shape) ; + math_stacker_draw_accent(math_stacker_underbar_shape) ; \stopuniqueMPgraphic \startuniqueMPgraphic{math:stacker:\number"2190}{axis,ex,em} - math_stacker_draw(math_stacker_leftarrow_shape(\MPvar{axis},\MPvar{ex},\MPvar{em})) ; + math_stacker_draw_arrow(math_stacker_leftarrow_shape(\MPvar{axis},\MPvar{ex},\MPvar{em})) ; \stopuniqueMPgraphic \startuniqueMPgraphic{math:stacker:\number"2192}{axis,ex,em} - math_stacker_draw(math_stacker_rightarrow_shape(\MPvar{axis},\MPvar{ex},\MPvar{em})) ; + math_stacker_draw_arrow(math_stacker_rightarrow_shape(\MPvar{axis},\MPvar{ex},\MPvar{em})) ; \stopuniqueMPgraphic \startuniqueMPgraphic{math:stacker:\number"2194}{axis,ex,em} - math_stacker_draw(math_stacker_leftrightarrow_shape(\MPvar{axis},\MPvar{ex},\MPvar{em})) ; + math_stacker_draw_arrow(math_stacker_leftrightarrow_shape(\MPvar{axis},\MPvar{ex},\MPvar{em})) ; \stopuniqueMPgraphic \startuniqueMPgraphic{math:stacker:\number"27F7}{axis,ex,em} - math_stacker_draw(math_stacker_leftrightarrow_shape(\MPvar{axis},\MPvar{ex},\MPvar{em})) ; + math_stacker_draw_arrow(math_stacker_leftrightarrow_shape(\MPvar{axis},\MPvar{ex},\MPvar{em})) ; \stopuniqueMPgraphic \startuniqueMPgraphic{math:stacker:\number"21C4}{axis,ex,em} - math_stacker_draw(math_stacker_rightoverleftarrow_shape(\MPvar{axis},\MPvar{ex},\MPvar{em})) ; + math_stacker_draw_arrow(math_stacker_rightoverleftarrow_shape(\MPvar{axis},\MPvar{ex},\MPvar{em})) ; \stopuniqueMPgraphic %D Radicals: diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index f54052bb0..2a43ba9cd 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -179,7 +179,7 @@ return { -- "donetrue", "donefalse", "foundtrue", "foundfalse", -- - "inlineordisplaymath","indisplaymath","forcedisplaymath","startforceddisplaymath","stopforceddisplaymath","reqno", + "inlineordisplaymath","indisplaymath","forcedisplaymath","startforceddisplaymath","stopforceddisplaymath","startpickupmath","stoppickupmath","reqno", -- "mathortext", -- diff --git a/tex/context/base/mkiv/node-dir.lua b/tex/context/base/mkiv/node-dir.lua index 6ee5cd4b8..59564ac93 100644 --- a/tex/context/base/mkiv/node-dir.lua +++ b/tex/context/base/mkiv/node-dir.lua @@ -26,14 +26,14 @@ nodes.is_mirrored = allocate { -- RTT = false, } -nodes.is_rotated = allocate { +nodes.is_rotated = allocate { -- used -- TLT = false, -- TRT = false, -- LTL = false, RTT = true, ["+RTT"] = true, } -nodes.textdir_is_parallel = allocate { +nodes.textdir_is_parallel = allocate { -- used TLT = { TLT = true, ["+TLT"] = true, TRT = true, ["+TRT"] = true, @@ -114,7 +114,7 @@ nodes.pardir_is_opposite = allocate { }, } -nodes.textdir_is_opposite = allocate { +nodes.textdir_is_opposite = allocate { -- used TLT = { -- TLT = false, TRT = true, ["+TRT"] = true, @@ -168,7 +168,7 @@ nodes.glyphdir_is_opposite = allocate { }, } -nodes.pardir_is_equal = allocate { +nodes.pardir_is_equal = allocate { -- used TLT = { TLT = true, ["+TLT"] = true, TRT = true, ["+TRT"] = true, @@ -195,7 +195,7 @@ nodes.pardir_is_equal = allocate { }, } -nodes.textdir_is_equal = allocate { +nodes.textdir_is_equal = allocate { -- used TLT = { TLT = true, ["+TLT"] = true, -- TRT = false, @@ -222,7 +222,7 @@ nodes.textdir_is_equal = allocate { }, } -nodes.glyphdir_is_equal = allocate { +nodes.glyphdir_is_equal = allocate { -- used TLT = { TLT = true, ["+TLT"] = true, TRT = true, ["+TRT"] = true, @@ -290,14 +290,14 @@ nodes.glyphdir_is_orthogonal = allocate { -- RTT = false } -nodes.dir_is_pop = allocate { +nodes.dir_is_pop = allocate { -- used ["-TRT"] = true, ["-TLT"] = true, ["-LTL"] = true, ["-RTT"] = true, } -nodes.dir_negation = allocate { +nodes.dir_negation = allocate { -- used ["-TRT"] = "+TRT", ["-TLT"] = "+TLT", ["-LTL"] = "+LTL", diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua index a621b6481..fe154504f 100644 --- a/tex/context/base/mkiv/node-nut.lua +++ b/tex/context/base/mkiv/node-nut.lua @@ -144,13 +144,48 @@ nodes.tonut = tonut -- helpers if not direct.getfam then -- LUATEXVERSION < 1.070 + local getfield = direct.getfield local setfield = direct.setfield direct.getfam = function(n) return getfield(n,"small_fam") end direct.setfam = function(n,f) setfield(n,"small_fam",f) end + +end + +if not direct.getdirection then + + local getdir = direct.getdir + local setdir = direct.setdir + + direct.getdirection = function(n) + local d = getdir(n) + if d == "TLT" then return 0 end + if d == "+TLT" then return 0, false end + if d == "-TLT" then return 0, true end + if d == "TRT" then return 1 end + if d == "+TRT" then return 1, false end + if d == "-TRT" then return 1, true end + if d == "LTL" then return 2 end + if d == "+LTL" then return 2, false end + if d == "-LTL" then return 2, true end + if d == "RTT" then return 3 end + if d == "+RTT" then return 3, false end + if d == "-RTT" then return 3, true end + end + + direct.setdirection = function(n,d,c) + if d == 0 then if c == true then setdir("-TLT") elseif c == false then setdir("+TLT") else setdir("TLT") end + elseif d == 1 then if c == true then setdir("-TRT") elseif c == false then setdir("+TRT") else setdir("TRT") end + elseif d == 2 then if c == true then setdir("-LTL") elseif c == false then setdir("+LTL") else setdir("LTL") end + elseif d == 3 then if c == true then setdir("-RTT") elseif c == false then setdir("+RTT") else setdir("RTT") end + else if c == true then setdir("-TLT") elseif c == false then setdir("+TLT") else setdir("TLT") end end + end + end +local nuts = nodes.nuts + nuts.tostring = direct.tostring nuts.copy = direct.copy nuts.copy_node = direct.copy @@ -300,6 +335,9 @@ nuts.setkern = direct.setkern nuts.getdir = direct.getdir nuts.setdir = direct.setdir +nuts.getdirection = direct.getdirection +nuts.setdirection = direct.setdirection + nuts.getpenalty = direct.getpenalty nuts.setpenalty = direct.setpenalty diff --git a/tex/context/base/mkiv/page-cst.lua b/tex/context/base/mkiv/page-cst.lua index ec59045a1..8b8214ab3 100644 --- a/tex/context/base/mkiv/page-cst.lua +++ b/tex/context/base/mkiv/page-cst.lua @@ -640,7 +640,7 @@ function columnsets.check(t) texsetcount("c_page_grd_reserved_state",5) return end --- report("checking width %p, height %p, depth %p, slot (%i,%i)",boxwidth,boxheight,boxdepth,c,r) + -- report("checking width %p, height %p, depth %p, slot (%i,%i)",boxwidth,boxheight,boxdepth,c,r) local nr = ceil(boxheight/(lineheight+linedepth)) -- local action = methods[method] diff --git a/tex/context/base/mkiv/page-sid.mkiv b/tex/context/base/mkiv/page-sid.mkiv index 46e4cd073..8fee9d4ed 100644 --- a/tex/context/base/mkiv/page-sid.mkiv +++ b/tex/context/base/mkiv/page-sid.mkiv @@ -279,9 +279,10 @@ \doloop {\scratchdimen\dimexpr \d_page_sides_vsize - \ifnum\c_anch_backgrounds_text_level>\plusone +% no longer with the adapted skipper +% \ifnum\c_anch_backgrounds_text_level>\plusone -\d_page_sides_bottomskip - \fi +% \fi -\pagetotal -\pagedepth \relax @@ -843,26 +844,65 @@ \fi \fi} -\def\page_sides_inject_dummy_lines_normal - {\dorecurse\privatescratchcounter{\hpack to \hsize{\strut\hss}}} +% \def\page_sides_inject_dummy_lines_normal +% {\dorecurse\privatescratchcounter{\hpack to \hsize{\strut\hss}}} +% +% \def\page_sides_inject_dummy_lines_traced +% {\dorecurse\privatescratchcounter{\ruledhpack{\backgroundline[trace:b]{\hpack to \hsize{\strut\hss}}}}} +% +% \def\page_sides_inject_dummy_lines % so always one +% {\begingroup +% \privatescratchcounter\pageshrink +% \divide\privatescratchcounter \baselineskip +% \advance\privatescratchcounter \plusone +% \parskip\zeropoint +% \iftracesidefloats +% \page_sides_inject_dummy_lines_traced +% \else +% \page_sides_inject_dummy_lines_normal +% \fi +% \kern-\privatescratchcounter\baselineskip +% \penalty\zerocount +% \triggerpagebuilder % the penalty already does that +% \endgroup} + +\def\page_sides_inject_dummy_line_normal + {\hpack to \hsize{\strut\hss}} -\def\page_sides_inject_dummy_lines_traced - {\dorecurse\privatescratchcounter{\ruledhpack{\backgroundline[trace:b]{\hpack to \hsize{\strut\hss}}}}} +\def\page_sides_inject_dummy_line_traced + {\ruledhpack to \hsize{\backgroundline[trace:b]{\page_sides_inject_dummy_line_normal}}} + +% \def\page_sides_inject_dummy_lines % so always one +% {\par +% \begingroup +% \dontleavehmode +% \iftracesidefloats +% \page_sides_inject_dummy_line_traced +% \else +% \page_sides_inject_dummy_line_normal +% \fi +% \vskip-\lineheight +% \vskip-\parskip +% \endgroup} \def\page_sides_inject_dummy_lines % so always one - {\begingroup + {\par + \begingroup \privatescratchcounter\pageshrink - \divide\privatescratchcounter \baselineskip - \advance\privatescratchcounter \plusone - \parskip\zeropoint - \iftracesidefloats - \page_sides_inject_dummy_lines_traced - \else - \page_sides_inject_dummy_lines_normal + \divide\privatescratchcounter \lineheight % \baselineskip + \advance\privatescratchcounter\plusone + \ifcase\privatescratchcounter\else + \dorecurse\privatescratchcounter + {\dontleavehmode + \iftracesidefloats + \page_sides_inject_dummy_line_traced + \else + \page_sides_inject_dummy_line_normal + \fi + \par}% \fi - \kern-\privatescratchcounter\baselineskip - \penalty\zerocount - \triggerpagebuilder % the penalty already does that + \vskip-\lineheight + \vskip-\parskip \endgroup} \def\adjustsidefloatdisplaylines % public, will change diff --git a/tex/context/base/mkiv/spac-ver.lua b/tex/context/base/mkiv/spac-ver.lua index 0146b1178..67363c4ed 100644 --- a/tex/context/base/mkiv/spac-ver.lua +++ b/tex/context/base/mkiv/spac-ver.lua @@ -2115,4 +2115,18 @@ do end } + interfaces.implement { + name = "showpagelist", -- will improve + actions = function() + local head = texlists.page_head + if head then + print("start") + while head do + print(" " .. tostring(head)) + head = head.next + end + end + end + } + end diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index e2b1f0619..f81e25bd6 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index 5a7acc5ef..ede502605 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ -- cgit v1.2.3