diff options
Diffstat (limited to 'tex')
44 files changed, 759 insertions, 423 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 4d3a3c36f..c1707a16c 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.14 22:56} +\newcontextversion{2018.02.19 18:56} %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 57b284852..2ec3390c7 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.14 22:56} +\edef\contextversion{2018.02.19 18:56} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-it.mkii b/tex/context/base/mkii/mult-it.mkii index ba47f624b..19ec32e10 100644 --- a/tex/context/base/mkii/mult-it.mkii +++ b/tex/context/base/mkii/mult-it.mkii @@ -1162,6 +1162,7 @@ \setinterfaceconstant{sidemethod}{sidemethod} \setinterfaceconstant{sidespaceafter}{spaziolateraledopo} \setinterfaceconstant{sidespacebefore}{spaziolateraleprima} +\setinterfaceconstant{sidespaceinbetween}{sidespaceinbetween} \setinterfaceconstant{sidethreshold}{sidethreshold} \setinterfaceconstant{sign}{segno} \setinterfaceconstant{simplecommand}{simplecommand} diff --git a/tex/context/base/mkii/mult-ro.mkii b/tex/context/base/mkii/mult-ro.mkii index 0e1efc671..de3a8c84a 100644 --- a/tex/context/base/mkii/mult-ro.mkii +++ b/tex/context/base/mkii/mult-ro.mkii @@ -1162,6 +1162,7 @@ \setinterfaceconstant{sidemethod}{sidemethod} \setinterfaceconstant{sidespaceafter}{spatiulateraldupa} \setinterfaceconstant{sidespacebefore}{spatiulateralinainte} +\setinterfaceconstant{sidespaceinbetween}{sidespaceinbetween} \setinterfaceconstant{sidethreshold}{sidethreshold} \setinterfaceconstant{sign}{semn} \setinterfaceconstant{simplecommand}{simplecommand} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index aec47b145..03714b5c7 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.14 22:56} +\newcontextversion{2018.02.19 18:56} %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 ec035b2b2..6c5b378b0 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.14 22:56} +\edef\contextversion{2018.02.19 18:56} \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 173ca9a4d..994399e36 100644 --- a/tex/context/base/mkiv/data-exp.lua +++ b/tex/context/base/mkiv/data-exp.lua @@ -337,49 +337,115 @@ 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. +-- local function scan(files,remap,spec,path,n,m,r,onlyone,tolerant) +-- local full = path == "" and spec or (spec .. path .. '/') +-- local dirs = { } +-- local nofdirs = 0 +-- local pattern = tolerant and lessweird or weird +-- for name in directory(full) do +-- if not lpegmatch(pattern,name) then +-- local mode = attributes(full..name,"mode") +-- if mode == "file" then +-- n = n + 1 +-- local lower = lower(name) +-- local paths = files[lower] +-- if paths then +-- if onlyone then +-- -- forget about it +-- else +-- if name ~= lower then +-- local rl = remap[lower] +-- if not rl then +-- remap[lower] = name +-- r = r + 1 +-- 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 +-- files[lower] = path +-- if name ~= lower then +-- local rl = remap[lower] +-- if not rl then +-- remap[lower] = name +-- r = r + 1 +-- elseif trace_globbing and rl ~= name then +-- report_globbing("confusing filename, name: %a, lower: %a, already: %a",name,lower,rl) +-- end +-- end +-- end +-- elseif mode == "directory" then +-- m = m + 1 +-- nofdirs = nofdirs + 1 +-- if path ~= "" then +-- dirs[nofdirs] = path .. "/" .. name +-- else +-- dirs[nofdirs] = name +-- end +-- end +-- end +-- end +-- if nofdirs > 0 then +-- sort(dirs) +-- for i=1,nofdirs do +-- files, remap, n, m, r = scan(files,remap,spec,dirs[i],n,m,r,onlyonce,tolerant) +-- end +-- end +-- scancache[sub(full,1,-2)] = files +-- return files, remap, n, m, r +-- end + local function scan(files,remap,spec,path,n,m,r,onlyone,tolerant) - local full = path == "" and spec or (spec .. path .. '/') - local dirs = { } - local nofdirs = 0 - local pattern = tolerant and lessweird or weird + local full = path == "" and spec or (spec .. path .. '/') + local dirlist = { } + local nofdirs = 0 + local pattern = tolerant and lessweird or weird + local filelist = { } + local noffiles = 0 for name in directory(full) do if not lpegmatch(pattern,name) then local mode = attributes(full..name,"mode") if mode == "file" then n = n + 1 - local lower = lower(name) - local paths = files[lower] - if paths then - if onlyone then - -- forget about it - else - if name ~= lower then - local rl = remap[lower] - if not rl then - remap[lower] = name - r = r + 1 - 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 - files[lower] = path + noffiles = noffiles + 1 + filelist[noffiles] = name + elseif mode == "directory" then + m = m + 1 + nofdirs = nofdirs + 1 + if path ~= "" then + dirlist[nofdirs] = path .. "/" .. name + else + dirlist[nofdirs] = name + end + end + end + end + if noffiles > 0 then + sort(filelist) + for i=1,noffiles do + local name = filelist[i] + local lower = lower(name) + local paths = files[lower] + if paths then + if onlyone then + -- forget about it + else if name ~= lower then local rl = remap[lower] if not rl then @@ -388,23 +454,41 @@ 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 - elseif mode == "directory" then - m = m + 1 - nofdirs = nofdirs + 1 - if path ~= "" then - dirs[nofdirs] = path .. "/" .. name - else - dirs[nofdirs] = name + else -- probably unique anyway + files[lower] = path + if name ~= lower then + local rl = remap[lower] + if not rl then + remap[lower] = name + r = r + 1 + elseif trace_globbing and rl ~= name then + report_globbing("confusing filename, name: %a, lower: %a, already: %a",name,lower,rl) + end end end end end if nofdirs > 0 then - sort(dirs) + sort(dirlist) for i=1,nofdirs do - files, remap, n, m, r = scan(files,remap,spec,dirs[i],n,m,r,onlyonce,tolerant) + files, remap, n, m, r = scan(files,remap,spec,dirlist[i],n,m,r,onlyonce,tolerant) end end scancache[sub(full,1,-2)] = files diff --git a/tex/context/base/mkiv/font-dsp.lua b/tex/context/base/mkiv/font-dsp.lua index 5ecb9cce3..02e5a7df6 100644 --- a/tex/context/base/mkiv/font-dsp.lua +++ b/tex/context/base/mkiv/font-dsp.lua @@ -3319,9 +3319,10 @@ function readers.stat(f,fontdata,specification) local values = { } setposition(f,tableoffset+axisoffset) for i=1,nofaxis do + local tag = readtag(f) axis[i] = { - tag = readtag(f), - name = lower(extras[readushort(f)]), + tag = tag, + name = lower(extras[readushort(f)] or tag), ordering = readushort(f), -- maybe gaps variants = { } } @@ -3341,7 +3342,7 @@ function readers.stat(f,fontdata,specification) local format = readushort(f) local index = readushort(f) + 1 local flags = readushort(f) - local name = lower(extras[readushort(f)]) + local name = lower(extras[readushort(f)] or "no name") local value = readfixed(f) local variant if format == 1 then diff --git a/tex/context/base/mkiv/l-lpeg.lua b/tex/context/base/mkiv/l-lpeg.lua index fc1357afc..a7ebd567d 100644 --- a/tex/context/base/mkiv/l-lpeg.lua +++ b/tex/context/base/mkiv/l-lpeg.lua @@ -6,6 +6,10 @@ if not modules then modules = { } end modules ['l-lpeg'] = { license = "see context related readme files" } +-- we can get too many captures (e.g. on largexml files) which makes me wonder +-- if P(foo)/"" can't be simplfied to N(foo) i.e. some direct instruction to the +-- lpeg virtual machine to ignore it + -- lpeg 12 vs lpeg 10: slower compilation, similar parsing speed (i need to check -- if i can use new features like capture / 2 and .B (at first sight the xml -- parser is some 5% slower) @@ -17,6 +21,10 @@ if not modules then modules = { } end modules ['l-lpeg'] = { -- move utf -> l-unicode -- move string -> l-string or keep it here +-- lpeg.B : backward without consumption +-- lpeg.F = getmetatable(lpeg.P(1)).__len : forward without consumption + + lpeg = require("lpeg") -- does lpeg register itself global? local lpeg = lpeg diff --git a/tex/context/base/mkiv/lpdf-nod.lua b/tex/context/base/mkiv/lpdf-nod.lua index ca4c51c59..e3c1778f2 100644 --- a/tex/context/base/mkiv/lpdf-nod.lua +++ b/tex/context/base/mkiv/lpdf-nod.lua @@ -24,10 +24,12 @@ local new_node = nuts.new local nodepool = nuts.pool local register = nodepool.register -local pdforiginliteral = register(new_node("whatsit", whatsitcodes.pdfliteral)) setfield(pdforiginliteral,"mode",0) -- set_origin_code -local pdfpageliteral = register(new_node("whatsit", whatsitcodes.pdfliteral)) setfield(pdfpageliteral, "mode",1) -- page_code -local pdfdirectliteral = register(new_node("whatsit", whatsitcodes.pdfliteral)) setfield(pdfdirectliteral,"mode",2) -- direct_code -local pdfrawliteral = register(new_node("whatsit", whatsitcodes.pdfliteral)) setfield(pdfrawliteral, "mode",3) -- raw_code +local literalvalues = nodes.literalvalues + +local pdforiginliteral = register(new_node("whatsit", whatsitcodes.pdfliteral)) setfield(pdforiginliteral,"mode",literalvalues.origin) +local pdfpageliteral = register(new_node("whatsit", whatsitcodes.pdfliteral)) setfield(pdfpageliteral, "mode",literalvalues.page) +local pdfdirectliteral = register(new_node("whatsit", whatsitcodes.pdfliteral)) setfield(pdfdirectliteral,"mode",literalvalues.direct) +local pdfrawliteral = register(new_node("whatsit", whatsitcodes.pdfliteral)) setfield(pdfrawliteral, "mode",literalvalues.raw) local pdfsave = register(new_node("whatsit", whatsitcodes.pdfsave)) local pdfrestore = register(new_node("whatsit", whatsitcodes.pdfrestore)) @@ -37,17 +39,6 @@ local pdfsetmatrix = register(new_node("whatsit", whatsitcodes.pdfsetmatrix) local variables = interfaces.variables -local views = { -- beware, we do support the pdf keys but this is *not* official - xyz = 0, [variables.standard] = 0, - fit = 1, [variables.fit] = 1, - fith = 2, [variables.width] = 2, - fitv = 3, [variables.height] = 3, - fitb = 4, - fitbh = 5, [variables.minwidth] = 5, - fitbv = 6, [variables.minheight] = 6, - fitr = 7, -} - function nodepool.pdforiginliteral(str) local t = copy_node(pdforiginliteral) setfield(t,"data",str) return t end function nodepool.pdfpageliteral (str) local t = copy_node(pdfpageliteral ) setfield(t,"data",str) return t end function nodepool.pdfdirectliteral(str) local t = copy_node(pdfdirectliteral) setfield(t,"data",str) return t end @@ -138,6 +129,17 @@ end -- -- so we need to force a matrix. +-- local views = { -- beware, we do support the pdf keys but this is *not* official +-- xyz = 0, [variables.standard] = 0, +-- fit = 1, [variables.fit] = 1, +-- fith = 2, [variables.width] = 2, +-- fitv = 3, [variables.height] = 3, +-- fitb = 4, +-- fitbh = 5, [variables.minwidth] = 5, +-- fitbv = 6, [variables.minheight] = 6, +-- fitr = 7, +-- } + function nodepool.pdfdestination(w,h,d,name,view,n) report("don't use node based destinations!") os.exit() diff --git a/tex/context/base/mkiv/lxml-tab.lua b/tex/context/base/mkiv/lxml-tab.lua index cc6ba289a..8d4be58ab 100644 --- a/tex/context/base/mkiv/lxml-tab.lua +++ b/tex/context/base/mkiv/lxml-tab.lua @@ -448,13 +448,13 @@ local function attribute_specification_error(str) return str end --- these will be set later - --- in order to overcome lua limitations we wrap entity stuff in a --- closure +-- I'm sure that this lpeg can be simplified (less captures) but it evolved ... +-- so i'm not going to change it now. do + -- In order to overcome lua limitations we wrap entity stuff in a closure. + local badentity = "&" -- was "&error;" xml.placeholders = { @@ -1128,7 +1128,7 @@ grammar_unparsed_text_yes = install(space_nl, spacing_nl, anything_nl) -- maybe we will add settings to result as well -local function _xmlconvert_(data,settings) +local function _xmlconvert_(data,settings,detail) settings = settings or { } -- no_root strip_cm_and_dt given_entities parent_root error_handler preparexmlstate(settings) if settings.linenumbers then @@ -1156,6 +1156,8 @@ local function _xmlconvert_(data,settings) nt = 0 if not data or data == "" then errorstr = "empty xml file" + elseif data == true then + errorstr = detail or "problematic xml file" elseif utfize or resolve then local m = lpegmatch(grammar_parsed_text_one,data) if m then @@ -1237,8 +1239,10 @@ local function xmlconvert(data,settings) local ok, result = pcall(function() return _xmlconvert_(data,settings) end) if ok then return result + elseif type(result) == "string" then + return _xmlconvert_(true,settings,result) else - return _xmlconvert_("",settings) + return _xmlconvert_(true,settings) end end diff --git a/tex/context/base/mkiv/mult-aux.mkiv b/tex/context/base/mkiv/mult-aux.mkiv index 66745360a..96609c4f0 100644 --- a/tex/context/base/mkiv/mult-aux.mkiv +++ b/tex/context/base/mkiv/mult-aux.mkiv @@ -211,39 +211,22 @@ % % \def\currenttest{oeps} \edef\hans{\detokenizedtestparameter{bagger}}\meaning\hans\par % \def\currenttest{oeps} \edef\hans{\detokenizedtestparameter{reggab}}\meaning\hans\par +% +% slower: \def#3##1{\csname\ifcsname#1#2:##1\endcsname\expandafter\csstring\lastnamedcs\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}% +% +% pre-expansion can be a bit faster but handly any effect on a normal run so let's go for +% saving some memory \def\mult_interfaces_detokenize{\expandafter\expandafter\expandafter\detokenize\expandafter\expandafter\expandafter} -\unexpanded\def\mult_interfaces_install_parameter_handler#1#2#3#4#5#6#7#8#9% inlining \csname*\endcsname is more efficient (#3 and #6 only) - {\ifx#2\relax\let#2\empty\fi % it is hardly faster but produces less expansion tracing - %\def#3##1{\csname#4{#1#2}{##1}\endcsname}% +\unexpanded\def\mult_interfaces_install_parameter_handler#1#2#3#4#5#6#7#8% inlining \csname*\endcsname is more efficient (#3 and #6 only) + {\ifx#2\relax\let#2\empty\fi % it is hardly faster but produces less expansion tracing \def#3##1{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}% \def#4##1##2{\ifcsname##1:##2\endcsname##1:##2\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}% - %\def#5##1##2{\ifx##1\relax\s!empty\else#4{##1}{##2}\fi}% is {} needed around ##1 ? \def#5##1##2{\ifx##1\relax\??empty\else#4{##1}{##2}\fi}% is {} needed around ##1 ? \def#6##1##2{\csname\ifcsname#1##1:##2\endcsname#1##1:##2\else\expandafter#5\csname#1##1:\s!parent\endcsname{##2}\fi\endcsname}% \def#7##1{\detokenize\expandafter\expandafter\expandafter{\csname#1#2:##1\endcsname}}% always root, no backtrack - % \def#7##1{\mult_interfaces_detokenize{\csname#4{#1#2}{##1}\endcsname}}% compact version - % \def#7##1{\mult_interfaces_detokenize{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}}% -%% \def#8##1{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\s!empty\fi\endcsname}% - \def#8##1{\begincsname#1#2:##1\endcsname}% - \def#9##1{\csname#1#2:##1\endcsname}} % can go when we use \begincsname - -% pre-expansion can be a bit faster but handly any effect on a normal run so let's go for -% saving some memory -% -% \unexpanded\def\mult_interfaces_install_parameter_handler#1#2#3#4#5#6#7#8#9% inlining \csname*\endcsname is more efficient (#3 and #6 only) -% {\ifx#2\relax\let#2\empty\fi % it is hardly faster but produces less expansion tracing -% %\def#3##1{\csname#4{#1#2}{##1}\endcsname}% -% \edef#3##1{\noexpand\csname\noexpand\ifcsname#1\noexpand#2:##1\endcsname#1\noexpand#2:##1\noexpand\else\noexpand\expandafter\noexpand#5\noexpand\csname#1\noexpand#2:\s!parent\endcsname{##1}\noexpand\fi\endcsname}% -% \edef#4##1##2{\noexpand\ifcsname##1:##2\endcsname##1:##2\noexpand\else\noexpand\expandafter\noexpand#5\noexpand\csname##1:\s!parent\endcsname{##2}\noexpand\fi}% -% \def #5##1##2{\ifx##1\relax\s!empty\else#4{##1}{##2}\fi}% is {} needed around ##1 ? -% \edef#6##1##2{\noexpand\csname\noexpand\ifcsname#1##1:##2\endcsname#1##1:##2\noexpand\else\noexpand\expandafter\noexpand#5\noexpand\csname#1##1:\s!parent\endcsname{##2}\noexpand\fi\endcsname}% -% \def#7##1{\detokenize\expandafter\expandafter\expandafter{\csname#1#2:##1\endcsname}}% always root, no backtrack -% % \def#7##1{\mult_interfaces_detokenize{\csname#4{#1#2}{##1}\endcsname}}% compact version -% % \def#7##1{\mult_interfaces_detokenize{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}}% -% \edef#8##1{\noexpand\csname\noexpand\ifcsname#1\noexpand#2:##1\endcsname#1\noexpand#2:##1\noexpand\else\s!empty\noexpand\fi\endcsname}% -% \edef#9##1{\noexpand\csname#1#2:##1\endcsname}} + \def#8##1{\begincsname#1#2:##1\endcsname}} \unexpanded\def\installparameterhandler#1#2% {\normalexpanded @@ -255,13 +238,10 @@ \expandafter\noexpand\csname do#2parentparameter\endcsname % or : #2_parent_parameter \expandafter\noexpand\csname named#2parameter\endcsname \expandafter\noexpand\csname detokenized#2parameter\endcsname - \expandafter\noexpand\csname strict#2parameter\endcsname % checked - \expandafter\noexpand\csname direct#2parameter\endcsname}} % unchecked + \expandafter\noexpand\csname direct#2parameter\endcsname}} % strict#2parameter is gone \unexpanded\def\mult_interfaces_install_root_parameter_handler#1#2#3% {\def#2##1{\detokenize\expandafter\expandafter\expandafter{\csname#1:##1\endcsname}}% always root - %\def#3##1{\csname\ifcsname#1:##1\endcsname#1:##1\else\s!empty\fi\endcsname}} - %\def#3##1{\csname\ifcsname#1:##1\endcsname#1:##1\else\??empty\fi\endcsname}} \def#3##1{\begincsname#1:##1\endcsname}} \unexpanded\def\installrootparameterhandler#1#2% @@ -630,7 +610,7 @@ {\def#3##1{\begincsname#1##1\endcsname}% \def#4##1{\detokenize\expandafter\expandafter\expandafter{\csname#1##1\endcsname}}% % \def#4##1{\mult_interfaces_detokenize{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}}% - \def#5##1{\csname#1##1\endcsname}} + \def#5##1{\begincsname#1##1\endcsname}} \unexpanded\def\installdirectparameterhandler#1#2% {\normalexpanded @@ -780,13 +760,13 @@ \newcount\c_mult_interfaces_n_of_namespaces %def\v_interfaces_prefix_template{\number \c_mult_interfaces_n_of_namespaces>} -\def\v_interfaces_prefix_template{\characters\c_mult_interfaces_n_of_namespaces>} +%def\v_interfaces_prefix_template{\characters\c_mult_interfaces_n_of_namespaces>} -\def\v_interfaces_prefix_template % consistently %03i> - {\ifnum\c_mult_interfaces_n_of_namespaces<\plusten00\else\ifnum\c_mult_interfaces_n_of_namespaces<\plushundred0\fi\fi - \number\c_mult_interfaces_n_of_namespaces>} +%def\v_interfaces_prefix_template % consistently %03i> +% {\ifnum\c_mult_interfaces_n_of_namespaces<\plusten00\else\ifnum\c_mult_interfaces_n_of_namespaces<\plushundred0\fi\fi +% \number\c_mult_interfaces_n_of_namespaces>} -\def\v_interfaces_prefix_template % consistently %03i> +\def\v_interfaces_prefix_template {\number\c_mult_interfaces_n_of_namespaces>} \unexpanded\def\installnamespace#1% for modules and users @@ -822,9 +802,8 @@ \letvalue\??dummy\empty -%% \def\dummyparameter #1{\csname\??dummy\ifcsname\??dummy#1\endcsname#1\fi\endcsname} \def\dummyparameter #1{\begincsname\??dummy#1\endcsname} - \def\directdummyparameter#1{\csname\??dummy#1\endcsname} + \def\directdummyparameter#1{\begincsname\??dummy#1\endcsname} \unexpanded\def\setdummyparameter #1{\expandafter\def\csname\??dummy#1\endcsname} \unexpanded\def\letdummyparameter #1{\expandafter\let\csname\??dummy#1\endcsname} diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua index e9f40c87e..e15306c7c 100644 --- a/tex/context/base/mkiv/mult-def.lua +++ b/tex/context/base/mkiv/mult-def.lua @@ -10485,6 +10485,10 @@ return { ["pe"]="فضایکناریقبل", ["ro"]="spatiulateralinainte", }, + ["sidespaceinbetween"]={ + ["en"]="sidespaceinbetween", + ["nl"]="zijtussenwit", + }, ["spaceafterside"]={ ["en"]="spaceafterside", ["nl"]="witnazij", diff --git a/tex/context/base/mkiv/node-ini.lua b/tex/context/base/mkiv/node-ini.lua index 541301dcb..50da140ce 100644 --- a/tex/context/base/mkiv/node-ini.lua +++ b/tex/context/base/mkiv/node-ini.lua @@ -68,6 +68,7 @@ local allocate = utilities.storage.allocate local formatcolumns = utilities.formatters.formatcolumns local getsubtypes = node.subtypes +local getvalues = node.values -- local listcodes = allocate { -- [0] = "unknown", @@ -128,7 +129,7 @@ local glyphcodes = mark(getsubtypes("glyph")) local disccodes = mark(getsubtypes("disc")) --- local skipcodes = allocate { +-- local gluecodes = allocate { -- [ 0] = "userskip", -- [ 1] = "lineskip", -- [ 2] = "baselineskip", @@ -157,7 +158,7 @@ local disccodes = mark(getsubtypes("disc")) -- [103] = "gleaders", -- } -local skipcodes = mark(getsubtypes("glue")) +local gluecodes = mark(getsubtypes("glue")) -- local leadercodes = allocate { -- [100] = "leaders", @@ -283,12 +284,12 @@ local nodecodes = simplified(node.types()) local whatcodes = simplified(node.whatsits()) local usercodes = allocate { - [ 97] = "attributes", -- a + [ 97] = "attribute", -- a [100] = "number", -- d [108] = "lua", -- l - [110] = "nodes", -- n + [110] = "node", -- n [115] = "string", -- s - [116] = "tokens" -- t + [116] = "token" -- t } local noadoptions = allocate { @@ -303,55 +304,93 @@ local noadoptions = allocate { right = 0x14 + 0x08, } -skipcodes = allocate(swapped(skipcodes,skipcodes)) -dircodes = allocate(swapped(dircodes,dircodes)) -boundarycodes = allocate(swapped(boundarycodes,boundarycodes)) -noadcodes = allocate(swapped(noadcodes,noadcodes)) -radicalcodes = allocate(swapped(radicalcodes,radicalcodes)) -nodecodes = allocate(swapped(nodecodes,nodecodes)) -whatcodes = allocate(swapped(whatcodes,whatcodes)) -listcodes = allocate(swapped(listcodes,listcodes)) -glyphcodes = allocate(swapped(glyphcodes,glyphcodes)) -kerncodes = allocate(swapped(kerncodes,kerncodes)) -penaltycodes = allocate(swapped(penaltycodes,penaltycodes)) -mathcodes = allocate(swapped(mathcodes,mathcodes)) -fillcodes = allocate(swapped(fillcodes,fillcodes)) -margincodes = allocate(swapped(margincodes,margincodes)) -disccodes = allocate(swapped(disccodes,disccodes)) -accentcodes = allocate(swapped(accentcodes,accentcodes)) -fencecodes = allocate(swapped(fencecodes,fencecodes)) -rulecodes = allocate(swapped(rulecodes,rulecodes)) -leadercodes = allocate(swapped(leadercodes,leadercodes)) -usercodes = allocate(swapped(usercodes,usercodes)) -noadoptions = allocate(swapped(noadoptions,noadoptions)) - -nodes.skipcodes = skipcodes -nodes.dircodes = dircodes -nodes.boundarycodes = boundarycodes -nodes.noadcodes = noadcodes -nodes.nodecodes = nodecodes -nodes.whatcodes = whatcodes -nodes.listcodes = listcodes -nodes.glyphcodes = glyphcodes -nodes.kerncodes = kerncodes -nodes.penaltycodes = penaltycodes -nodes.mathcodes = mathcodes -nodes.fillcodes = fillcodes -nodes.margincodes = margincodes -nodes.disccodes = disccodes -nodes.accentcodes = accentcodes -nodes.radicalcodes = radicalcodes -nodes.fencecodes = fencecodes -nodes.rulecodes = rulecodes -nodes.leadercodes = leadercodes -nodes.usercodes = usercodes -nodes.noadoptions = noadoptions - -nodes.gluecodes = skipcodes -- more official -nodes.directioncodes = dircodes -- more friendly -nodes.whatsitcodes = whatcodes -- more official +-- local directionvalues = mark(getvalues("dir")) +-- local gluevalues = mark(getvalues("glue")) +-- local pdfliteralvalues = mark(getvalues("pdf_literal")) + +local dirvalues = allocate { + [0] = "TLT", + [1] = "TRT", + [2] = "LTL", + [3] = "RTT", +} + +local gluevalues = allocate { + [0] = "normal", + [1] = "fi", + [2] = "fil", + [3] = "fill", + [4] = "filll", +} + +local pdfliteralvalues = allocate { + [0] = "origin", + [1] = "page", + [2] = "always", + [3] = "raw", + [4] = "text", + [5] = "font", + [6] = "special", +} + +gluecodes = allocate(swapped(gluecodes,gluecodes)) +dircodes = allocate(swapped(dircodes,dircodes)) +boundarycodes = allocate(swapped(boundarycodes,boundarycodes)) +noadcodes = allocate(swapped(noadcodes,noadcodes)) +radicalcodes = allocate(swapped(radicalcodes,radicalcodes)) +nodecodes = allocate(swapped(nodecodes,nodecodes)) +whatcodes = allocate(swapped(whatcodes,whatcodes)) +listcodes = allocate(swapped(listcodes,listcodes)) +glyphcodes = allocate(swapped(glyphcodes,glyphcodes)) +kerncodes = allocate(swapped(kerncodes,kerncodes)) +penaltycodes = allocate(swapped(penaltycodes,penaltycodes)) +mathcodes = allocate(swapped(mathcodes,mathcodes)) +fillcodes = allocate(swapped(fillcodes,fillcodes)) +margincodes = allocate(swapped(margincodes,margincodes)) +disccodes = allocate(swapped(disccodes,disccodes)) +accentcodes = allocate(swapped(accentcodes,accentcodes)) +fencecodes = allocate(swapped(fencecodes,fencecodes)) +rulecodes = allocate(swapped(rulecodes,rulecodes)) +leadercodes = allocate(swapped(leadercodes,leadercodes)) +usercodes = allocate(swapped(usercodes,usercodes)) +noadoptions = allocate(swapped(noadoptions,noadoptions)) +dirvalues = allocate(swapped(dirvalues,dirvalues)) +gluevalues = allocate(swapped(gluevalues,gluevalues)) +pdfliteralvalues = allocate(swapped(pdfliteralvalues,pdfliteralvalues)) + +nodes.gluecodes = gluecodes +nodes.dircodes = dircodes +nodes.boundarycodes = boundarycodes +nodes.noadcodes = noadcodes +nodes.nodecodes = nodecodes +nodes.whatcodes = whatcodes +nodes.listcodes = listcodes +nodes.glyphcodes = glyphcodes +nodes.kerncodes = kerncodes +nodes.penaltycodes = penaltycodes +nodes.mathcodes = mathcodes +nodes.fillcodes = fillcodes +nodes.margincodes = margincodes +nodes.disccodes = disccodes +nodes.accentcodes = accentcodes +nodes.radicalcodes = radicalcodes +nodes.fencecodes = fencecodes +nodes.rulecodes = rulecodes +nodes.leadercodes = leadercodes +nodes.usercodes = usercodes +nodes.noadoptions = noadoptions +nodes.dirvalues = dirvalues +nodes.gluevalues = gluevalues +nodes.pdfliteralvalues = pdfliteralvalues + +nodes.skipcodes = gluecodes -- more friendly +nodes.directioncodes = dircodes -- more friendly +nodes.whatsitcodes = whatcodes -- more official nodes.marginkerncodes = margincodes nodes.discretionarycodes = disccodes +nodes.directionvalues = dirvalues -- more friendly +nodes.skipvalues = gluevalues -- more friendly +nodes.literalvalues = pdfliteralvalues -- more friendly listcodes.row = listcodes.alignment listcodes.column = listcodes.alignment @@ -360,6 +399,8 @@ kerncodes.kerning = kerncodes.fontkern kerncodes.italiccorrection = kerncodes.italiccorrection or 1 -- new +pdfliteralvalues.direct = pdfliteralvalues.always + nodes.codes = allocate { -- mostly for listing glue = skipcodes, boundary = boundarycodes, diff --git a/tex/context/base/mkiv/node-res.lua b/tex/context/base/mkiv/node-res.lua index 4dee2dd7f..a6211e80e 100644 --- a/tex/context/base/mkiv/node-res.lua +++ b/tex/context/base/mkiv/node-res.lua @@ -164,11 +164,11 @@ local special = register_nut(new_nut("whatsit",whatsitcodes.special)) local user_node = new_nut("whatsit",whatsitcodes.userdefined) local user_number = register_nut(copy_nut(user_node)) setfield(user_number, "type",usercodes.number) -local user_nodes = register_nut(copy_nut(user_node)) setfield(user_nodes, "type",usercodes.nodes) +local user_nodes = register_nut(copy_nut(user_node)) setfield(user_nodes, "type",usercodes.node) local user_string = register_nut(copy_nut(user_node)) setfield(user_string, "type",usercodes.string) -local user_tokens = register_nut(copy_nut(user_node)) setfield(user_tokens, "type",usercodes.tokens) +local user_tokens = register_nut(copy_nut(user_node)) setfield(user_tokens, "type",usercodes.token) ----- user_lua = register_nut(copy_nut(user_node)) setfield(user_lua, "type",usercodes.lua) -- in > 0.95 -local user_attributes = register_nut(copy_nut(user_node)) setfield(user_attributes,"type",usercodes.attributes) +local user_attributes = register_nut(copy_nut(user_node)) setfield(user_attributes,"type",usercodes.attribute) local left_margin_kern = register_nut(new_nut("margin_kern",0)) local right_margin_kern = register_nut(new_nut("margin_kern",1)) diff --git a/tex/context/base/mkiv/pack-rul.mkiv b/tex/context/base/mkiv/pack-rul.mkiv index 068cb2dc9..9ad33642b 100644 --- a/tex/context/base/mkiv/pack-rul.mkiv +++ b/tex/context/base/mkiv/pack-rul.mkiv @@ -1127,6 +1127,12 @@ \let\delayedendstrut\relax \let\delayedstrut \relax +\let\localoffset\empty +\let\localwidth \empty +\let\localheight\empty +\let\localformat\empty +\let\localstrut \empty + \unexpanded\def\pack_framed_process_indeed {\d_framed_frameoffset\framedparameter\c!frameoffset \edef\p_framed_backgroundoffset{\framedparameter\c!backgroundoffset}% diff --git a/tex/context/base/mkiv/page-ini.mkiv b/tex/context/base/mkiv/page-ini.mkiv index 8c8e9c089..5402bd71d 100644 --- a/tex/context/base/mkiv/page-ini.mkiv +++ b/tex/context/base/mkiv/page-ini.mkiv @@ -319,5 +319,17 @@ \unexpanded\def\doifelsemarkedpage#1% {\clf_doifelsemarkedpage{#1}} +%D Experimental: + +\newconstant\c_page_force_strut_depth_trace_mode + +\installtextracker + {otr.forcestrutdepth} + {\c_page_force_strut_depth_trace_mode\plusone} + {\c_page_force_strut_depth_trace_mode\zerocount} + +\installoutputroutine\forcestrutdepth + {\clf_forcestrutdepth\normalpagebox\strutdp\c_page_force_strut_depth_trace_mode + \unvbox\normalpagebox} \protect \endinput diff --git a/tex/context/base/mkiv/page-lay.mkiv b/tex/context/base/mkiv/page-lay.mkiv index 294718f9c..7b80dadb9 100644 --- a/tex/context/base/mkiv/page-lay.mkiv +++ b/tex/context/base/mkiv/page-lay.mkiv @@ -125,7 +125,7 @@ \installswitchcommandhandler \??layout {layout} \??layout \appendtoks - \doifnothing{\strictlayoutparameter\c!state}{\letlayoutparameter\c!state\v!start}% + \doifnothing{\directlayoutparameter\c!state}{\letlayoutparameter\c!state\v!start}% \to \everydefinelayout \appendtoks @@ -959,7 +959,7 @@ {\setgvalue{\??layoutalternative#1}{#2}} \def\page_boxes_construct_content_default#1#2#3% targetbox flusher box - {\setbox#1\vbox + {\setbox#1\vpack % was \vbox {\offinterlineskip \begingroup % needed ? \uselayoutstyleandcolor\c!style\c!color diff --git a/tex/context/base/mkiv/page-otr.mkvi b/tex/context/base/mkiv/page-otr.mkvi index 45dc86482..ebaf17ebc 100644 --- a/tex/context/base/mkiv/page-otr.mkvi +++ b/tex/context/base/mkiv/page-otr.mkvi @@ -52,7 +52,7 @@ \to \everyswitchoutputroutine \unexpanded\def\page_otr_specifics_preset#name% - {\edef\page_otr_specifics_command{\strictoutputroutineparameter{#name}}% no inheritance of commands + {\edef\page_otr_specifics_command{\directoutputroutineparameter{#name}}% no inheritance of commands \ifx\page_otr_specifics_command\empty \writestatus{\currentoutputroutine}{- \expandafter\strippedcsname\csname#name\endcsname}% \expandafter\let\csname#name\endcsname\relax @@ -62,7 +62,7 @@ \fi} \unexpanded\def\page_otr_specifics_preset_normal#name% - {\edef\page_otr_specifics_command{\strictoutputroutineparameter{#name}}% no inheritance of commands + {\edef\page_otr_specifics_command{\directoutputroutineparameter{#name}}% no inheritance of commands \ifx\page_otr_specifics_command\empty \expandafter\let\csname#name\endcsname\relax \else @@ -70,7 +70,7 @@ \fi} \unexpanded\def\page_otr_specifics_preset_traced#name% - {\edef\page_otr_specifics_command{\strictoutputroutineparameter{#name}}% no inheritance of commands + {\edef\page_otr_specifics_command{\directoutputroutineparameter{#name}}% no inheritance of commands \ifx\page_otr_specifics_command\empty \writestatus{\currentoutputroutine}{preset: - \expandafter\strippedcsname\csname#name\endcsname}% \expandafter\let\csname#name\endcsname\relax diff --git a/tex/context/base/mkiv/page-sid.mkiv b/tex/context/base/mkiv/page-sid.mkiv index 8fee9d4ed..31c962719 100644 --- a/tex/context/base/mkiv/page-sid.mkiv +++ b/tex/context/base/mkiv/page-sid.mkiv @@ -24,19 +24,16 @@ % 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. -% Maybe I should just rewrite the lot, if only because we're now too far from -% the original. For instance we do this 'after' spacing differently. +%D A complication is that we need to deal with spacing differently before and after +%D the float. Also, whitespace can interfere as does the prevdepth. There is no +%D real universal solotion. \newdimen \d_page_sides_height % includes the topskip \newdimen \d_page_sides_width \newdimen \d_page_sides_hsize \newdimen \d_page_sides_vsize -\newdimen \d_page_sides_vsize_reset \d_page_sides_vsize_reset -\onepoint % could be a \let +\newdimen \d_page_sides_vsize_reset \newdimen \d_page_sides_progress \newdimen \d_page_sides_page_total \newdimen \d_page_sides_saved_depth @@ -49,8 +46,9 @@ \newcount \c_page_sides_n_of_hang \newconstant \c_page_sides_float_type -\newconditional \c_page_sides_short % needs checking .. best write this from scratch +\newconditional \c_page_sides_short \newconditional \c_page_sides_flag +\newconditional \c_page_sides_dummy_lines \newdimen \d_page_sides_shift \newdimen \d_page_sides_extrashift @@ -61,13 +59,23 @@ \newdimen \d_page_sides_maximum \newdimen \d_page_sides_topskip \newdimen \d_page_sides_bottomskip +\newdimen \d_page_sides_midskip \newdimen \d_page_sides_downshift \newdimen \d_page_sides_pagetotal \newdimen \d_page_sides_topoffset \newdimen \d_page_sides_bottomoffset +\newdimen \d_page_sides_toptotal +\newdimen \d_page_sides_bottomtotal + +\setnewconstant \c_page_sides_method \plusone +\setnewconstant \c_page_sides_align \zerocount +\setnewconstant \c_page_sides_skipmode \zerocount +\setnewconstant \c_page_sides_tolerance\zerocount -\setnewconstant \c_page_sides_method \plusone % 0=raw 1=safe (.99) 2=tight (-1pt) -\setnewconstant \c_page_sides_align \zerocount +\d_page_sides_vsize_reset -\onepoint +%d_page_sides_vsize_reset \zeropoint % could be an option, needs testing + +\settrue\c_page_sides_dummy_lines % when false gets reset to true afterwards \def\page_sides_process_float_backspace {\global\c_page_sides_float_type\plusone \page_sides_handle_float} \def\page_sides_process_float_leftedge {\global\c_page_sides_float_type\plustwo \page_sides_handle_float} @@ -79,19 +87,41 @@ \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} +\def\page_sides_check_skips + {\global\d_page_sides_toptotal \dimexpr\d_page_sides_topskip +\d_page_sides_topoffset \relax + \global\d_page_sides_bottomtotal\dimexpr\d_page_sides_bottomskip+\d_page_sides_bottomoffset\relax + \ifcase\c_page_sides_skipmode + \or % high + \global\d_page_sides_toptotal \d_page_sides_topoffset + \or % low + \global\d_page_sides_bottomtotal\d_page_sides_bottomoffset + \or % fit + \global\d_page_sides_toptotal \d_page_sides_topoffset + \global\d_page_sides_bottomtotal\d_page_sides_bottomoffset + \global\d_strc_floats_margin \zeropoint + \fi} + \newif\iftracesidefloats % public (might change) +\unexpanded\def\page_sides_force_depth + {\iftracesidefloats + \begingroup + \c_page_force_strut_depth_trace_mode\plusone + \forcestrutdepth + \endgroup + \else + \forcestrutdepth + \fi} + \def\page_sides_floats_legend {\writestatus\m!floatblocks{anchor: orange, shift: red, box: green, dummy: blue, depth: magenta}% - \glet\page_sides_floats_legenda\relax} + \glet\page_sides_floats_legend\relax} \installtextracker{floats.anchoring} {\page_sides_floats_legend \tracesidefloatstrue} {\tracesidefloatsfalse} -% end of public variables - \def\page_sides_apply_horizontal_shift {\ifdim\d_page_sides_maximum>\zeropoint \ifcase\c_page_sides_float_type @@ -196,7 +226,7 @@ \def\page_sides_flush_floats {\par - \ifdim\dimexpr\d_page_sides_vsize-\d_page_sides_bottomskip-\pagetotal\relax>\zeropoint % -\pagedepth + \ifdim\dimexpr\d_page_sides_vsize-\d_page_sides_bottomtotal-\pagetotal\relax>\zeropoint % -\pagedepth \page_sides_flush_floats_progress \page_sides_flush_floats_after_next \fi @@ -205,10 +235,11 @@ \def\page_sides_flush_floats_text {\par \ifdim\dimexpr - \d_page_sides_vsize - \ifnum\c_anch_backgrounds_text_level>\plusone - -\d_page_sides_bottomskip - \fi + \d_page_sides_vsize +% no longer with the adapted skipper +% \ifnum\c_anch_backgrounds_text_level>\plusone + -\d_page_sides_bottomtotal +% \fi -\pagetotal \relax>\zeropoint % -\pagedepth \page_sides_flush_floats_progress @@ -262,11 +293,9 @@ \m_pages_strut \fi} -% the \d_page_sides_bottomskip == \rootfloatparameter\c!sidespaceafter is embedded -% in the progression of the float - \def\page_sides_flush_floats_progress {\begingroup + \page_sides_force_depth \let\page_sides_flush_floats\relax \edef\m_pages_strut {\ifcsname\??sidefloatsteps\rootfloatparameter\c!step\endcsname @@ -279,12 +308,9 @@ \doloop {\scratchdimen\dimexpr \d_page_sides_vsize -% no longer with the adapted skipper -% \ifnum\c_anch_backgrounds_text_level>\plusone - -\d_page_sides_bottomskip -% \fi + -\d_page_sides_bottomtotal -\pagetotal - -\pagedepth + % -\pagedepth \relax \ifdim\scratchdimen>\onepoint % good enough, if we change it it will become a threshold \ifnum\recurselevel>\plushundred % safeguard, sort of deadcycles @@ -295,55 +321,20 @@ \page_sides_flush_floats_normal\par \fi\fi \else + \page_sides_force_depth \exitloop \fi}% + \global\setfalse\c_page_sides_dummy_lines \endgroup} -\def\page_sides_flush_floats_after_none % we force a flush - {\edef\tempstring{% - \ifdim\d_page_sides_bottomskip>\zeropoint - \ifdim\parskip>\zeropoint % why this test ? - \ifdim\d_page_sides_bottomskip>\parskip - \v!nowhite,\rootfloatparameter\c!sidespaceafter - \fi - \else - \rootfloatparameter\c!sidespaceafter - \fi - \fi}% - \ifx\tempstring\empty\else\ifx\tempstring\v!none\else - \blank[\tempstring]% - \fi\fi - \page_sides_inject_after} -\def\page_sides_flush_floats_blank#1% we have two successive ones - {\edef\tempstring{% - \ifx#1\empty\else#1,\fi - \ifdim\d_page_sides_bottomskip>\d_page_sides_topskip - \ifdim\d_page_sides_topskip >\zeropoint-\rootfloatparameter\c!sidespacebefore,\fi % the next one - \ifdim\d_page_sides_bottomskip>\zeropoint \rootfloatparameter\c!sidespaceafter ,\fi - \else\ifdim\d_page_sides_bottomskip<\d_page_sides_topskip - \ifdim\d_page_sides_bottomskip>\zeropoint -\rootfloatparameter\c!sidespaceafter ,\fi - \ifdim\d_page_sides_topskip >\zeropoint \rootfloatparameter\c!sidespacebefore,\fi - \else % equal - \rootfloatparameter\c!sidespacebefore % inbetween - \fi\fi}% - \ifx\tempstring\empty\else\ifx\tempstring\v!none\else - \blank[\tempstring]% - \fi\fi +\def\page_sides_flush_floats_after_none % we force a flush + {\checkedblank[\rootfloatparameter\c!sidespaceafter]% \page_sides_inject_after} \def\page_sides_flush_floats_after_next % we have two successive ones - {\ifdim\parskip>\zeropoint % why this test ? - \ifdim\d_page_sides_bottomskip>\parskip - \page_sides_flush_floats_blank\v!nowhite - \else\ifdim\d_page_sides_topskip>\parskip - \page_sides_flush_floats_blank\v!nowhite - \else - % use parskip - \fi\fi - \else - \page_sides_flush_floats_blank\empty - \fi} + {\checkedblank[\rootfloatparameter\c!sidespaceinbetween]% maybe also none + \page_sides_inject_after} \def\page_sides_check_floats_after_par {\page_sides_check_floats_indeed @@ -374,6 +365,7 @@ \def\page_sides_output_routine {\ifconditional\c_page_sides_short + % Is this branch ever entered? \page_sides_output_routine_yes \else \page_sides_output_routine_nop @@ -388,12 +380,13 @@ \def\page_sides_output_routine_yes % we need to rework this ... add pagediscards and such {\unvbox\normalpagebox % bah, and the discards? -% \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 + \ifvoid\b_page_sides_bottom + % go on + \else\ifdim\wd\b_page_sides_bottom>\d_page_sides_hsize + % hm, i really need to write this from scratch + \penalty-201 \box\b_page_sides_bottom - \else\ifvoid\b_page_sides_bottom \else \page_sides_restore_left_indent \ifdim\wd\b_page_sides_bottom<\d_page_sides_hsize @@ -454,9 +447,18 @@ \def\page_sides_apply_vertical_shift_normal {\global\setbox\floatbox\hpack % why extra box {\vpack - {\vskip\privatescratchdimen - \nointerlineskip + {\forgetall + \hsize\wd\floatbox + \vskip\privatescratchdimen + \offinterlineskip \box\floatbox + % somehow we need this \scratchbox magic, but at least it's the same as the + % tracer now + \setbox\scratchbox\emptybox + \wd\scratchbox\hsize + \ht\scratchbox\d_page_sides_bottomtotal + \box\scratchbox + \vskip-\d_page_sides_bottomtotal \ifnum\c_page_sides_align=\plusfive \vskip-\lineheight \fi}}} \def\page_sides_apply_vertical_shift_traced @@ -467,46 +469,30 @@ \vskip\privatescratchdimen \offinterlineskip \backgroundline[trace:g]{\ruledhpack{\box\floatbox}}\par - \blackrule[\c!color=trace:s,\c!height=\d_page_sides_bottomskip,\c!depth=\zeropoint,\c!width=\hsize]% - \vskip-\d_page_sides_bottomskip + \blackrule[\c!color=trace:s,\c!height=\d_page_sides_bottomtotal,\c!depth=\zeropoint,\c!width=\hsize]% + \vskip-\d_page_sides_bottomtotal \ifnum\c_page_sides_align=\plusfive \vskip-\lineheight \fi}}}}} -\def\page_sides_apply_depth_normal - {\global\setbox\floatbox\hpack - {\lower\strutdp\box\floatbox}} - -\def\page_sides_apply_depth_traced - {\global\setbox\floatbox\hpack - {\scratchdimen\wd\floatbox - \lower\strutdp\box\floatbox - \hskip-\scratchdimen - \color[trace:m] - {\vrule\s!height\zeropoint\s!depth\strutdp\s!width\scratchdimen}}} - \def\page_sides_apply_vertical_shift {\ifnum\c_page_sides_align=\plusfour \getnoflines{\ht\floatbox}% \privatescratchdimen\dimexpr\noflines\lineheight-\strutdp\relax - \getrawnoflines\d_page_sides_topskip + \getrawnoflines\d_page_sides_toptotal \advance\privatescratchdimen\noflines\lineheight % todo: maybe rounding problem here % \global\setbox\floatbox\hbox{\lower\lineheight\box\floatbox}% - \iftracesidefloats - \page_sides_apply_depth_traced - \else - \page_sides_apply_depth_normal - \fi + \page_sides_force_depth \ht\floatbox\privatescratchdimen \dp\floatbox\zeropoint \fi \ifcase\c_page_sides_align \else - \global\d_page_sides_topskip\zeropoint + \global\d_page_sides_toptotal\zeropoint \fi \privatescratchdimen \ifnum\c_page_sides_float_type<\plusfour - \d_page_sides_topskip + \d_page_sides_toptotal \else\ifnum\c_page_sides_float_type>\plusfive - \d_page_sides_topskip + \d_page_sides_toptotal \else \zeropoint \fi\fi @@ -536,17 +522,17 @@ \page_sides_apply_vertical_shift_normal % uses \privatescratchdimen \fi \ifnum\c_page_sides_float_type<\plusfour - \global\d_page_sides_topskip\zeropoint + \global\d_page_sides_toptotal\zeropoint \else\ifnum\c_page_sides_float_type>\plusfive - \global\d_page_sides_topskip\zeropoint + \global\d_page_sides_toptotal\zeropoint \fi\fi \global\d_page_sides_downshift\zeropoint} \def\page_sides_place_float - {\ifnum\c_page_sides_float_type=\plusfour \kern\d_page_sides_topskip \fi - \ifnum\c_page_sides_float_type=\plusfive \kern\d_page_sides_topskip \fi - \d_page_sides_saved_depth\prevdepth - \nointerlineskip + {\ifnum\c_page_sides_float_type=\plusfour \kern\d_page_sides_toptotal \fi + \ifnum\c_page_sides_float_type=\plusfive \kern\d_page_sides_toptotal \fi +% \d_page_sides_saved_depth\prevdepth +% \nointerlineskip \ifgridsnapping \page_sides_place_float_grid \else @@ -554,9 +540,10 @@ \fi \par \kern-\d_page_sides_height +\vskip-\parskip \penalty10001 % oeps, this will change \normalbaselines - \prevdepth\d_page_sides_saved_depth} +}% \prevdepth\d_page_sides_saved_depth} \def\page_sides_place_float_normal {\page_sides_push_float_inline\firstofoneargument} @@ -582,10 +569,11 @@ {\begingroup \reseteverypar % needed ! \parskip\zeropoint % needed ! + \nointerlineskip \page_sides_set_skips \page_floats_report_total \relax - \lefttoright % \textdir TLT\relax % or \ifconditional\displaylefttoright below (more work) + \lefttoright \strc_floats_mark_par_as_free \ifcase\c_page_sides_float_type % invalid @@ -615,11 +603,11 @@ \global\setfalse\c_page_sides_flag \else \advance\d_page_sides_progress-\pagetotal - \advance\d_page_sides_progress-\pagedepth % new 2017-10-10 \fi} \def\page_sides_analyse_space {\global\settrue\c_page_sides_flag + \page_sides_force_depth \global\d_page_sides_page_total \pagetotal % global \ifnum\c_page_sides_float_type<\plusfour \global\d_page_sides_width \zeropoint @@ -632,70 +620,53 @@ \global\d_page_sides_width\zeropoint \fi \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_height\dimexpr\ht\floatbox+\dp\floatbox+\d_page_sides_toptotal\relax \global\d_page_sides_vsize \dimexpr\d_page_sides_height+\d_page_sides_page_total\relax \scratchdimenone\d_page_sides_vsize \scratchdimentwo\pagegoal - \relax - \ifcase\c_page_sides_method - % method 0 : raw - \or - % method 1 : safe (default) - % too fuzzy as it can change and for a high page it's a lot : \scratchdimentwo .99\pagegoal + \ifcase\c_page_sides_tolerance \advance\scratchdimentwo -\strutdp \or - % method 2 : tight - \advance\scratchdimenone -\onepoint + % tolerant + \advance\scratchdimentwo -.5\strutdp + \or + % verytolerant + \else + \advance\scratchdimentwo -\strutdp \fi - \relax % really needed ! ! ! ! + % here also pagedepth \ifdim\scratchdimenone>\scratchdimentwo \global\setfalse\c_page_floats_room \else - \ifdim\dimexpr\pagegoal-\d_page_sides_vsize\relax<\d_page_sides_bottomskip + \ifdim\dimexpr\pagegoal-\d_page_sides_vsize\relax<\d_page_sides_bottomtotal % 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 \else - \global\advance\d_page_sides_vsize \d_page_sides_bottomskip - \global\advance\d_page_sides_vsize -\parskip % new 2017-10-10 + \global\advance\d_page_sides_vsize \d_page_sides_bottomtotal % wins over inbetween \global\setfalse\c_page_sides_short \fi \global\settrue\c_page_floats_room \fi} -% \unexpanded\def\fakenextstrutline -% {\par -% \begingroup -% % overkill, done in \page_sides_inject_dummy_lines -% \triggerpagebuilder -% \reseteverypar -% \forgetall -% \dontleavehmode\hpack to \hsize{\strut\hss}\par -% \clf_removelastline -% % \pagetotal is still one line too much but pagedepth is ok -% % but it seems to work -% \endgroup} - \def\page_sides_inject_before - {\edef\tempstring{\rootfloatparameter\c!spacebeforeside}% - \ifx\tempstring\empty\else\ifx\tempstring\v!none\else - \blank[\tempstring]% - \fi\fi} + {\checkedblank[\rootfloatparameter\c!spacebeforeside]} + +% \def\page_sides_inject_after +% {\checkedblank[\rootfloatparameter\c!spaceafterside]} +% +% As we have no clear end of one or more paragraphs this makes no sense so: -\def\page_sides_inject_after - {\edef\tempstring{\rootfloatparameter\c!spaceafterside}% - \ifx\tempstring\empty\else\ifx\tempstring\v!none\else - \blank[\tempstring]% - \fi\fi} +\let\page_sides_inject_after\donothing -\def\page_sides_prepare_space - {%\fakenextstrutline % does more bad than good at page crossing - \inhibitblank} % hm, why here .. gets obscured anyway +% \def\page_sides_prepare_space +% {\inhibitblank} % hm, why here .. gets obscured anyway \def\page_sides_handle_float#1% grid (4) is rather experimental - {\page_sides_inject_before - \page_sides_prepare_space + {\page_sides_check_skips + \page_sides_inject_before +% \page_sides_prepare_space \page_sides_apply_horizontal_shift \page_sides_check_previous_float \page_sides_inject_dummy_lines @@ -844,66 +815,43 @@ \fi \fi} -% \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}} + {\hpack to \availablehsize{\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} + {\ruledhpack to \availablehsize{\backgroundline[trace:b]{\page_sides_inject_dummy_line_normal}}} \def\page_sides_inject_dummy_lines % so always one - {\par - \begingroup - \privatescratchcounter\pageshrink - \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 - \vskip-\lineheight - \vskip-\parskip - \endgroup} + {\ifconditional\c_page_sides_dummy_lines + \par + \page_sides_force_depth + %\checkedblank[\rootfloatparameter\c!sidespacebefore]% + \begingroup + \privatescratchcounter\pageshrink + \divide\privatescratchcounter \lineheight % \baselineskip + \advance\privatescratchcounter\plusone + \offinterlineskip + \ifcase\privatescratchcounter\else + \dorecurse\privatescratchcounter + {\dontleavehmode + \iftracesidefloats + \page_sides_inject_dummy_line_traced + \else + \page_sides_inject_dummy_line_normal + \fi + \par}% + \vskip-\lineheight + \vskip-\strutdp +% \blank[-\v!line]% + \fi + \endgroup + \else\ifdim\d_page_sides_midskip>\zeropoint\else +% \vskip\parskip + \ifdim\parskip>\zeropoint + \blank[\v!white]% + \fi + \fi\fi + \global\settrue\c_page_sides_dummy_lines} \def\adjustsidefloatdisplaylines % public, will change {\aftergroup\page_sides_adjust_display_lines} diff --git a/tex/context/base/mkiv/page-txt.mkvi b/tex/context/base/mkiv/page-txt.mkvi index e284d55b7..b043b60c7 100644 --- a/tex/context/base/mkiv/page-txt.mkvi +++ b/tex/context/base/mkiv/page-txt.mkvi @@ -822,7 +822,7 @@ \def\page_layouts_insert_elements {\ifcase\pageornamentstate - \page_layouts_place_elements_indeed + \page_layouts_place_elements_indeed % we could have a special flag for always ignored \fi} \def\page_layouts_place_elements_indeed diff --git a/tex/context/base/mkiv/publ-aut.lua b/tex/context/base/mkiv/publ-aut.lua index 76308825e..91d38a8d9 100644 --- a/tex/context/base/mkiv/publ-aut.lua +++ b/tex/context/base/mkiv/publ-aut.lua @@ -390,7 +390,7 @@ local function btxauthorfield(i,field) context(applymanipulation(manipulator,value) or value) end elseif field == "initials" then - context(concat(the_initials(value,currentauthorsymbol))) + context(concat(the_initials(value,currentauthorsymbol,currentauthorconnector))) else context(concat(value," ")) end diff --git a/tex/context/base/mkiv/scrn-but.mkvi b/tex/context/base/mkiv/scrn-but.mkvi index 7e4c705c0..8bbd6eeda 100644 --- a/tex/context/base/mkiv/scrn-but.mkvi +++ b/tex/context/base/mkiv/scrn-but.mkvi @@ -554,7 +554,7 @@ \setbox\b_scrn_menu\hbox to \d_scrn_menu_used_width {\ifx\currentinteractionmenustate\v!empty \else \interactionmenuparameter\c!left - \scrn_menu_package_vertical{\strictinteractionmenuparameter\c!menu}% + \scrn_menu_package_vertical{\directinteractionmenuparameter\c!menu}% \interactionmenuparameter\c!right \fi}% \edef\currentinteractionmenudistance{\interactionmenuparameter\c!distance}% @@ -575,7 +575,7 @@ {\ifx\currentinteractionmenustate\v!none \else \scrn_menu_top_align \interactionmenuparameter\c!before - \scrn_menu_package_horizontal{\strictinteractionmenuparameter\c!menu}% + \scrn_menu_package_horizontal{\directinteractionmenuparameter\c!menu}% \interactionmenuparameter\c!after \scrn_menu_bottom_align \fi}% @@ -788,7 +788,7 @@ \edef\currentinteractionmenu{#tag}% \doif{\interactionmenuparameter\c!state}\v!local {\letinteractionmenuparameter\c!state\v!start - \strictinteractionmenuparameter\c!menu}% + \directinteractionmenuparameter\c!menu}% \endgroup} %D Direct call (todo): diff --git a/tex/context/base/mkiv/spac-ver.lua b/tex/context/base/mkiv/spac-ver.lua index 67363c4ed..1cd78ce70 100644 --- a/tex/context/base/mkiv/spac-ver.lua +++ b/tex/context/base/mkiv/spac-ver.lua @@ -53,6 +53,7 @@ local texgetdimen = tex.getdimen local texset = tex.set local texsetdimen = tex.setdimen local texnest = tex.nest +local texgetbox = tex.getbox local buildpage = tex.triggerbuildpage @@ -2005,20 +2006,50 @@ do directives.register("vspacing.resetprevdepth",function(v) reset = v end) trackers.register ("vspacing.resetprevdepth",function(v) trace = v end) + -- use getid and getnext + function vspacing.resetprevdepth() if reset then local head = texlists.hold_head - local skip = 0 - while head and head.id == insert_code do - head = head.next - skip = skip + 1 - end if head then - outer.prevdepth = 0 + head = tonut(head) + local skip = 0 + while head and getid(head) == insert_code do + head = getnext(head) + skip = skip + 1 + end + if head then + outer.prevdepth = 0 + end + if trace then + report("prevdepth %s at page %i, skipped %i, value %p", + head and "reset" or "kept",texgetcount("realpageno"),skip,outer.prevdepth) + end end - if trace then - report("prevdepth %s at page %i, skipped %i, value %p", - head and "reset" or "kept",texgetcount("realpageno"),skip,outer.prevdepth) + end + end + + local trace = false + + trackers.register("vspacing.forcestrutdepth",function(v) trace = v end) + + function vspacing.forcestrutdepth(n,depth,trace_mode) + local box = texgetbox(n) + if box then + box = tonut(box) + local dp = getdepth(box) + if dp < depth then + local head = getlist(box) + if head then + local tail = find_node_tail(head) + if tail and getid(tail) == hlist_code then + setdepth(tail,depth) + outer.prevdepth = depth + if trace or trace_mode > 0 then + nuts.setvisual(tail,"depth") + end + end + end end end end @@ -2043,6 +2074,13 @@ do } implement { + name = "forcestrutdepth", + arguments = { "integer", "dimension", "integer" }, + actions = vspacing.forcestrutdepth, + scope = "private" + } + + implement { name = "vspacingsetamount", actions = vspacing.setskip, scope = "private", diff --git a/tex/context/base/mkiv/spac-ver.mkiv b/tex/context/base/mkiv/spac-ver.mkiv index 7c84eef45..76ea35223 100644 --- a/tex/context/base/mkiv/spac-ver.mkiv +++ b/tex/context/base/mkiv/spac-ver.mkiv @@ -2521,4 +2521,28 @@ % line 3 % \stoptyping +%D Helper: + +\unexpanded\def\checkedblank[#1]% + {\edef\p_blank{#1}% + \ifx\p_blank\empty + % ignore + \else\ifx\p_blank\v!none + % ignore + \else + \blank[\p_blank]% + \fi\fi} + +% \unexpanded\def\applycheckedblankwith#1#2#3% +% {\edef\p_blank{#2}% +% \ifx\p_blank\empty +% % ignore +% \else\ifx\p_blank\v!none +% % ignore +% \else +% \edef\p_before{#1}% +% \edef\p_after {#3}% +% \blank[\ifx\p_before\empty\else\p_before,\fi\p_blank\ifx\p_after\empty\else,\p_after\fi]% +% \fi\fi} + \protect \endinput diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 0cdfcf3a5..09d1cb941 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 9725489e4..c27899964 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-flt.mkvi b/tex/context/base/mkiv/strc-flt.mkvi index 78fe0b400..99ab2d50a 100644 --- a/tex/context/base/mkiv/strc-flt.mkvi +++ b/tex/context/base/mkiv/strc-flt.mkvi @@ -141,6 +141,7 @@ \c!spaceafter=\v!big, \c!sidespacebefore=\rootfloatparameter\c!spacebefore, \c!sidespaceafter=\rootfloatparameter\c!spaceafter, + \c!sidespaceinbetween=\rootfloatparameter\c!spacebefore, \c!spacebeforeside=, % extra, not part of, can be used to add whitespace before text \c!spaceafterside=, % idem \c!sidealign=\v!normal, @@ -738,8 +739,6 @@ \newdimen\d_strc_floats_margin \newdimen\d_strc_floats_top \newdimen\d_strc_floats_bottom -%newdimen\d_strc_floats_top_side -%newdimen\d_strc_floats_bottom_side \def\strc_floats_calculate_skip#target#skip% {\begingroup @@ -766,6 +765,8 @@ \global\d_page_sides_shift \zeropoint \global\d_page_sides_maximum \zeropoint \global\c_page_sides_align \zerocount + \global\c_page_sides_tolerance \zerocount + \global\c_page_sides_skipmode \zerocount \global\c_strc_floats_rotation \zerocount \global\d_strc_floats_margin \rootfloatparameter\c!margin \global\d_page_sides_leftshift \floatparameter \c!leftmargindistance @@ -779,15 +780,12 @@ \ifconditional\c_strc_floats_par_float \global\d_strc_floats_top \zeropoint \global\d_strc_floats_bottom \zeropoint - %\strc_floats_calculate_skip\d_strc_floats_top_side \c!spacebeforeside - %\strc_floats_calculate_skip\d_strc_floats_bottom_side\c!spaceafterside \strc_floats_calculate_skip\d_page_sides_topskip \c!sidespacebefore \strc_floats_calculate_skip\d_page_sides_bottomskip \c!sidespaceafter + \strc_floats_calculate_skip\d_page_sides_midskip \c!sidespaceinbetween \else \global\d_page_sides_topskip \zeropoint \global\d_page_sides_bottomskip \zeropoint - %\global\d_strc_floats_top_side \zeropoint - %\global\d_strc_floats_bottom_side\zeropoint \strc_floats_calculate_skip\d_strc_floats_top \c!spacebefore \strc_floats_calculate_skip\d_strc_floats_bottom\c!spaceafter \fi @@ -807,11 +805,11 @@ \doifinset\v!grid \floatlocation{\global\c_page_sides_align\plusfour }% \doifinset\v!halfline\floatlocation{\global\c_page_sides_align\plusfive }% meant for 'none' \fi - \doifinset\v!high\floatlocation{\global\d_page_sides_topskip \zeropoint}% - \doifinset\v!low \floatlocation{\global\d_page_sides_bottomskip\zeropoint}% - \doifinset\v!fit \floatlocation{\global\d_page_sides_topskip \zeropoint - \global\d_page_sides_bottomskip\zeropoint - \global\d_strc_floats_margin \zeropoint}% + \doifinset\v!high \floatlocation{\global\c_page_sides_skipmode \plusone }% + \doifinset\v!low \floatlocation{\global\c_page_sides_skipmode \plustwo }% + \doifinset\v!fit \floatlocation{\global\c_page_sides_skipmode \plusthree}% + \doifinset\v!tolerant \floatlocation{\global\c_page_sides_tolerance\plusone }% + \doifinset\v!verytolerant\floatlocation{\global\c_page_sides_tolerance\plustwo }% \else \processallactionsinset [\floatlocation]% @@ -836,12 +834,7 @@ \letfloatcaptionparameter\c!rightmargin\effectiverightskip}% \ifemptyfloatcaption \ifnofloatnumber \global\nofloatcaptiontrue - \fi \fi - % more variable initializations - \ifconditional\c_strc_floats_par_float - \global\advance\d_page_sides_topskip \d_page_sides_topoffset - \global\advance\d_page_sides_bottomskip\d_page_sides_bottomoffset - \fi} + \fi \fi} % documenteren in details @@ -1282,7 +1275,7 @@ \hsize\floattextwidth \ignorespaces} -\def\strc_floats_stop_text_indeed +\def\strc_floats_stop_text_indeed % todo {\egroup \doifnotinset\v!tall\floatlocation {\floattextheight\ifdim\ht\floattext<\floatheight\floatheight\else\ht\floattext\fi}% diff --git a/tex/context/base/mkiv/strc-lst.mkvi b/tex/context/base/mkiv/strc-lst.mkvi index cefaa0e14..153d879b7 100644 --- a/tex/context/base/mkiv/strc-lst.mkvi +++ b/tex/context/base/mkiv/strc-lst.mkvi @@ -741,7 +741,7 @@ % {\hskip.25\emwidth\relax} \setuplistalternative - [\c!command=\strictlistparameter\c!command, + [\c!command=\directlistparameter\c!command, \c!symbol=.] \unexpanded\def\currentlistfiller diff --git a/tex/context/base/mkiv/strc-sec.mkiv b/tex/context/base/mkiv/strc-sec.mkiv index b4b9568fc..78421067e 100644 --- a/tex/context/base/mkiv/strc-sec.mkiv +++ b/tex/context/base/mkiv/strc-sec.mkiv @@ -596,10 +596,10 @@ % mkii compatible. Somewhat weird that it's part of the % top level structure but it will be flattened anyway. \let\currenthead\currentsection % - \setheadparameter\c!textstyle {\strictheadparameter\c!style}% - \setheadparameter\c!textcolor {\strictheadparameter\c!color}% - \setheadparameter\c!numberstyle{\strictheadparameter\c!style}% - \setheadparameter\c!numbercolor{\strictheadparameter\c!color}% + \setheadparameter\c!textstyle {\directheadparameter\c!style}% + \setheadparameter\c!textcolor {\directheadparameter\c!color}% + \setheadparameter\c!numberstyle{\directheadparameter\c!style}% + \setheadparameter\c!numbercolor{\directheadparameter\c!color}% \to \everydefinesection % head -> head diff --git a/tex/context/base/mkiv/strc-syn.mkiv b/tex/context/base/mkiv/strc-syn.mkiv index 8d609e425..1fb079f04 100644 --- a/tex/context/base/mkiv/strc-syn.mkiv +++ b/tex/context/base/mkiv/strc-syn.mkiv @@ -355,7 +355,7 @@ \normalexpanded{\endgroup\simplelistparameter\c!next}} % \setupsimplelistalternative -% [\c!command=\strictsimplelistparameter\c!command] +% [\c!command=\directsimplelistparameter\c!command] \definesimplelistalternative [\v!normal] diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv index efd964ac4..77f947753 100644 --- a/tex/context/base/mkiv/syst-aux.mkiv +++ b/tex/context/base/mkiv/syst-aux.mkiv @@ -1081,13 +1081,22 @@ \fi \relax} % this one preserved the next {} +% \def\syst_helpers_do_process_comma_list#1]#2% +% {\global\advance\commalevel \plusone +% \expandafter\def\csname\??nextcommalevel\the\commalevel\endcsname##1,% +% {#2{##1}\syst_helpers_do_process_comma_item}% +% \expandafter\syst_helpers_do_do_process_comma_item\gobbleoneargument#1,]\relax +% \global\advance\commalevel \minusone } + \def\syst_helpers_do_process_comma_list#1]#2% {\global\advance\commalevel \plusone \expandafter\def\csname\??nextcommalevel\the\commalevel\endcsname##1,% {#2{##1}\syst_helpers_do_process_comma_item}% - \expandafter\syst_helpers_do_do_process_comma_item\gobbleoneargument#1,]\relax + \syst_helpers_do_do_process_comma_item_gobble#1,]\relax \global\advance\commalevel \minusone } +\def\syst_helpers_do_do_process_comma_item_gobble#1{\syst_helpers_do_do_process_comma_item} + %D One way of quitting a commalist halfway is: \unexpanded\def\quitcommalist diff --git a/tex/context/base/mkiv/trac-vis.lua b/tex/context/base/mkiv/trac-vis.lua index e5f657a30..839d78b0c 100644 --- a/tex/context/base/mkiv/trac-vis.lua +++ b/tex/context/base/mkiv/trac-vis.lua @@ -65,6 +65,7 @@ local getkern = nuts.getkern local getpenalty = nuts.getpenalty local getdir = nuts.getdir local getwidth = nuts.getwidth +local getdepth = nuts.getdepth local getshift = nuts.getshift local hpack_nodes = nuts.hpack @@ -164,10 +165,11 @@ local modes = { expansion = 65536, line = 131072, space = 262144, + depth = 524288, } local usedfont, exheight, emwidth -local l_penalty, l_glue, l_kern, l_fontkern, l_hbox, l_vbox, l_vtop, l_strut, l_whatsit, l_glyph, l_user, l_math, l_italic, l_origin, l_discretionary, l_expansion, l_line, l_space +local l_penalty, l_glue, l_kern, l_fontkern, l_hbox, l_vbox, l_vtop, l_strut, l_whatsit, l_glyph, l_user, l_math, l_italic, l_origin, l_discretionary, l_expansion, l_line, l_space, l_depth local enabled = false local layers = { } @@ -222,6 +224,7 @@ local function enable() l_expansion = layers.expansion l_line = layers.line l_space = layers.space + l_depth = layers.depth enableaction("shipouts","nodes.visualizers.handler") report_visualize("enabled") enabled = true @@ -279,7 +282,7 @@ function nuts.setvisual(n,mode) setattr(n,a_visual,setvisual(mode,getattr(n,a_visual),true)) end -function nuts.setvisuals(n,mode) +function nuts.setvisuals(n,mode) -- currently the same setattr(n,a_visual,setvisual(mode,getattr(n,a_visual),true,true)) end @@ -375,6 +378,7 @@ local c_math = "trace:r" local c_origin = "trace:o" local c_discretionary = "trace:d" local c_expansion = "trace:o" +local c_depth = "trace:o" local c_positive_d = "trace:db" local c_negative_d = "trace:dr" @@ -391,6 +395,7 @@ local c_math_d = "trace:dr" local c_origin_d = "trace:do" local c_discretionary_d = "trace:dd" local c_expansion_d = "trace:do" +local c_depth_d = "trace:do" local function sometext(str,layer,color,textcolor,lap) -- we can just paste verbatim together .. no typesteting needed local text = hpack_string(str,usedfont) @@ -661,6 +666,23 @@ local math do end +local ruleddepth do + + ruleddepth = function(current) + local depth = getdepth(current) + if depth ~= 0 then + local width = getwidth(current) + local rule = new_rule(width,0,depth) + local kern = new_kern(-width) + setcolor(rule,c_depth) + settransparency(rule,c_zero) + setattr(rule,a_layer,l_depth) + setlist(current,new_hlist(setlink(rule,kern,getlist(current)))) + end + end + +end + local ruledbox do local b_cache = caches["box"] @@ -1198,6 +1220,7 @@ do local trace_expansion = false local trace_line = false local trace_space = false + local trace_depth = false local current = head local previous = nil local attr = unsetvalue @@ -1231,6 +1254,7 @@ do trace_expansion = false trace_line = false trace_space = false + trace_depth = false else -- dead slow: trace_hbox = band(a, 1) ~= 0 trace_vbox = band(a, 2) ~= 0 @@ -1251,6 +1275,7 @@ do trace_expansion = band(a, 65536) ~= 0 trace_line = band(a,131072) ~= 0 trace_space = band(a,262144) ~= 0 + trace_depth = band(a,524288) ~= 0 end attr = a end @@ -1316,6 +1341,9 @@ do if content then setlist(current,visualize(content,false,nil,current)) end + if trace_depth then + ruleddepth(current) + end if trace_line and getsubtype(current) == line_code then head, current = ruledbox(head,current,false,l_line,"L__",trace_simple,previous,trace_origin,parent) elseif trace_hbox then diff --git a/tex/context/fonts/mkiv/type-imp-xits.mkiv b/tex/context/fonts/mkiv/type-imp-xits.mkiv index 145ddc7a8..d3504bdbb 100644 --- a/tex/context/fonts/mkiv/type-imp-xits.mkiv +++ b/tex/context/fonts/mkiv/type-imp-xits.mkiv @@ -23,12 +23,12 @@ \starttypescript [\s!math] [xits,xitsbidi] [\s!name] \loadfontgoodies[xits-math] - \definefontsynonym[\s!MathRoman ][\s!file:xits-math.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=xits-math] - \definefontsynonym[\s!MathRoman L2R][\s!file:xits-math.otf] [\s!features={\s!math\mathsizesuffix-l2r,mathextra},\s!goodies=xits-math] - \definefontsynonym[\s!MathRoman R2L][\s!file:xits-math.otf] [\s!features={\s!math\mathsizesuffix-r2l,mathextra},\s!goodies=xits-math] - \definefontsynonym[\s!MathRomanBold ][\s!file:xits-mathbold.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=xits-math] - \definefontsynonym[\s!MathRomanBold L2R][\s!file:xits-mathbold.otf][\s!features={\s!math\mathsizesuffix-l2r,mathextra},\s!goodies=xits-math] - \definefontsynonym[\s!MathRomanBold R2L][\s!file:xits-mathbold.otf][\s!features={\s!math\mathsizesuffix-r2l,mathextra},\s!goodies=xits-math] + \definefontsynonym[\s!MathRoman ][\s!file:xitsmath-regular.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=xits-math] + \definefontsynonym[\s!MathRoman L2R][\s!file:xitsmath-regular.otf] [\s!features={\s!math\mathsizesuffix-l2r,mathextra},\s!goodies=xits-math] + \definefontsynonym[\s!MathRoman R2L][\s!file:xitsmath-regular.otf] [\s!features={\s!math\mathsizesuffix-r2l,mathextra},\s!goodies=xits-math] + \definefontsynonym[\s!MathRomanBold ][\s!file:xitsmath-bold.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=xits-math] + \definefontsynonym[\s!MathRomanBold L2R][\s!file:xitsmath-bold.otf] [\s!features={\s!math\mathsizesuffix-l2r,mathextra},\s!goodies=xits-math] + \definefontsynonym[\s!MathRomanBold R2L][\s!file:xitsmath-bold.otf] [\s!features={\s!math\mathsizesuffix-r2l,mathextra},\s!goodies=xits-math] \stoptypescript \starttypescript [\s!serif] [xits] [\s!name] diff --git a/tex/context/fonts/mkiv/xits-math.lfg b/tex/context/fonts/mkiv/xits-math.lfg index 372224940..b37ab1277 100644 --- a/tex/context/fonts/mkiv/xits-math.lfg +++ b/tex/context/fonts/mkiv/xits-math.lfg @@ -23,6 +23,16 @@ return { comment = "Goodies that complement xits (by Khaled Hosny).", author = "Hans Hagen", copyright = "ConTeXt development team", + filenames = { + ["xitsmath-regular.otf"] = { + "xitsmath-regular.otf", + "xits-math.otf", + }, + ["xitsmath-bold.otf"] = { + "xitsmath-bold.otf", + "xits-mathbold.otf", + }, + }, mathematics = { -- italics = { -- ["xits-math"] = italics, diff --git a/tex/context/interface/mkii/keys-it.xml b/tex/context/interface/mkii/keys-it.xml index 50fd95639..73bc84465 100644 --- a/tex/context/interface/mkii/keys-it.xml +++ b/tex/context/interface/mkii/keys-it.xml @@ -1168,6 +1168,7 @@ <cd:constant name='sidemethod' value='sidemethod'/> <cd:constant name='sidespaceafter' value='spaziolateraledopo'/> <cd:constant name='sidespacebefore' value='spaziolateraleprima'/> + <cd:constant name='sidespaceinbetween' value='sidespaceinbetween'/> <cd:constant name='sidethreshold' value='sidethreshold'/> <cd:constant name='sign' value='segno'/> <cd:constant name='simplecommand' value='simplecommand'/> diff --git a/tex/context/interface/mkii/keys-ro.xml b/tex/context/interface/mkii/keys-ro.xml index 97aba8363..89f2650f2 100644 --- a/tex/context/interface/mkii/keys-ro.xml +++ b/tex/context/interface/mkii/keys-ro.xml @@ -1168,6 +1168,7 @@ <cd:constant name='sidemethod' value='sidemethod'/> <cd:constant name='sidespaceafter' value='spatiulateraldupa'/> <cd:constant name='sidespacebefore' value='spatiulateralinainte'/> + <cd:constant name='sidespaceinbetween' value='sidespaceinbetween'/> <cd:constant name='sidethreshold' value='sidethreshold'/> <cd:constant name='sign' value='semn'/> <cd:constant name='simplecommand' value='simplecommand'/> diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml index 7269859a7..08d28f944 100644 --- a/tex/context/interface/mkiv/context-en.xml +++ b/tex/context/interface/mkiv/context-en.xml @@ -10166,6 +10166,8 @@ <cd:constant type="top"/> <cd:constant default="yes" type="bottom"/> <cd:constant type="stretch"/> + <cd:constant type="tolerant"/> + <cd:constant type="verytolerant"/> <cd:constant type="none"/> <cd:constant type="default"/> </cd:parameter> diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 7c655f08a..e20173696 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-floats.xml b/tex/context/interface/mkiv/i-floats.xml index 92f48e0b1..0ecb99c16 100644 --- a/tex/context/interface/mkiv/i-floats.xml +++ b/tex/context/interface/mkiv/i-floats.xml @@ -266,6 +266,8 @@ <cd:constant type="top"/> <cd:constant type="bottom" default="yes"/> <cd:constant type="stretch"/> + <cd:constant type="tolerant"/> + <cd:constant type="verytolerant"/> <cd:constant type="none"/> <cd:constant type="default"/> </cd:parameter> diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 7f7f8ea79..8e1324fba 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/generic/context/luatex/luatex-fonts-demo-tt.lua b/tex/generic/context/luatex/luatex-fonts-demo-tt.lua new file mode 100644 index 000000000..45c9a84ff --- /dev/null +++ b/tex/generic/context/luatex/luatex-fonts-demo-tt.lua @@ -0,0 +1,136 @@ +if not modules then modules = { } end modules ['luatex-fonts-demo-tt'] = { + version = 1.001, + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +-- Someone asked on the list if we could fake bad typewriters. Actually there are +-- already enough examples in successive articles and it's not too complex to mess +-- with fonts. There is a nicer way to do this (with a bit of metapost) but I have +-- no time now. After all, features like this are never used in practice, so it's a +-- waste of time to code them. +-- +-- Todo: force emwidth/5 for fonts > 1 ... only when requested. +-- +-- \starttext +-- +-- \raggedright +-- +-- \definefontfeature[badtypewritera][ttgrayness=.5] +-- \definefontfeature[badtypewriterb][ttshift=.5] +-- \definefontfeature[badtypewriterc][ttthickness=2] +-- \definefontfeature[badtypewriterd][ttgrayness=.5,ttshift=.5,ttthickness=2,ttfont={dejavusansmono}] +-- \definefontfeature[badtypewritere][ttgrayness=.5,ttthickness=2,ttstep=2,ttmax=1.5] +-- +-- \definefont[MyFontA][file:luatex-fonts-demo-tt.lua*badtypewritera] +-- \definefont[MyFontB][file:luatex-fonts-demo-tt.lua*badtypewriterb] +-- \definefont[MyFontC][file:luatex-fonts-demo-tt.lua*badtypewriterc] +-- \definefont[MyFontD][file:luatex-fonts-demo-tt.lua*badtypewriterd @ 10pt] +-- \definefont[MyFontE][file:luatex-fonts-demo-tt.lua*badtypewritere @ 10pt] +-- +-- \MyFontA \input tufte \blank {\righttoleft لَيْسَ لَدَيَّ أَيُّ فِكْرَةٍ عَمَّا يَعْنِيهِ هٰذَا.} \page +-- \MyFontB \input tufte \blank {\righttoleft لَيْسَ لَدَيَّ أَيُّ فِكْرَةٍ عَمَّا يَعْنِيهِ هٰذَا.} \page +-- \MyFontC \input tufte \blank {\righttoleft لَيْسَ لَدَيَّ أَيُّ فِكْرَةٍ عَمَّا يَعْنِيهِ هٰذَا.} \page +-- \MyFontD \input tufte \blank {\righttoleft لَيْسَ لَدَيَّ أَيُّ فِكْرَةٍ عَمَّا يَعْنِيهِ هٰذَا.} \page +-- \MyFontE \input tufte \blank {\righttoleft لَيْسَ لَدَيَّ أَيُّ فِكْرَةٍ عَمَّا يَعْنِيهِ هٰذَا.} \page +-- +-- \stoptext + +local random, sin = math.random, math.sin +local formatters = string.formatters + +local now = 0 +local max = 2 * math.pi +local step = max/20 + +-- The sin trick is first shown by Hartmut in 2005 when we had a few more plugs into +-- the backend. His demo was a rather colorful sheet that looked like it was crumpled. +-- There were no virtual fonts involved the, just pdf.print hooked into an always +-- applied Lua function. + +function fonts.helpers.FuzzyFontStart(exheight,ttgrayness,ttthickness,ttshift,ttstep,ttmax) + local grayness = ttgrayness * random(0,5)/10 + local thickness = ttthickness * random(1,2)/10 + local shift = 0 + if ttstep > 0 then + if now > max then + now = 0 + else + now = now + step * ttstep + end + shift = ttmax * sin(now) * exheight/5 + else + shift = ttshift * random(-1,1) * exheight/20 + end + -- We can optimize for one of them being zero or the default but no one will + -- use this in production so efficiency hardly matters. + local template = formatters["pdf:page:q %0.2F g %.2F G %0.2F w 2 Tr %.3F Ts"]( + grayness, grayness, thickness, shift + ) + vf.special(template) + -- will be: + -- local template = formatters["q %0.2F g %.2F G %0.2F w 2 Tr %.3F Ts"]( + -- grayness, grayness, thickness, shift + -- ) + -- vf.pdf("page",template) +end + +function fonts.helpers.FuzzyFontStop() + vf.special("pdf:page:Q") + -- will be: + -- vf.pdf("page","Q") +end + +return function(specification) + local features = specification.features.normal + local list = features.ttfont + if list then + list = utilities.parsers.settings_to_array(list) + else + list = { + 'lmtypewriter10-regular', + 'almfixed', + } + end + local f = { } + local id = { } + for i=1,#list do + f[i], id[i] = fonts.constructors.readanddefine(list[i],specification.size) + end + local f1 = f[1] + if f1 then + f1.name = specification.name -- needs checking (second time used an error) + f1.properties.name = specification.name + f1.properties.virtualized = true + f1.fonts = { } + local target = f1.characters + local exbp = f1.parameters.exheight * number.dimenfactors.bp + local stop = { + "lua", + "fonts.helpers.FuzzyFontStop()", + } + local start = { + "lua", + formatters["fonts.helpers.FuzzyFontStart(%.3F,%.2F,%.2F,%.2F,%.2F,%.2F)"]( + exbp, + tonumber(features.ttgrayness) or 1, + tonumber(features.ttthickness) or 1, + tonumber(features.ttshift) or 1, + tonumber(features.ttstep) or 0, + tonumber(features.ttmax) or 1 + ), + } + for i=1,#list do + f1.fonts[i] = { id = id[i] } + local characters = f[i].characters + for u, v in next, characters do + v.commands = { start, { "slot", i, u }, stop } + if characters ~= target then + target[u] = v + end + end + end + end + return f1 +end diff --git a/tex/generic/context/luatex/luatex-fonts-demo-vf-1.lua b/tex/generic/context/luatex/luatex-fonts-demo-vf-1.lua index 1e4256003..c4567e446 100644 --- a/tex/generic/context/luatex/luatex-fonts-demo-vf-1.lua +++ b/tex/generic/context/luatex/luatex-fonts-demo-vf-1.lua @@ -3,7 +3,7 @@ if not modules then modules = { } end modules ['luatex-fonts-demo-vf-1'] = { comment = "companion to luatex-*.tex", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" + license = "see context related readme files", } local identifiers = fonts.hashes.identifiers diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index dabe5c3b9..fcdcd5139 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 : 02/14/18 22:56:43 +-- merge date : 02/19/18 18:56:14 do -- begin closure to overcome local limits and interference @@ -17291,9 +17291,10 @@ function readers.stat(f,fontdata,specification) local values={} setposition(f,tableoffset+axisoffset) for i=1,nofaxis do + local tag=readtag(f) axis[i]={ - tag=readtag(f), - name=lower(extras[readushort(f)]), + tag=tag, + name=lower(extras[readushort(f)] or tag), ordering=readushort(f), variants={} } @@ -17307,7 +17308,7 @@ function readers.stat(f,fontdata,specification) local format=readushort(f) local index=readushort(f)+1 local flags=readushort(f) - local name=lower(extras[readushort(f)]) + local name=lower(extras[readushort(f)] or "no name") local value=readfixed(f) local variant if format==1 then |