diff options
author | Hans Hagen <pragma@wxs.nl> | 2022-11-18 14:22:11 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2022-11-18 14:22:11 +0100 |
commit | 2593c827482f6c5a315d504cd5316879d6172656 (patch) | |
tree | b696bd4e414c49230068ef8b8e4efed48f75d37f /tex/context/base | |
parent | 08473f11287cb263079c0435068312cbc6d736e8 (diff) | |
download | context-2593c827482f6c5a315d504cd5316879d6172656.tar.gz |
2022-11-18 13:17:00
Diffstat (limited to 'tex/context/base')
-rw-r--r-- | tex/context/base/mkii/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkii/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-con.lua | 18 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-otl.lua | 40 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-pre.mkiv | 8 | ||||
-rw-r--r-- | tex/context/base/mkiv/spac-chr.lua | 35 | ||||
-rw-r--r-- | tex/context/base/mkiv/status-files.pdf | bin | 24564 -> 24578 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/status-lua.pdf | bin | 263628 -> 263632 bytes | |||
-rw-r--r-- | tex/context/base/mkxl/cont-new.mkxl | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/context.mkxl | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/driv-shp.lmt | 36 | ||||
-rw-r--r-- | tex/context/base/mkxl/font-mat.mklx | 30 | ||||
-rw-r--r-- | tex/context/base/mkxl/font-pre.mkxl | 16 | ||||
-rw-r--r-- | tex/context/base/mkxl/math-act.lmt | 35 | ||||
-rw-r--r-- | tex/context/base/mkxl/page-imp.mkxl | 13 | ||||
-rw-r--r-- | tex/context/base/mkxl/spac-chr.lmt | 63 | ||||
-rw-r--r-- | tex/context/base/mkxl/trac-vis.lmt | 4 |
19 files changed, 186 insertions, 124 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 0b5c9bdf9..ad689d99c 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{2022.11.14 22:54} +\newcontextversion{2022.11.18 13:15} %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 e4fb9c469..09f548302 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{2022.11.14 22:54} +\edef\contextversion{2022.11.18 13:15} %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 333a3dc54..db7e8f9a2 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2022.11.14 22:54} +\newcontextversion{2022.11.18 13:15} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index db4a0a66f..107874ffd 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -49,7 +49,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2022.11.14 22:54} +\edef\contextversion{2022.11.18 13:15} %D Kind of special: diff --git a/tex/context/base/mkiv/font-con.lua b/tex/context/base/mkiv/font-con.lua index 820e45f52..066ea33ed 100644 --- a/tex/context/base/mkiv/font-con.lua +++ b/tex/context/base/mkiv/font-con.lua @@ -390,15 +390,15 @@ function constructors.scale(tfmdata,specification) local textsize = tonumber(specification.textsize) or scaledpoints -- local forcedsize = tonumber(parameters.mathsize ) or 0 -- can be set by the feature "mathsize" local extrafactor = tonumber(specification.factor ) or 1 - -- if (mathsize == 2 or forcedsize == 2) and parameters.scriptpercentage then - -- scaledpoints = parameters.scriptpercentage * textsize / 100 - -- elseif (mathsize == 3 or forcedsize == 3) and parameters.scriptscriptpercentage then - -- scaledpoints = parameters.scriptscriptpercentage * textsize / 100 - -- elseif forcedsize > 1000 then -- safeguard - -- scaledpoints = forcedsize - -- else - -- -- in context x and xx also use mathsize - -- end + -- if context then + -- -- do nothing, as we moved this upstream + -- elseif (mathsize == 2 or forcedsize == 2) and parameters.scriptpercentage then + -- scaledpoints = parameters.scriptpercentage * textsize / 100 + -- elseif (mathsize == 3 or forcedsize == 3) and parameters.scriptscriptpercentage then + -- scaledpoints = parameters.scriptscriptpercentage * textsize / 100 + -- elseif forcedsize > 1000 then -- safeguard + -- scaledpoints = forcedsize + -- end targetparameters.mathsize = mathsize -- context specific targetparameters.textsize = textsize -- context specific -- targetparameters.forcedsize = forcedsize -- context specific diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua index 4199db03f..fc101c9c9 100644 --- a/tex/context/base/mkiv/font-otl.lua +++ b/tex/context/base/mkiv/font-otl.lua @@ -643,25 +643,33 @@ local function read_from_otf(specification) return tfmdata end --- local function checkmathsize(tfmdata,mathsize) --- local mathdata = tfmdata.shared.rawdata.metadata.math --- local mathsize = tonumber(mathsize) --- if mathdata then -- we cannot use mathparameters as luatex will complain --- local parameters = tfmdata.parameters --- parameters.scriptpercentage = mathdata.ScriptPercentScaleDown --- parameters.scriptscriptpercentage = mathdata.ScriptScriptPercentScaleDown --- parameters.mathsize = mathsize -- only when a number ! +-- if context then +-- +-- -- so the next will go to some generic module instead +-- +-- else +-- +-- local function checkmathsize(tfmdata,mathsize) +-- local mathdata = tfmdata.shared.rawdata.metadata.math +-- local mathsize = tonumber(mathsize) +-- if mathdata then -- we cannot use mathparameters as luatex will complain +-- local parameters = tfmdata.parameters +-- parameters.scriptpercentage = mathdata.ScriptPercentScaleDown +-- parameters.scriptscriptpercentage = mathdata.ScriptScriptPercentScaleDown +-- parameters.mathsize = mathsize -- only when a number ! +-- end -- end --- end -- --- registerotffeature { --- name = "mathsize", --- description = "apply mathsize specified in the font", --- initializers = { --- base = checkmathsize, --- node = checkmathsize, +-- registerotffeature { +-- name = "mathsize", +-- description = "apply mathsize specified in the font", +-- initializers = { +-- base = checkmathsize, +-- node = checkmathsize, +-- } -- } --- } +-- +-- end -- readers diff --git a/tex/context/base/mkiv/font-pre.mkiv b/tex/context/base/mkiv/font-pre.mkiv index 5cd107c23..91a2e818e 100644 --- a/tex/context/base/mkiv/font-pre.mkiv +++ b/tex/context/base/mkiv/font-pre.mkiv @@ -417,10 +417,14 @@ % [oldmath] % [oldmath=yes] -\ifdefined\mathnolimitsmode - \mathnolimitsmode\plusone % font driven (only opentype) +\ifdefined\variablefam + \variablefam\pluscclv \fi +% \ifdefined\mathnolimitsmode +% \mathnolimitsmode\plusone % font driven (only opentype) +% \fi + \ifdefined\mathitalicsmode \mathitalicsmode\plusone % simple noads become zero % \mathitalicsmode\plustwo % idem but inner is kept (for testing) diff --git a/tex/context/base/mkiv/spac-chr.lua b/tex/context/base/mkiv/spac-chr.lua index f9b4da31a..5bc8ae8f6 100644 --- a/tex/context/base/mkiv/spac-chr.lua +++ b/tex/context/base/mkiv/spac-chr.lua @@ -186,18 +186,20 @@ local methods = { -- maybe also 0x0008 : backspace + -- Watch out: a return value means "remove"! + [0x001E] = function(head,current) -- kind of special local next = getnext(current) - head, current = remove_node(head,current,true) if next and getid(next) == glue_code and getsubtype(next) == spaceskip_code then local nextnext = getnext(next) if nextnext then local char, font = isglyph(nextnext) if char and not canhavespace[char] then - remove_node(head,next,true) + head, current = remove_node(head,next,true) end end end + return head, current end, [0x001F] = function(head,current) -- kind of special @@ -205,13 +207,13 @@ local methods = { if next then local char, font = isglyph(next) if char then - head, current = remove_node(head,current,true) if not ispunctuation[char] then local p = fontparameters[font] head, current = insertnodebefore(head,current,new_glue(p.space,p.space_stretch,p.space_shrink)) end end end + return head, current end, [0x00A0] = function(head,current) -- nbsp @@ -338,3 +340,30 @@ function characters.handler(head) end return head end + +-- function characters.handler(head) +-- local wiped = false +-- for current, char in nextchar, head do +-- local method = methods[char] +-- if method then +-- if wiped then +-- wiped[#wiped+1] = current +-- else +-- wiped = { current } +-- end +-- if trace_characters then +-- report_characters("replacing character %C, description %a",char,lower(chardata[char].description)) +-- end +-- local h = method(head,current) +-- if h then +-- head = h +-- end +-- end +-- end +-- if wiped then +-- for i=1,#wiped do +-- head = remove_node(head,wiped[i],true) +-- end +-- end +-- return head +-- end diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 13b79a990..c5ec75d70 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 bd256d4ec..afc189b09 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 48532ede6..2d953077e 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2022.11.14 22:54} +\newcontextversion{2022.11.18 13:15} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index d111761b0..47a9ffb4b 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2022.11.14 22:54} +\immutable\edef\contextversion{2022.11.18 13:15} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt index 1dfb73f17..941365f59 100644 --- a/tex/context/base/mkxl/driv-shp.lmt +++ b/tex/context/base/mkxl/driv-shp.lmt @@ -640,11 +640,7 @@ interfaces.implement { arguments = { "integer", "integer", "box" }, actions = function(anchor,where,box) box = tonut(box) - if where < 0 then - insert(befores[anchor],box) - else - insert(afters[anchor],box) - end + insert(where < 0 and befores[anchor] or afters[anchor],box) stored = true end } @@ -655,31 +651,25 @@ local hlist_out, vlist_out do local flushnode = nuts.flushnode local function flushstored(current,source,before) - local s = nil - if before then - s = rawget(befores,source) - else - s = rawget(afters,source) - end + local t = before and befores or afters + local s = rawget(t,source) if s then for i=1,#s do local si = s[i] if si then - finalize(si) -- tricky: we might need to group - if getid(si) == vlist_code then - vlist_out(current,si) + local box = si -- si[1] + finalize(box) -- tricky: we might need to group +-- print(getanchors(box)) + if getid(box) == vlist_code then + vlist_out(current,box) else - hlist_out(current,si) + hlist_out(current,box) end - flushnode(si) + flushnode(box) s[i] = false end end - if before then - rawset(befores,source,nil) - else - rawset(afters,source,nil) - end + rawset(t,source,nil) end end @@ -834,8 +824,8 @@ local hlist_out, vlist_out do -- cur_h = cur_h + wd - right -- hm, no left here? cur_h = cur_h + wd -- see new tabulate alignment code elseif id == glue_code then --- local gluewidth = effectiveglue(current,this_box) -local gluewidth = effectiveglue(current,this_box,true) + -- local gluewidth = effectiveglue(current,this_box) + local gluewidth = effectiveglue(current,this_box,true) if gluewidth ~= 0 then if subtype >= leaders_code then local leader = getleader(current) diff --git a/tex/context/base/mkxl/font-mat.mklx b/tex/context/base/mkxl/font-mat.mklx index d9337d1b0..39ed13069 100644 --- a/tex/context/base/mkxl/font-mat.mklx +++ b/tex/context/base/mkxl/font-mat.mklx @@ -47,7 +47,8 @@ \ifdefined\??fontinstancebasic \else \installcorenamespace{fontinstancebasic} \fi \ifdefined\??fontinstanceclass \else \installcorenamespace{fontinstanceclass} \fi -%D The order 3 2 1 of size matters: needed for math-fbk relative size storage! +%D The order 3 2 1 of size matters is historic and was needed for math-fbk relative +%D size storage! It is no longer relevant. %D \macros %D {textonly} @@ -124,13 +125,11 @@ \mutable\let\fontfamily\relax % for now public but it is a helper -%newconditional\c_math_last_family_set \newcount \c_math_last_family_used \def\font_helpers_set_math_family_indeed_normal#mrtag#family% \fontface etc are also used later on {\let\savedfontbody\fontbody \let\fontfamily#family% -% \settrue\c_math_last_family_set \c_math_last_family_used\zerocount % the order is important as we depend on known id's when completing fonts % enabling is needed when we have fallbacks which spoils the families; per @@ -163,7 +162,6 @@ \def\font_helpers_set_math_family_indeed_compact#mrtag#family% \fontface etc are also used later on {\let\savedfontbody\fontbody \let\fontfamily#family% -% \settrue\c_math_last_family_set \c_math_last_family_used\zerocount \font_helpers_set_math_family_set_scales_compact % the order is important as we depend on known id's when completing fonts @@ -189,7 +187,6 @@ \let\defaultfontclass\fontclass % else truefontname falls back on the wrong one \let\savedfontbody\fontbody \let\fontfamily#familytag% -% \settrue\c_math_last_family_set \c_math_last_family_used\zerocount \font_helpers_set_math_family_set_scales_normal \let\mathsizesuffix\mathscriptscriptsuffix\let\fontface\!!plusthree @@ -211,11 +208,10 @@ \let\defaultfontclass\fontclass % else truefontname falls back on the wrong one \let\savedfontbody\fontbody \let\fontfamily#familytag% -% \settrue\c_math_last_family_set \c_math_last_family_used\zerocount \let\mathsizesuffix\mathtextsuffix \let\fontface\!!plusone \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% defines -% \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% enables / still needed ? + \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% enables / still needed ? \scriptfont #mbfam\textfont#mbfam% reuses \scriptscriptfont#mbfam\textfont#mbfam% reuses \let\mathsizesuffix\empty \let\fontface\!!zerocount @@ -480,14 +476,6 @@ \mutable\let\bigmathfontsize\empty -% \permanent\protected\def\synchronizebigmath -% {\ifx\bigmathfontsize\fontsize -% % already in sync -% \else -% \let\bigmathfontsize\fontsize -% \font_helpers_synchronize_math -% \fi} - \permanent\protected\def\synchronizebigmath {\ifconditional\c_font_compact % no need @@ -517,18 +505,6 @@ %D This is nasty, as the engine only stores the last set family parameters (per style) which %D in our case can be bold. -% \def\font_helpers_synchronize_math_parameters -% {\textfont \zerocount\textfont \zerocount -% \scriptfont \zerocount\scriptfont \zerocount -% \scriptscriptfont\zerocount\scriptscriptfont\zerocount -% \setfalse\c_math_last_family_set} -% -% \appendtoks -% \ifconditional\c_math_last_family_set -% \font_helpers_synchronize_math_parameters -% \fi -% \to\everybodyfont - \def\font_helpers_synchronize_math_parameters {\c_math_last_family_used\mathstylefontid\textstyle\zerocount \textfont \zerocount\textfont \zerocount diff --git a/tex/context/base/mkxl/font-pre.mkxl b/tex/context/base/mkxl/font-pre.mkxl index 2918a7e8c..2fc0aef26 100644 --- a/tex/context/base/mkxl/font-pre.mkxl +++ b/tex/context/base/mkxl/font-pre.mkxl @@ -433,6 +433,10 @@ \mathnolimitsmode\plusone % font driven (only opentype) \fi +% \ifdefined\variablefam +% \variablefam 63 +% \fi + % \adaptfontfeature[*math*][mathnolimitsmode=1000] % only subscript \definefontfeature @@ -456,9 +460,13 @@ % \definefontfeature[virtualmath-l2r] [mathematics-l2r] % obsolete % \definefontfeature[virtualmath-r2l] [mathematics-r2l] % obsolete -\definefontfeature[math-text] [mathematics] % [ssty=no] -\definefontfeature[math-script] [mathematics] [ssty=1,mathsize=yes] -\definefontfeature[math-scriptscript] [mathematics] [ssty=2,mathsize=yes] +\definefontfeature[math-text] [mathematics] [ssty=no] +\definefontfeature[math-script] [mathematics] [ssty=1] +\definefontfeature[math-scriptscript] [mathematics] [ssty=2] + +% \definefontfeature[math-text] [mathematics] [ssty=no] +% \definefontfeature[math-script] [mathematics] [ssty=1,mathsize=yes] +% \definefontfeature[math-scriptscript] [mathematics] [ssty=2,mathsize=yes] % \definefontfeature[math-text-l2r] [mathematics-l2r] [ssty=no] % obsolete % \definefontfeature[math-script-l2r] [mathematics-l2r] [ssty=1,mathsize=yes] % obsolete @@ -516,7 +524,7 @@ %D \stoptext %D \stoptyping -\definefontfeature[primes] [primes=yes] +\definefontfeature[primes] [primes=yes] % text \definefontfeature[uppercasing][uppercasing=yes] \definefontfeature[lowercasing][lowercasing=yes] \definefontfeature[camelcasing][camelcasing=yes] diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt index c18dcda29..2df708806 100644 --- a/tex/context/base/mkxl/math-act.lmt +++ b/tex/context/base/mkxl/math-act.lmt @@ -1453,6 +1453,7 @@ do local kerns = parameters.list if kerns then local characters = target.characters + local done = false local function setone(uc,data) local function set(unicode) unicode = mathgaps[unicode] or unicode @@ -1463,6 +1464,13 @@ do local k = data.topright ; if k and k ~= 0 then chardata.topright = k * width end local k = data.bottomleft ; if k and k ~= 0 then chardata.bottomleft = k * width end local k = data.bottomright ; if k and k ~= 0 then chardata.bottomright = k * width end + if not trace_tweaking then + done = true + elseif done then + done[unicode] = true + else + done = { [unicode] = true } + end end end local unicode = detail(characters,uc) @@ -1478,6 +1486,7 @@ do setone(unicode,data) -- withscriptcode(tfmdata,unicode,data,kernone) -- also smaller end + feedback_tweak("kerns",target,original,done) end end @@ -1489,8 +1498,10 @@ do local margins = parameters.list if margins then local characters = target.characters + local done = false local function setone(unicode,data) - local chardata = characters[mathgaps[unicode] or unicode] + unicode = mathgaps[unicode] or unicode + local chardata = characters[unicode] if chardata then local width = chardata.width or 0 local total = (chardata.height or 0) + (chardata.depth or 0) @@ -1498,12 +1509,20 @@ do local k = data.right ; if k and k ~= 0 then chardata.rightmargin = k * width end local k = data.top ; if k and k ~= 0 then chardata.topmargin = k * total end local k = data.bottom ; if k and k ~= 0 then chardata.bottommargin = k * total end + if not trace_tweaking then + done = true + elseif done then + done[unicode] = true + else + done = { [unicode] = true } + end end end for unicode, data in next, margins do setone(unicode,data) -- withscriptcode(tfmdata,unicode,data,kernone) -- also smaller end + feedback_tweak("margins",target,original,done) end end @@ -2874,6 +2893,8 @@ do { 0x208B, 0x2212, false }, } + datasets.addscripts = list + local function add(target,original,characters,unicode,template,super,baseheight,scale) if not characters[unicode] then local origdata = characters[template] @@ -3178,6 +3199,7 @@ do if list then local characters = target.characters local emwidth = target.parameters.quad + local done = false for i=1,#list do local entry = list[i] local target = entry.target @@ -3194,14 +3216,19 @@ do local data = characters[unicode] if data then data.topovershoot = top * (quad or data.width or 0) + if not trace_tweaking then + done = true + elseif done then + done[r] = true + else + done = { [r] = true } + end end end - if trace_tweaking then - report_mathtweak("setting overshoots for %a",target) - end end end end + feedback_tweak("setovershoots",target,original,done) end end diff --git a/tex/context/base/mkxl/page-imp.mkxl b/tex/context/base/mkxl/page-imp.mkxl index 4ef318985..5846fb22a 100644 --- a/tex/context/base/mkxl/page-imp.mkxl +++ b/tex/context/base/mkxl/page-imp.mkxl @@ -109,6 +109,19 @@ \protected\def\page_shipouts_rotate#1% {\invokepagehandler\v!normal{\rotate[\c!rotation=\rootlayouttargetparameter\c!rotation]{#1}}} +% inject an empty page after each page + +\def\page_shipouts_double#1% + {\page_shipouts_normal{#1}% + \page_shipouts_normal{\null}} + +\installshipoutmethod \v!doublesided + {\ifarrangingpages + \expandafter\page_shipouts_arrange + \else + \expandafter\page_shipouts_double + \fi} + % extension mechanism \newcount\c_page_boxes_flush_n % set at the lua end diff --git a/tex/context/base/mkxl/spac-chr.lmt b/tex/context/base/mkxl/spac-chr.lmt index a71c4a0e1..7c8e02fb6 100644 --- a/tex/context/base/mkxl/spac-chr.lmt +++ b/tex/context/base/mkxl/spac-chr.lmt @@ -114,6 +114,7 @@ local function inject_nobreak_space(unicode,head,current,space,spacestretch,spac local glue = new_glue(space,spacestretch,spaceshrink) local penalty = new_penalty(10000) setattrlist(glue,current) + setattrlist(penalty,current) setattrlist(current) -- why reset all setattr(glue,a_character,unicode) -- bombs head, current = insertnodeafter(head,current,penalty) @@ -149,6 +150,7 @@ function characters.replacenbsp(head,original) end function characters.replacenbspaces(head) + -- todo: wiping as in characters.handler(head) local wipe = false for current, char, font in nextglyph, head do -- can be anytime so no traversechar if char == 0x00A0 then @@ -186,9 +188,10 @@ local methods = { -- maybe also 0x0008 : backspace + -- Watch out: a return value means "remove"! + [0x001E] = function(head,current) -- kind of special local next = getnext(current) - head, current = remove_node(head,current,true) if next and getid(next) == glue_code and getsubtype(next) == spaceskip_code then local nextnext = getnext(next) if nextnext then @@ -198,18 +201,19 @@ local methods = { end end end + return head, current end, [0x001F] = function(head,current) -- kind of special local next = getnext(current) if next then local char, font = isglyph(next) - head, current = remove_node(head,current,true) if char and not ispunctuation[char] then local p = fontparameters[font] head, current = insertnodebefore(head,current,new_glue(p.space,p.spacestretch,p.spaceshrink)) end end + return head, current end, [0x00A0] = function(head,current) -- nbsp @@ -309,34 +313,6 @@ local methods = { characters.methods = methods --- function characters.handler(head) -- todo: use traverseid --- local current = head --- while current do --- local char, id = isglyph(current) --- if char then --- local next = getnext(current) --- local method = methods[char] --- if method then --- if trace_characters then --- report_characters("replacing character %C, description %a",char,lower(chardata[char].description)) --- end --- local h = method(head,current) --- if h then --- head = remove_node(h,current,true) --- end --- end --- current = next --- else --- current = getnext(current) --- end --- end --- return head --- end - --- this also works ok in math as we run over glyphs and these stay glyphs ... not sure --- about scripts and such but that is not important anyway ... some day we can consider --- special definitions in math - function characters.handler(head) local wipe = false for current, char in nextchar, head do @@ -360,3 +336,30 @@ function characters.handler(head) end return head end + +-- function characters.handler(head) +-- local wiped = false +-- for current, char in nextchar, head do +-- local method = methods[char] +-- if method then +-- if wiped then +-- wiped[#wiped+1] = current +-- else +-- wiped = { current } +-- end +-- if trace_characters then +-- report_characters("replacing character %C, description %a",char,lower(chardata[char].description)) +-- end +-- local h = method(head,current) +-- if h then +-- head = h +-- end +-- end +-- end +-- if wiped then +-- for i=1,#wiped do +-- head = remove_node(head,wiped[i],true) +-- end +-- end +-- return head +-- end diff --git a/tex/context/base/mkxl/trac-vis.lmt b/tex/context/base/mkxl/trac-vis.lmt index 09c0e020c..2b209e748 100644 --- a/tex/context/base/mkxl/trac-vis.lmt +++ b/tex/context/base/mkxl/trac-vis.lmt @@ -937,6 +937,10 @@ local ruledglyph do -- line = linewidth, -- type = "box", -- },new_kern(-wd)) +-- if ht == 0 and dp == 0 then +-- ht = linewidth/2 +-- dp = ht +-- end local info = (dp == 0 and outlinerule and outlinerule(wd,ht,dp,linewidth)) or userrule { width = wd, height = ht, |