From 9111ac6d97d7931a2a9bbdad69f5c54de4172318 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 30 May 2023 23:06:58 +0200 Subject: 2023-05-30 22:20:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/status-files.pdf | Bin 24639 -> 24677 bytes tex/context/base/mkiv/status-lua.pdf | Bin 270724 -> 270812 bytes tex/context/base/mkxl/cont-new.mkxl | 2 +- tex/context/base/mkxl/context.mkxl | 2 +- tex/context/base/mkxl/toks-aux.lmt | 25 ++++--- tex/context/base/mkxl/trac-vis.lmt | 80 ++++++++++++++++----- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 11 files changed, 83 insertions(+), 36 deletions(-) (limited to 'tex') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 34c07df79..736c98195 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{2023.05.29 14:13} +\newcontextversion{2023.05.30 22:18} %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 c37563b0c..b31c3e50c 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{2023.05.29 14:13} +\edef\contextversion{2023.05.30 22:18} %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 a3e2d79a8..b2edbb806 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{2023.05.29 14:13} +\newcontextversion{2023.05.30 22:18} %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 df5e61459..621dbf2fc 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{2023.05.29 14:13} +\edef\contextversion{2023.05.30 22:18} %D Kind of special: diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index e18daff1b..ea03d6007 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index 02cdf5c3a..efa1d8a31 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 8267f0fa8..fd8513ae7 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{2023.05.29 14:13} +\newcontextversion{2023.05.30 22:18} %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 9712e28c1..261dd6e8d 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{2023.05.29 14:13} +\immutable\edef\contextversion{2023.05.30 22:18} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/toks-aux.lmt b/tex/context/base/mkxl/toks-aux.lmt index d2b47ba27..15aae08f2 100644 --- a/tex/context/base/mkxl/toks-aux.lmt +++ b/tex/context/base/mkxl/toks-aux.lmt @@ -178,30 +178,35 @@ local function getthem(getter,post) return utilities.storage.allocate(table.swapped(codes,codes)) end +-- Not all of these make sense at the tex end (can't be set). + +tex.glyphoptioncodes = getthem(tex.getglyphoptionvalues, "glyphoptioncode") tex.discoptioncodes = getthem(tex.getdiscoptionvalues, "discoptioncode") +tex.glueoptioncodes = getthem(tex.getglueoptionvalues ) +tex.mathoptioncodes = getthem(tex.getmathoptionvalues ) +tex.penaltyoptioncodes = getthem(tex.getpenaltyoptionvalues ) tex.flagcodes = getthem(tex.getflagvalues, "flagcode" ) tex.frozenparcodes = getthem(tex.getfrozenparvalues, "frozenparcode") -tex.glyphoptioncodes = getthem(tex.getglyphoptionvalues, "glyphoptioncode") tex.groupcodes = getthem(tex.getgroupvalues, "groupcode") tex.hyphenationcodes = getthem(tex.gethyphenationvalues, "hyphenationcode") tex.mathcontrolcodes = getthem(tex.getmathcontrolvalues, "mathcontrolcode") ---.mathflattencodes = getthem(tex.getmathflattenvalues, "mathflattencode") -tex.noadoptioncodes = getthem(tex.getnoadoptionvalues ) -- only at lua end +tex.noadoptioncodes = getthem(tex.getnoadoptionvalues ) tex.normalizelinecodes = getthem(tex.getnormalizelinevalues, "normalizecode") -- we keep the short name tex.normalizeparcodes = getthem(tex.getnormalizeparvalues, "normalizeparcode") tex.automigrationcodes = getthem(tex.getautomigrationvalues, "automigrationcode") tex.parcontextcodes = getthem(tex.getparcontextvalues, "parcontextcode") -tex.textcontrolcodes = getthem(tex.gettextcontrolvalues ) -- only at lua end -tex.fitnesscodes = getthem(tex.getfitnessvalues ) -- only at lua end +tex.textcontrolcodes = getthem(tex.gettextcontrolvalues ) +tex.fitnesscodes = getthem(tex.getfitnessvalues ) tex.listanchorcodes = getthem(tex.getlistanchorvalues, "listanchorcode") tex.listsigncodes = getthem(tex.getlistsignvalues, "listsigncode") tex.classoptioncodes = getthem(tex.getmathclassoptionvalues, "classoptioncode") ----.alignmentcontextcodes = getthem(tex.getalignmentcontextvalues ) -- only at lua end -tex.specialmathclasscodes = getthem(tex.getspecialmathclassvalues ) -- idem -tex.directioncodes = getthem(tex.getdirectionvalues ) -- idem -tex.fillcodes = getthem(tex.getfillvalues ) -- idem -tex.mathparametercodes = getthem(tex.getmathparametervalues ) -- idem -tex.breakcodes = getthem(tex.getbreakcontextvalues ) -- idem +---.alignmentcontextcodes = getthem(tex.getalignmentcontextvalues ) +tex.specialmathclasscodes = getthem(tex.getspecialmathclassvalues ) +tex.directioncodes = getthem(tex.getdirectionvalues ) +tex.fillcodes = getthem(tex.getfillvalues ) +tex.mathparametercodes = getthem(tex.getmathparametervalues ) +tex.breakcodes = getthem(tex.getbreakcontextvalues ) function tex.stringtocodesbitmap(str,codes) local bitmap = 0 diff --git a/tex/context/base/mkxl/trac-vis.lmt b/tex/context/base/mkxl/trac-vis.lmt index b97a8d7d1..1309f38f1 100644 --- a/tex/context/base/mkxl/trac-vis.lmt +++ b/tex/context/base/mkxl/trac-vis.lmt @@ -1564,9 +1564,14 @@ end local ruledpenalty do - local p_cache_v = caches["vpenalty"] - local p_cache_h = caches["hpenalty"] - local p_cache_m = caches["mpenalty"] + local cachehash = { + ["MP=%s"] = caches["MP=%s"], + ["MP>%s"] = caches["MP>%s"], + ["MP<%s"] = caches["MP<%s"], + ["MP:%s"] = caches["MP:%s"], + ["VP:%s"] = caches["VP:%s"], + ["HP:%s"] = caches["HP:%s"], + } local raisepenalties = false @@ -1576,15 +1581,41 @@ local ruledpenalty do directives.register("visualizers.raisepenalties",function(v) raisepenalties = v end) + local getoptions = nuts.getoptions + + local mathforward = tex.penaltyoptioncodes.mathforward + local mathbackward = tex.penaltyoptioncodes.mathbackward + ruledpenalty = function(head,current,vertical,subtype) local penalty = getpenalty(current) 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] + local amount + if ismath then + local options = getoptions(current) + local forward = (options & mathforward) ~= 0 + local backward = (options & mathbackward) ~= 0 + if forward then + if backward then + amount = "MP=%s" + else + amount = "MP>%s" + end + elseif backward then + amount = "MP<%s" + else + amount = "MP:%s" + end + elseif vertical then + amount = "VP:%s" + else + amount = "HP:%s" + end + local cache = cachehash[amount] + local info = cache[penalty] if info then -- print("penalty hit") else - local amount = formatters["%s:%s"]((ismath and "MP") or (vertical and "VP") or "HP",penalty) + amount = formatters[amount](penalty) if ismath then info = sometext(amount,l_penalty,"trace:s") elseif penalty > 0 then @@ -1613,32 +1644,43 @@ end local ruledmath do local mathcodes = nodes.mathcodes - local m_cache = { - beginmath = caches["bmath"], - endmath = caches["emath"], - } local tags = { - beginmath = "B", - endmath = "E", + [true] = { + math = { "SM:?", caches["SM:?"] }, + beginmath = { "SM:B", caches["SM:B"] }, + endmath = { "SM:E", caches["SM:E"] }, + }, + [false] = { + math = { "M:?", caches["M:?"] }, + beginmath = { "M:B", caches["M:B"] }, + endmath = { "M:E", caches["M:E"] }, + }, } + local getoptions = nuts.getoptions + local shortmath = tex.mathoptioncodes.shortmath + 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] + local what = getsubtype(current) + local mtag = mathcodes[what] + local skip = getkern(current) + getwidth(current) -- surround + local short = (getoptions(current) & shortmath) ~= 0 + local htag = tags[short][mtag or "math"] or tags[false].math + local ttag = htag[1] + local cache = htag[2] + local info = cache[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 text, width = sometext(ttag,usedfont,nil,"trace:dr") local rule = new_rule(skip,-655360/fraction,2*655360/fraction) - local dist = tag == "beginmath" and width or skip + local dist = mtag == "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 + cache[skip] = info end local saved = current head, current = insertnodeafter(head,current,copylist(info)) diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index a0cde4d80..28412da6d 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 : 2023-05-29 14:13 +-- merge date : 2023-05-30 22:18 do -- begin closure to overcome local limits and interference -- cgit v1.2.3