diff options
author | Hans Hagen <pragma@wxs.nl> | 2022-08-01 20:41:35 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2022-08-01 20:41:35 +0200 |
commit | 1e83b1b27a30fc8df44607a37103b6c65efec538 (patch) | |
tree | 4031d6d4a36ab96f39eee03cc1326a42b89197c0 /tex | |
parent | 659d787cc8a329d01ff920c7e1a4659dc66b7daa (diff) | |
download | context-1e83b1b27a30fc8df44607a37103b6c65efec538.tar.gz |
2022-08-01 20:31:00
Diffstat (limited to 'tex')
30 files changed, 415 insertions, 156 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 96f8851e5..ab5bc863f 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.07.27 17:51} +\newcontextversion{2022.08.01 20:30} %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 b34bfe923..b7cadf7a8 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.07.27 17:51} +\edef\contextversion{2022.08.01 20:30} %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 e853baed1..736563f33 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.07.27 17:51} +\newcontextversion{2022.08.01 20:30} %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 82d356d35..70ef42f89 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.07.27 17:51} +\edef\contextversion{2022.08.01 20:30} %D Kind of special: diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index 40753f55c..b20156062 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -214,6 +214,7 @@ return { -- "openfenceclassoptioncode", "closefenceclassoptioncode", "middlefenceclassoptioncode", "checkligatureclassoptioncode", "checkitaliccorrectionclassoptioncode", "checkkernpairclassoptioncode", "flattenclassoptioncode", "omitpenaltyclassoptioncode", "unpackclassoptioncode", "raiseprimeclassoptioncode", + "carryoverlefttopkernclassoptioncode", "carryoverleftbottomkernclassoptioncode", "carryoverrighttopkernclassoptioncode", "carryoverrightbottomkernclassoptioncode", -- "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noleftligatureglyphoptioncode", "noleftkernglyphoptioncode", "norightligatureglyphoptioncode", "norightkernglyphoptioncode", diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index c01c04d54..e935fb40c 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -57,7 +57,6 @@ return { "tracingassigns", "tracinggroups", "tracingifs", - "tracinglevels", "tracingnesting", "unexpanded", "unless", @@ -429,6 +428,7 @@ return { "instance", "integerdef", "lastarguments", + "lastatomclass", "lastboundary", "lastchkdim", "lastchknum", @@ -532,7 +532,6 @@ return { "overloaded", "overloadmode", "pageboundary", - "pageboundarypenalty", "pageextragoal", "pagevsize", "parametercount", @@ -610,6 +609,7 @@ return { "tracingfullboxes", "tracinghyphenation", "tracinginserts", + "tracinglevels", "tracingmarks", "tracingmath", "tracingnodes", diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex a4b660c90..b900f2fb5 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 b98b3fd51..776c1f125 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-lst.lua b/tex/context/base/mkiv/strc-lst.lua index 2e8eb15d9..865c44624 100644 --- a/tex/context/base/mkiv/strc-lst.lua +++ b/tex/context/base/mkiv/strc-lst.lua @@ -990,6 +990,18 @@ function lists.hasnumberdata(name,n) return false end +function lists.rawnumber(n,name) + local data = lists.result[n] + if data then + local numberdata = data.numberdata + if numberdata then + numberdata = numberdata.numbers + return numberdata and numberdata[getsectionlevel(name)] or numberdata[name] or 0 + end + end + return 0 +end + function lists.prefix(name,n,spec) helpers.prefix(lists.result[n],spec) end @@ -1327,6 +1339,12 @@ implement { arguments = "integer" } +implement { + name = "rawlistnumber", + actions = { lists.rawnumber, context }, + arguments = { "integer", "string" }, +} + -- new and experimental and therefore off by default lists.autoreorder = false -- true diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 38caf84ba..f72bb5f81 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.07.27 17:51} +\newcontextversion{2022.08.01 20:30} %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 3c7adcbec..27bbaa46a 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.07.27 17:51} +\immutable\edef\contextversion{2022.08.01 20:30} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/grph-inc.lmt b/tex/context/base/mkxl/grph-inc.lmt index 0ba4b093c..e55ac471b 100644 --- a/tex/context/base/mkxl/grph-inc.lmt +++ b/tex/context/base/mkxl/grph-inc.lmt @@ -306,6 +306,7 @@ local remappers = allocate() figures.remappers = remappers local converters = allocate() figures.converters = converters local identifiers = allocate() figures.identifiers = identifiers local programs = allocate() figures.programs = programs +local conversions = allocate() figures.conversions = conversions local defaultformat <const> = "pdf" local defaultprefix <const> = "m_k_i_v_" @@ -681,6 +682,13 @@ function figures.current() return callstack[#callstack] or lastfiguredata end +function figures.setconversion(format,conversion) + if conversion == "reset" or conversion == "" then + conversion = nil + end + conversions[format] = conversion +end + local function get(category,tag,default) local value = lastfiguredata and lastfiguredata[category] value = value and value[tag] @@ -781,6 +789,9 @@ local function register(askedname,specification) if not newformat or newformat == "" then newformat = defaultformat end + -- + conversion = conversions[format] or conversion + -- if trace_conversion then report_inclusion("checking conversion of %a, fullname %a, old format %a, new format %a, conversion %a, resolution %a, crop %a, arguments %a", askedname, @@ -2208,6 +2219,12 @@ implement { end } +implement { + name = "setfigureconversion", + arguments = "2 strings", + actions = figures.setconversion +} + -- for the moment we keep this here: do diff --git a/tex/context/base/mkxl/grph-inc.mkxl b/tex/context/base/mkxl/grph-inc.mkxl index ffc9fdf5a..29efe620f 100644 --- a/tex/context/base/mkxl/grph-inc.mkxl +++ b/tex/context/base/mkxl/grph-inc.mkxl @@ -407,6 +407,9 @@ \dostoptagged \egroup} +\permanent\protected\def\setfigureconversion[#1]#*[#2]% + {\clf_setfigureconversion{#1}{#2}} + %D Next we provide a cross referenced scale-up mechanism: \def\strc_references_cross_forward#1#2% diff --git a/tex/context/base/mkxl/lpdf-rul.lmt b/tex/context/base/mkxl/lpdf-rul.lmt index d6a528034..ca38dcaa8 100644 --- a/tex/context/base/mkxl/lpdf-rul.lmt +++ b/tex/context/base/mkxl/lpdf-rul.lmt @@ -146,8 +146,10 @@ FakeRule(RuleWidth,RuleHeight,RuleDepth,RuleThickness,RuleColor); setdimen("d_rule_h", h) setdimen("d_rule_v", v) setdimen("d_rule_line", p.line or 65536) - setdimen("d_rule_offset", p.offset or 0) - setmacro("m_rule_factor", p.factor or 0) +-- setdimen("d_rule_offset", p.offset or 0) + setdimen("d_rule_offset", (p.offset or 0) * 65536) +-- setmacro("m_rule_factor", (p.factor or 0) * bpfactor) -- needs checking + setdimen("d_rule_factor", (p.factor or 0)) -- needs checking setmacro("m_rule_option", p.option or "") setmacro("m_rule_direction", p.direction or lefttoright_code) setmacro("m_rule_color", mpcolor(p.ma,p.ca,p.ta)) diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt index 4cfad32fe..89d7d3153 100644 --- a/tex/context/base/mkxl/math-act.lmt +++ b/tex/context/base/mkxl/math-act.lmt @@ -9,11 +9,12 @@ if not modules then modules = { } end modules ['math-act'] = { -- Here we tweak some font properties (if needed). The commented sections -- have been removed (no longer viable) but can be found in the .lua variant. -local type, next = type, next +local type, next, tonumber = type, next, tonumber local fastcopy, insert, remove = table.fastcopy, table.insert, table.remove local formatters = string.formatters local byte = string.byte local setmetatableindex, sortedhash = table.setmetatableindex, table.sortedhash +local lpegmatch = lpeg.match local trace_defining = false trackers.register("math.defining", function(v) trace_defining = v end) local trace_collecting = false trackers.register("math.collecting", function(v) trace_collecting = v end) @@ -284,11 +285,87 @@ end -- }, -- }, + -- ["0x7C.variants.*"] = { squeeze = 0.10, height = 0.10, depth = 0.10 }, + +local detail do + + local splitter = lpeg.tsplitat(".") + + detail = function(characters,k) + if type(k) == "string" then + local t = lpegmatch(splitter,k) + local n = #t + if n > 0 then + local base = tonumber(t[1]) or tonumber(t[1],16) + if base then + local c = characters[base] + if c and n > 1 then + local list = t[2] + if list == "parts" then + local nxt = c.next + while nxt do + c = characters[nxt] + nxt = c.next + end + c = c.hparts or c.vparts + if c then + local index = t[3] + if index == "*" then + return t + else + if index == "top" then + index = #c + elseif index == "bottom" then + index = 1 + else + index = tonumber(index) + end + if index then + c = c[index] + if c then + return c.glyph + end + end + end + end + elseif list == "variants" then + local index = t[3] + if index == "*" then + local t = { } + local nxt = c.next + while nxt do + t[#t+1] = nxt + c = characters[nxt] + nxt = c.next + end + return t + else + index = tonumber(index) + if index then + local nxt = c.next + while nxt and index > 1 do + c = characters[nxt] + nxt = c.next + index = index - 1 + end + return nxt + end + end + end + end + end + end + else + return k + end + end + +end + do local stepper = utilities.parsers.stepper local count = 0 - local splitter = lpeg.tsplitat(".") local toeffect = fonts.toeffect local privateslot = fonts.helpers.privateslot @@ -421,69 +498,6 @@ do end end - -- ["0x7C.variants.*"] = { squeeze = 0.10, height = 0.10, depth = 0.10 }, - - local function detail(characters,k) - if type(k) == "string" then - local t = lpeg.match(splitter,k) - local n = #t - if n > 0 then - local base = tonumber(t[1]) or tonumber(t[1],16) - if base then - local c = characters[base] - if c and n > 1 then - local list = t[2] - if list == "parts" then - local nxt = c.next - while nxt do - c = characters[nxt] - nxt = c.next - end - c = c.hparts or c.vparts - if c then - local index = t[3] - if index == "*" then - return t - else - index = tonumber(index) - if index then - c = c[index] - if c then - return c.glyph - end - end - end - end - elseif list == "variants" then - local index = t[3] - if index == "*" then - local t = { } - local nxt = c.next - while nxt do - t[#t+1] = nxt - c = characters[nxt] - nxt = c.next - end - return t - else - index = tonumber(index) - if index then - local nxt = c.next - while nxt and index > 1 do - c = characters[nxt] - nxt = c.next - index = index - 1 - end - return nxt - end - end - end - end - end - end - end - end - function mathtweaks.dimensions(target,original,parameters) local list = parameters.list if list then @@ -1111,13 +1125,26 @@ do local kerns = parameters.list if kerns then local characters = target.characters - local function setone(unicode,data) - local chardata = characters[mathgaps[unicode] or unicode] - local width = chardata.width or 0 - local k = data.topleft ; if k and k ~= 0 then chardata.topleft = k * width end - 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 + local function setone(uc,data) + local function set(unicode) + unicode = mathgaps[unicode] or unicode + local chardata = characters[unicode] + if chardata then + local width = chardata.width or 0 + local k = data.topleft ; if k and k ~= 0 then chardata.topleft = k * width end + 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 + end + end + local unicode = detail(characters,uc) + if type(unicode) == "table" then + for i=1,#unicode do + set(unicode[i]) + end + elseif unicode then + set(unicode) + end end for unicode, data in next, kerns do setone(unicode,data) -- withscriptcode(tfmdata,unicode,data,kernone) diff --git a/tex/context/base/mkxl/math-fnt.lmt b/tex/context/base/mkxl/math-fnt.lmt index 0faa006c9..2f80cdfa6 100644 --- a/tex/context/base/mkxl/math-fnt.lmt +++ b/tex/context/base/mkxl/math-fnt.lmt @@ -6,39 +6,66 @@ if not modules then modules = { } end modules ['math-fnt'] = { license = "see context related readme files" } -local nuts = nodes.nuts -local tonut = nodes.tonut -local tonode = nodes.tonode -local nodepool = nuts.pool +local nuts = nodes.nuts +local tonut = nodes.tonut +local tonode = nodes.tonode +local nodepool = nuts.pool -local vlist_code = nodes.nodecodes.vlist +local vlist_code = nodes.nodecodes.vlist -local new_hlist = nodepool.hlist -local new_vlist = nodepool.vlist ------ new_glyph = nodepool.glyph -local new_glyph = nuts.newmathglyph +local new_hlist = nodepool.hlist +local new_vlist = nodepool.vlist +----- new_glyph = nodepool.glyph +local new_glyph = nuts.newmathglyph -local getattrlst = nuts.getattributelist -local setattrlst = nuts.setattributelist -local setwhd = nuts.setwhd -local getwhd = nuts.getwhd -local getid = nuts.getid +local getattrlst = nuts.getattributelist +local setattrlst = nuts.setattributelist +local setwhd = nuts.setwhd +local getwhd = nuts.getwhd +local getid = nuts.getid -local chardata = fonts.hashes.characters +local chardata = fonts.hashes.characters +local addcharacters = font.addcharacters -- not yet ok for compact fonts .. needs checking .. or just make this non-compact only -- there's also an inaccuracy creeping in: \sqrt{\quad\blackrule[height=25pt,depth=25pt]} local function register_extensible(font,char,style,box) + -- We don't share (yet)! local bx = tonut(box) nodes.handlers.finalizelist(bx) local id = getid(bx) local al = getattrlst(bx) local wd, ht, dp = getwhd(bx) - local private = fonts.helpers.setboxdirectly(font,chardata[font][char].unicode or char,box) + local fontdata = chardata[font] + local oldchar = fontdata[char] + local unicode = oldchar.unicode or char + local private = fonts.helpers.setboxdirectly(font,unicode,box) -- we saved a scaled glyph stream so we now use an unscaled one ... local g = new_glyph(font,private,al) local n = new_hlist(g) + + -- local newchar = { + -- unicode = unicode, + -- width = wd, + -- height = ht, + -- depth = dp, + -- } + -- local p = oldchar.vparts + -- if p then + -- local first = fontdata[p[#p].glyph] + -- local last = fontdata[p[ 1].glyph] + -- if first then + -- newchar.topleft = first.topleft + -- newchar.topright = first.topright + -- end + -- if last then + -- newchar.bottomleft = last.bottomleft + -- newchar.bottomright = last.bottomright + -- end + -- end + -- addcharacters(font, { [private] = newchar }) + -- so the dimensions of the box don't match the glyph scale! setwhd(n,wd,ht,dp) setattrlst(n,al) diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index 1c5f062ec..d3d652b37 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -418,8 +418,9 @@ %D In the end Mikael and I prefer this but we need a high level interface: -% \setmathignore\Umathspacebeforescript\plusone -% \setmathignore\Umathspaceafterscript \plusone +% \setmathignore\Umathspacebeforescript \plusone +% \setmathignore\Umathspaceafterscript \plusone +% \setmathignore\Umathradicaldegreebefore\plusone % done in math-rad.mklx \setmathignore \Umathspacebeforescript\zerocount \setmathignore \Umathspaceafterscript \zerocount @@ -542,11 +543,19 @@ \setmathoptions\mathfractioncode\numexpr \defaultmathclassoptions +\raiseprimeclassoptioncode + +\carryoverlefttopkernclassoptioncode + +\carryoverleftbottomkernclassoptioncode + +\carryoverrighttopkernclassoptioncode + +\carryoverrightbottomkernclassoptioncode \relax \setmathoptions\mathradicalcode\numexpr \defaultmathclassoptions +\raiseprimeclassoptioncode + +\carryoverlefttopkernclassoptioncode + +\carryoverleftbottomkernclassoptioncode + +\carryoverrighttopkernclassoptioncode + +\carryoverrightbottomkernclassoptioncode \relax \setmathoptions\mathaccentcode\numexpr @@ -564,11 +573,11 @@ +\rightbottomkernclassoptioncode \relax -\setmathoptions\mathbegincode +\setmathoptions\mathbegincode\numexpr \nopostslackclassoptioncode \relax -\setmathoptions\mathendcode +\setmathoptions\mathendcode\numexpr \nopreslackclassoptioncode \relax @@ -576,10 +585,29 @@ % subtypes. If we don't set the following we should actually also define the % spacing rules. -\setmathoptions\mathfencedcode +\setmathoptions\mathfencedcode\numexpr \unpackclassoptioncode + +\carryoverlefttopkernclassoptioncode + +\carryoverleftbottomkernclassoptioncode + +\carryoverrighttopkernclassoptioncode + +\carryoverrightbottomkernclassoptioncode \relax +% test case for \lefttopkernclassoptioncode and \leftbottomkernclassoptioncode in cambria close: +% +% \setupbodyfont[cambria] +% %\enableexperiments[math.extensibles] +% %\disableexperiments[math.extensibles] +% +% \startTEXpage[offset=1dk] +% \startformula \showglyphs +% \left\{ \mathatom class \mathfractioncode {\raise .6ex\hbox{\blackrule[color=blue, height=3cm,depth=3cm]}} \right\} ^1 _4 + +% \left\( \mathatom class \mathfractioncode {\raise .6ex\hbox{\blackrule[color=green, height=4cm,depth=4cm]}} \right\) ^2 _3 - +% \left\{ \mathatom class \mathfractioncode {\raise .6ex\hbox{\blackrule[color=red, height=2cm,depth=2cm]}} \right\} ^3 _2 + +% \left\( \mathatom class \mathfractioncode {\raise .6ex\hbox{\blackrule[color=yellow,height=1cm,depth=1cm]}} \right\) ^4 _1 +% \stopformula +% \stopTEXpage + %D For now \unknown (todo: make it adapt to style but we're in text anyway) \permanent\protected\def\math_discretionary_plus {\discretionary class \mathbinarycode {$+$}{$+$}{$+$}} diff --git a/tex/context/base/mkxl/mlib-int.lmt b/tex/context/base/mkxl/mlib-int.lmt index 7a094dbfd..837630850 100644 --- a/tex/context/base/mkxl/mlib-int.lmt +++ b/tex/context/base/mkxl/mlib-int.lmt @@ -168,15 +168,20 @@ registerdirect("defaultcolormodel", defaultcolormodel) -- see node-rul.* +-- offset is a multiplier +-- factor is the amount + registerdirect("RuleWidth", function() return getdimen("d_rule_width") * factor end) registerdirect("RuleHeight", function() return getdimen("d_rule_height") * factor end) registerdirect("RuleDepth", function() return getdimen("d_rule_depth") * factor end) registerdirect("RuleH", function() return getdimen("d_rule_h") * factor end) registerdirect("RuleV", function() return getdimen("d_rule_v") * factor end) registerdirect("RuleThickness", function() return getdimen("d_rule_line") * factor end) -registerdirect("RuleOffset", function() return getdimen("d_rule_offset") * factor end) +registerdirect("RuleOffset", function() return getdimen("d_rule_offset") / 65536 end) +-- registerdirect("RuleOffset", function() return getdimen("d_rule_offset") * factor end) registerdirect("RuleDirection", function() return getmacro("c_rule_direction") end) -registerdirect("RuleFactor", function() return getmacro("m_rule_factor") end) +-- registerdirect("RuleFactor", function() print(getmacro("m_rule_factor")) return (tonumber(getmacro("m_rule_factor")) or 0) * factor end) +registerdirect("RuleFactor", function() return getdimen("d_rule_factor") * factor end) registerdirect("RuleOption", function() return getmacro("m_rule_option") end) --------------("RuleColor", function() return getmacro("m_rule_color") end) registerscript("RuleColor", function() return getmacro("m_rule_color") end) diff --git a/tex/context/base/mkxl/node-rul.mkxl b/tex/context/base/mkxl/node-rul.mkxl index 4f13b16f1..ac66d11b3 100644 --- a/tex/context/base/mkxl/node-rul.mkxl +++ b/tex/context/base/mkxl/node-rul.mkxl @@ -88,10 +88,19 @@ \frozen\protected\instance\edefcsname\currentbar\endcsname{\node_rules_direct{\currentbar}}% \to \everydefinebar +% \protected\def\node_rules_direct#1% +% {\groupedcommand +% {\node_rules_set{#1}\barparameter\c!left}% +% {\relax\barparameter\c!right}} + \protected\def\node_rules_direct#1% {\groupedcommand - {\node_rules_set{#1}\barparameter\c!left}% - {\relax\barparameter\c!right}} + {\dontleavehmode % this should not be needed but it is in \bTD + \node_rules_set{#1} + \barparameter\c!left + } %\ignorespaces}% + {%\removeunwantesspaces + \barparameter\c!right}} \permanent\protected\def\inlinebar[#1]% {\node_rules_direct{#1}} @@ -287,9 +296,10 @@ \newdimen\d_rule_v \newdimen\d_rule_line \newdimen\d_rule_offset +\newdimen\d_rule_factor \mutable\let\m_rule_direction\empty -\mutable\let\m_rule_factor \empty +% \mutable\let\m_rule_factor \empty \mutable\let\m_rule_option \empty \mutable\let\m_rule_color \empty diff --git a/tex/context/base/mkxl/page-sid.mkxl b/tex/context/base/mkxl/page-sid.mkxl index 8959a0e3d..ec53a23a4 100644 --- a/tex/context/base/mkxl/page-sid.mkxl +++ b/tex/context/base/mkxl/page-sid.mkxl @@ -450,8 +450,8 @@ \else %\tracingpages\plusone \tracingonline\plustwo \begingroup - \pageboundarypenalty\plustenthousand - \pageboundary % becomes a penalty (after triggering the callback) (experimental!) + % \pageboundarypenalty\plustenthousand % is now: + \pageboundary\plustenthousand % becomes a penalty (after triggering the callback) (experimental!) \endgroup %\tracingpages\zerocount \fi diff --git a/tex/context/base/mkxl/spac-hor.lmt b/tex/context/base/mkxl/spac-hor.lmt index 7db8d4d6f..d32684448 100644 --- a/tex/context/base/mkxl/spac-hor.lmt +++ b/tex/context/base/mkxl/spac-hor.lmt @@ -36,3 +36,35 @@ interfaces.implement { end end, } + +local nuts = nodes.nuts +local tonut = nodes.tonut +local traverseglue = nuts.traversers.glue +local setwidth = nodes.nuts.setwidth +local indentskip_code = nodes.gluecodes.indentskip +local texgetnest = tex.getnest + +local function lateindent(amount) + local head = tonut(texgetnest("top","head")) + if head then + for n, s in traverseglue, head do + if s == indentskip_code then + setwidth(n,amount or 0) + end + end + end +end + +interfaces.implement { + name = "lateindent", + public = true, + protected = "true", + arguments = "dimension", + actions = lateindent, +} +interfaces.implement { + name = "lateundent", + public = true, + protected = "true", + actions = lateindent, +} diff --git a/tex/context/base/mkxl/spac-hor.mkxl b/tex/context/base/mkxl/spac-hor.mkxl index 897cac3e2..c4c806a40 100644 --- a/tex/context/base/mkxl/spac-hor.mkxl +++ b/tex/context/base/mkxl/spac-hor.mkxl @@ -1268,4 +1268,13 @@ \permanent\def\mplocation#1{\ifcsname\??mplocation#1\endcsname\lastnamedcs\else0\fi} %permanent\def\mplocation#1{\csname\??mplocation\ifcsname\??mplocation#1\endcsname#1\else\v!left\fi\endcsname} +% new: \lateindent \lateundent + +% \parinitleftskip1cm \parindent 1cm \indent test \par +% \parinitleftskip1cm \parindent 1cm \undent test \par +% \parinitleftskip1cm \parindent 1cm \indent \undent test \par +% \parinitleftskip1cm \parindent 1cm \indent \strut \undent test \par +% \parinitleftskip1cm \parindent 1cm \strut \lateindent 2cm test \par +% \parinitleftskip1cm \parindent 1cm \strut \lateindent 2cm test \lateundent \par + \protect \endinput diff --git a/tex/context/base/mkxl/spac-ver.lmt b/tex/context/base/mkxl/spac-ver.lmt index 6258fb261..7884a111c 100644 --- a/tex/context/base/mkxl/spac-ver.lmt +++ b/tex/context/base/mkxl/spac-ver.lmt @@ -2167,6 +2167,7 @@ do else head = glue_data end + -- texsetnest("top","prevdepth",0) texnest[texnest.ptr].prevdepth = 0 -- appending to the list bypasses tex's prevdepth handler end if trace then diff --git a/tex/context/base/mkxl/strc-lst.mklx b/tex/context/base/mkxl/strc-lst.mklx index e7c1978a9..785d566cf 100644 --- a/tex/context/base/mkxl/strc-lst.mklx +++ b/tex/context/base/mkxl/strc-lst.mklx @@ -368,6 +368,9 @@ \permanent\def\structurelistlocation {\clf_listlocation\numexpr\currentlistindex\relax} +\permanent\def\structurelistrawnumber#1% + {\clf_rawlistnumber\numexpr\currentlistindex\relax{#1}} + \permanent\def\structurelistrealpagenumber {\clf_listrealpage{\currentlist}\numexpr\currentlistindex\relax} diff --git a/tex/context/base/mkxl/strc-mat.mkxl b/tex/context/base/mkxl/strc-mat.mkxl index 0aabc64a0..2f200056b 100644 --- a/tex/context/base/mkxl/strc-mat.mkxl +++ b/tex/context/base/mkxl/strc-mat.mkxl @@ -1328,7 +1328,7 @@ % % \startsetups[math:penalties:\v!text] % \shapingpenaltiesmode \zerocount -% \interlinepenalty \plustenthousand +% \interlinepenalty \plustenthousand % \stopsetups \startsetups[math:penalties:\v!page] @@ -1393,6 +1393,48 @@ \displaywidth\hsize \displayindent\zeropoint} +% \def\strc_math_analyze_box +% {\clf_handlemathhang +% stage \plusone +% alignstate \c_strc_math_ragged_status +% box \b_strc_math_display +% distance \formulaparameter\c!textdistance +% \relax +% %\holdingmigrations\zerocount +% \setbox\b_strc_math_display\vbox\bgroup % \vtop +% \ifnum\c_strc_math_split_mode=\c_strc_math_line_mode +% % we can't end up here +% \orelse\ifconditional\c_strc_math_aligned_here +% \ifzeropt\d_strc_math_indent\else +% \hangafter\plusone +% \hangindent\d_strc_math_indent +% \fi +% % \strc_math_setup_align % _inner +% \else +% \strc_math_setup_align +% \fi +% % \strc_math_setup_spacing\formulaparameter +% \strc_math_setup_penalties +% \unhbox\b_strc_math_display +% \egroup +% \clf_handlemathhang +% stage \ifconditional\c_strc_math_aligned_here \plustwo \else \plusthree \fi +% % alignstate \c_strc_math_ragged_status +% % box \b_strc_math_display +% % distance \formulaparameter\c!textdistance +% \relax +% % +% \begingroup +% \edef\v_spac_whitespace_current{\formulaparameter\c!spaceinbetween}% +% \spac_whitespace_setup +% \clf_handlemathhang +% stage \plusfour +% inbetween 1\parskip +% height \strutht +% depth \strutdp +% \relax +% \endgroup} + \def\strc_math_analyze_box {\clf_handlemathhang stage \plusone @@ -1406,14 +1448,20 @@ % we can't end up here \orelse\ifconditional\c_strc_math_aligned_here \ifzeropt\d_strc_math_indent\else - \hangafter\plusone - \hangindent\d_strc_math_indent +\ifnum\c_page_sides_hangafter=\zerocount + \hangafter\plusone + \hangindent\d_strc_math_indent +\else + % this might become the default anyway: + \advance\leftskip\d_strc_math_indent + \hskip-\d_strc_math_indent +\fi \fi % \strc_math_setup_align % _inner \else \strc_math_setup_align \fi -% \strc_math_setup_spacing\formulaparameter + % \strc_math_setup_spacing\formulaparameter \strc_math_setup_penalties \unhbox\b_strc_math_display \egroup diff --git a/tex/context/base/mkxl/trac-vis.lmt b/tex/context/base/mkxl/trac-vis.lmt index ca6b98fc1..73483d47a 100644 --- a/tex/context/base/mkxl/trac-vis.lmt +++ b/tex/context/base/mkxl/trac-vis.lmt @@ -52,6 +52,7 @@ local getnext = nuts.getnext local getboth = nuts.getboth local getwhd = nuts.getwhd local getkern = nuts.getkern +local getpenalty = nuts.getpenalty local getwidth = nuts.getwidth local getdepth = nuts.getdepth local getexpansion = nuts.getexpansion @@ -772,42 +773,6 @@ local ruleduser do end -local ruledmath do - - local mathcodes = nodes.mathcodes - local m_cache = { - beginmath = caches["bmath"], - endmath = caches["emath"], - } - local tags = { - beginmath = "B", - endmath = "E", - } - - ruledmath = function(head,current) - local what = getsubtype(current) - local tag = mathcodes[what] - local skip = getkern(current) + getwidth(current) -- surround - local info = m_cache[tag][skip] - if info then - -- print("hit math") - else - local text, width = sometext(formatters["M:%s"](tag and tags[tag] or what),usedfont,nil,"trace:dr") - local rule = new_rule(skip,-655360/fraction,2*655360/fraction) - local dist = tag == "beginmath" and width or skip - setcolor(rule,"trace:dr") - settransparency(rule,"trace:dr") - setattr(rule,a_layer,l_math) - info = new_hlist(setlink(new_glue(-skip),rule,new_glue(-dist),text)) - setattr(info,a_layer,l_math) - m_cache[tag][skip] = info - end - head, current = insertnodeafter(head,current,copylist(info)) - return head, current - end - -end - local ruleddepth do ruleddepth = function(current,wd,ht,dp) @@ -1461,7 +1426,7 @@ local ruledpenalty do local raisepenalties = false - local getpenalty = nuts.getpenalty + ----- getpenalty = nuts.getpenalty local pre_penalty_code = nodes.penaltycodes.mathprepenalty local post_penalty_code = nodes.penaltycodes.mathpostpenalty @@ -1469,7 +1434,7 @@ local ruledpenalty do ruledpenalty = function(head,current,vertical,subtype) local penalty = getpenalty(current) - local ismath = subtype == pre_penalty_code or subtype == post_penalty_code + local ismath = subtype == pre_penalty_code or subtype == post_penalty_code or subtype == true local cache = (ismath and p_cache_m) or (vertical and p_cache_v) or p_cache_h local info = cache[penalty] if info then @@ -1501,6 +1466,46 @@ local ruledpenalty do end +local ruledmath do + + local mathcodes = nodes.mathcodes + local m_cache = { + beginmath = caches["bmath"], + endmath = caches["emath"], + } + local tags = { + beginmath = "B", + endmath = "E", + } + + ruledmath = function(head,current) + local what = getsubtype(current) + local tag = mathcodes[what] + local skip = getkern(current) + getwidth(current) -- surround + local info = m_cache[tag][skip] + if info then + -- print("hit math") + else + local text, width = sometext(formatters["M:%s"](tag and tags[tag] or what),usedfont,nil,"trace:dr") + local rule = new_rule(skip,-655360/fraction,2*655360/fraction) + local dist = tag == "beginmath" and width or skip + setcolor(rule,"trace:dr") + settransparency(rule,"trace:dr") + setattr(rule,a_layer,l_math) + info = new_hlist(setlink(new_glue(-skip),rule,new_glue(-dist),text)) + setattr(info,a_layer,l_math) + m_cache[tag][skip] = info + end + local saved = current + head, current = insertnodeafter(head,current,copylist(info)) + if getpenalty(saved) ~= 0 then + head, current = ruledpenalty(head,saved,false,true) + end + return head, current + end + +end + do local nodecodes = nodes.nodecodes @@ -1714,6 +1719,7 @@ do head, current = ruleduser(head,current) end elseif id == math_code then + local saved = current if trace_math then head, current = ruledmath(head,current) end diff --git a/tex/context/base/mkxl/typo-par.lmt b/tex/context/base/mkxl/typo-par.lmt index 005d1b32e..271a5894a 100644 --- a/tex/context/base/mkxl/typo-par.lmt +++ b/tex/context/base/mkxl/typo-par.lmt @@ -66,7 +66,7 @@ implement { } function builders.checkparcontext(where) - if top and where == "normal" then + if top and (where == "normal" or where == "vmode") then -- vmode added, needs checking if top == "cycle" then local s = texget("parshape",true) if s then diff --git a/tex/context/fonts/mkiv/cambria-math.lfg b/tex/context/fonts/mkiv/cambria-math.lfg index a76e68e13..a56a1b7d6 100644 --- a/tex/context/fonts/mkiv/cambria-math.lfg +++ b/tex/context/fonts/mkiv/cambria-math.lfg @@ -104,7 +104,29 @@ return { -- bottomleft = 0, -- topright = 0, bottomright = -0.2, - }, + }, + ["0x7D.parts.top"] = { + topright = -0.1, + }, + ["0x7D.parts.bottom"] = { + bottomright = -0.1, + }, + ["0x29.parts.top"] = { + topright = -0.2, + }, + ["0x29.parts.bottom"] = { + bottomright = -0.2, + }, + ["0x221A.parts.top"] = { + topright = 0.2, + }, + ["0x221A.parts.bottom"] = { + bottomright = 0.2, + }, + ["0x221A.variants.*"] = { + topright = 0.2, + bottomright = 0.2, + }, }, }, { diff --git a/tex/context/fonts/mkiv/lucida-opentype-math.lfg b/tex/context/fonts/mkiv/lucida-opentype-math.lfg index f02cc2aea..1ca9e77eb 100644 --- a/tex/context/fonts/mkiv/lucida-opentype-math.lfg +++ b/tex/context/fonts/mkiv/lucida-opentype-math.lfg @@ -40,7 +40,7 @@ return { AccentBaseDepth = 150, RadicalDegreeBottomRaisePercent = 50, RadicalKernAfterDegree = -600, - -- RadicalRuleThickness = 35, -- 40 in font (46 in demi) + -- RadicalRuleThickness = 35, -- 40 in font (46 in demi) DelimiterPercent = 90, DelimiterShortfall = 400, -- DisplayOperatorMinHeight = 1800, -- 1300 in font (only one) diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 23ac64712..fe7b710c3 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 : 2022-07-27 17:51 +-- merge date : 2022-08-01 20:30 do -- begin closure to overcome local limits and interference |