diff options
Diffstat (limited to 'tex')
32 files changed, 299 insertions, 249 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 740b08bdf..9305993eb 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{2021.04.18 18:04} +\newcontextversion{2021.04.20 18:41} %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 49b387e44..309070ba8 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{2021.04.18 18:04} +\edef\contextversion{2021.04.20 18:41} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-nl.mkii b/tex/context/base/mkii/mult-nl.mkii index 7bf09dd57..36d93f259 100644 --- a/tex/context/base/mkii/mult-nl.mkii +++ b/tex/context/base/mkii/mult-nl.mkii @@ -774,6 +774,8 @@ \setinterfaceconstant{deepnumbercommand}{diepnummercommando} \setinterfaceconstant{deeptextcommand}{dieptekstcommando} \setinterfaceconstant{default}{default} +\setinterfaceconstant{defaultheight}{defaulthoogte} +\setinterfaceconstant{defaultwidth}{defaultbreedte} \setinterfaceconstant{define}{definieer} \setinterfaceconstant{delay}{wachttijd} \setinterfaceconstant{depth}{diepte} @@ -1118,6 +1120,7 @@ \setinterfaceconstant{print}{print} \setinterfaceconstant{printable}{printbaar} \setinterfaceconstant{process}{proces} +\setinterfaceconstant{processors}{processors} \setinterfaceconstant{profile}{profile} \setinterfaceconstant{properties}{properties} \setinterfaceconstant{pubsep}{pubsep} diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua index ac31dbfc6..c6c8c915b 100644 --- a/tex/context/base/mkiv/char-ini.lua +++ b/tex/context/base/mkiv/char-ini.lua @@ -769,6 +769,10 @@ local is_punctuation = allocate ( tohash { "pc", "pd", "ps", "pe", "pi", "pf", "po", } ) +local is_hyphenator = allocate ( tohash { + "pd", +} ) + local is_symbol = allocate ( tohash { "sm", "sc", "sk", "so", } ) @@ -781,6 +785,7 @@ characters.is_command = is_command characters.is_spacing = is_spacing characters.is_mark = is_mark characters.is_punctuation = is_punctuation +characters.is_hyphenator = is_hyphenator characters.is_symbol = is_symbol local mti = function(t,k) @@ -797,6 +802,7 @@ setmetatableindex(characters.is_letter, mti) setmetatableindex(characters.is_command, mti) setmetatableindex(characters.is_spacing, mti) setmetatableindex(characters.is_punctuation,mti) +setmetatableindex(characters.is_hyphenator, mti) -- todo: also define callers for the above diff --git a/tex/context/base/mkiv/cldf-ini.lua b/tex/context/base/mkiv/cldf-ini.lua index bb5a058a5..008e0ea3a 100644 --- a/tex/context/base/mkiv/cldf-ini.lua +++ b/tex/context/base/mkiv/cldf-ini.lua @@ -577,6 +577,7 @@ local space = patterns.spacer local spacing = newline * space^0 local content = lpegC((1-spacing)^1) -- texsprint local emptyline = space^0 * newline^2 -- texprint("") + + newline * space^1 local endofline = space^0 * newline * space^0 -- texsprint(" ") local simpleline = endofline * lpegP(-1) -- diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 3fdf4202b..5750b6e86 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{2021.04.18 18:04} +\newcontextversion{2021.04.20 18:41} %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 2ce45e779..86220aa80 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.04.18 18:04} +\edef\contextversion{2021.04.20 18:41} %D Kind of special: diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index 78f864307..eb4918980 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -85,7 +85,7 @@ return { "bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode", "vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode", "discretionarygroupcode", "insertgroupcode", "vadjustgroupcode", "vcentergroupcode", "mathabovegroupcode", - "mathchoicegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", + "mathchoicegroupcode", "alsosimplegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "localboxgroupcode", "splitoffgroupcode", "splitkeepgroupcode", "preamblegroupcode", "alignsetgroupcode", "finrowgroupcode", "discretionarygroupcode", -- @@ -164,7 +164,7 @@ return { "automaticpenaltyhyphenationmodecode", "explicitpenaltyhyphenationmodecode", "permitgluehyphenationmodecode", "permitallhyphenationmodecode", "permitmathreplacehyphenationmodecode", "forcecheckhyphenationmodecode", "lazyligatureshyphenationmodecode", "forcehandlerhyphenationmodecode", - "feedbackcompoundhyphenationmodecode", "ignoreboundshyphenationmodecode", + "feedbackcompoundhyphenationmodecode", "ignoreboundshyphenationmodecode", "collapsehyphenationmodecode", -- "normalizelinecode", "parindentskipcode", "swaphangindentcode", "swapparsshapecode", "breakafterdircode", "removemarginkernscode", "clipwidthcode", "flattendiscretionariescode", @@ -274,7 +274,8 @@ return { -- "groupedcommand", "groupedcommandcs", "triggergroupedcommand", "triggergroupedcommandcs", - "simplegroupedcommand", "pickupgroupedcommand", + "simplegroupedcommand", "simplegroupedcommandcs", + "pickupgroupedcommand", "pickupgroupedcommandcs", -- "usedbaselineskip", "usedlineskip", "usedlineskiplimit", -- diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 9d4db8781..793ac218f 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 5963b5c89..999970419 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/task-ini.lua b/tex/context/base/mkiv/task-ini.lua index 84bec0131..82149ef02 100644 --- a/tex/context/base/mkiv/task-ini.lua +++ b/tex/context/base/mkiv/task-ini.lua @@ -26,6 +26,12 @@ local freezecallbacks = callbacks.freeze ------------("processors", "before", "nodes.properties.attach", nil, "nut", "enabled" ) +if CONTEXTLMTXMODE > 0 then + +appendaction("processors", "normalizers", "builders.kernel.collapsing", nil, "nut", "enabled" ) + +end + appendaction("processors", "normalizers", "typesetters.periodkerns.handler", nil, "nut", "disabled" ) appendaction("processors", "normalizers", "languages.replacements.handler", nil, "nut", "disabled" ) appendaction("processors", "normalizers", "typesetters.wrappers.handler", nil, "nut", "disabled" ) diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 2e0fc46a1..51fa1e383 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{2021.04.18 18:04} +\newcontextversion{2021.04.20 18:41} %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 c36c43a47..1c6546bfc 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{2021.04.18 18:04} +\immutable\edef\contextversion{2021.04.20 18:41} %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 0ef37a054..5739dc15e 100644 --- a/tex/context/base/mkxl/driv-shp.lmt +++ b/tex/context/base/mkxl/driv-shp.lmt @@ -494,6 +494,7 @@ local flush_character do flushcharacter(current,pos_h,pos_v,pos_r,font,char,data,f,e,factor,sx,sy) -- ,naturalwidth,width) end end + return width, height, depth end diff --git a/tex/context/base/mkxl/font-otj.lmt b/tex/context/base/mkxl/font-otj.lmt index b454101ba..8f0f4d33c 100644 --- a/tex/context/base/mkxl/font-otj.lmt +++ b/tex/context/base/mkxl/font-otj.lmt @@ -85,8 +85,8 @@ local tonut = nuts.tonut local getnext = nuts.getnext local getprev = nuts.getprev local getid = nuts.getid -local getfont = nuts.getfont local getchar = nuts.getchar +local getcharspec = nuts.getcharspec local setchar = nuts.setchar ----- getxoffset = nuts.getxoffset ----- getyoffset = nuts.getyoffset @@ -517,8 +517,8 @@ local function dir(n) end local function showchar(n,nested) - local char = getchar(n) - report_injections("%wfont %s, char %U, glyph %c",nested and 2 or 0,getfont(n),char,char) + local char, font = getcharspec(n) + report_injections("%wfont %s, char %U, glyph %c",nested and 2 or 0,font,char,char) end local function show(n,what,nested,symbol) @@ -2426,14 +2426,13 @@ local function injectspaces(head) for n in nextglue, head do local prev, next = getspaceboth(n) - local prevchar = prev and ischar(prev) - local nextchar = next and ischar(next) + local prevchar, prevfont = getcharspec(prev) + local nextchar, nextfont = getcharspec(next) if nextchar then - local font = getfont(next) - local trig = triggers[font] + local trig = triggers[nextfont] if trig then - if lastfont ~= font then - updatefont(font,trig) + if lastfont ~= nextfont then + updatefont(nextfont,trig) end if rightkerns then rightkern = rightkerns[nextchar] @@ -2442,11 +2441,10 @@ local function injectspaces(head) end end if prevchar then - local font = getfont(prev) - local trig = triggers[font] + local trig = triggers[prevfont] if trig then - if lastfont ~= font then - updatefont(font,trig) + if lastfont ~= prevfont then + updatefont(prevfont,trig) end if leftkerns then leftkern = leftkerns[prevchar] diff --git a/tex/context/base/mkxl/font-sty.mklx b/tex/context/base/mkxl/font-sty.mklx index 503356a4a..016d86421 100644 --- a/tex/context/base/mkxl/font-sty.mklx +++ b/tex/context/base/mkxl/font-sty.mklx @@ -231,12 +231,12 @@ \c!method=\v!command] \appendtoks - \letvalue{\??stylecheck\currentstyle}\relax + \letcsname\??stylecheck\currentstyle\endcsname\relax \edef\p_method{\styleparameter\c!method}% \ifx\p_method\v!command - \frozen\instance\setuevalue{\e!start\currentstyle}{\font_styles_apply_start{\currentstyle}}% - \frozen\instance\setuevalue{\e!stop \currentstyle}{\font_styles_apply_stop}% - \frozen\instance\setuevalue {\currentstyle}{\font_styles_apply_grouped{\currentstyle}}% no longer groupedcommand here + \frozen\instance\protected\edefcsname\e!start\currentstyle\endcsname{\font_styles_apply_start{\currentstyle}}% + \frozen\instance\protected\edefcsname\e!stop \currentstyle\endcsname{\font_styles_apply_stop}% + \frozen\instance\protected\edefcsname \currentstyle\endcsname{\font_styles_apply_grouped{\currentstyle}}% no longer groupedcommand here \fi \to \everydefinestyle @@ -248,7 +248,7 @@ {\endgroup} \protected\def\font_styles_apply_grouped#name% assumes that the next is { or \bgroup - {\bgroup + {\bgroup % \beginsimplegroup \def\currentstyle{\font_styles_use_defined{#name}}% \afterassignment\currentstyle \let\nexttoken} @@ -281,20 +281,20 @@ \fi \endcsname{#name}} -\setvalue{\??styleargument1}#name% +\defcsname\??styleargument1\endcsname#name% {\expandafter\triggergroupedcommandcs\begincsname#name\endcsname} -\setvalue{\??styleargument2}#name% +\defcsname\??styleargument2\endcsname#name% {\triggergroupedcommand{\font_styles_use_defined{#name}}} % or {\font_styles_apply_grouped{#name}} -\setvalue{\??styleargument3}#specification% +\defcsname\??styleargument3\endcsname#specification% {\doifelseassignment{#specification}\font_styles_assignment\font_styles_direct{#specification}} -\setvalue{\??styleargument4}#name% +\defcsname\??styleargument4\endcsname#name% {\expandafter\triggergroupedcommandcs\begincsname\??stylehack#name\endcsname} -\setvalue{\??stylehack\s!math}% dirty trick - {\groupedcommand\normalstartimath\normalstopimath} +\defcsname\??stylehack\s!math\endcsname% dirty trick + {\groupedcommandcs\normalstartimath\normalstopimath} % \def\font_styles_assignment#specification{\groupedcommand{\font_styles_use_generic{#specification}}{}} % \def\font_styles_direct #specification{\groupedcommand{\definedfont[#specification]}{}} @@ -322,13 +322,13 @@ {\endgroup \autoinsertnextspace} % will be configurable, maybe also in \definestartstop -\setvalue{\??styleenvironment1}#name% +\defcsname\??styleenvironment1\endcsname#name% {\csname#name\endcsname} -\setvalue{\??styleenvironment2}#name% +\defcsname\??styleenvironment2\endcsname#name% {\font_styles_use_defined{#name}} -\setvalue{\??styleenvironment3}#specification% +\defcsname\??styleenvironment3\endcsname#specification% {\doifelseassignment{#specification}\font_styles_start_assignment\font_styles_start_direct{#specification}} \def\font_styles_start_assignment#specification{\font_styles_use_generic{#specification}} diff --git a/tex/context/base/mkxl/good-mth.lmt b/tex/context/base/mkxl/good-mth.lmt index dc61e953d..578ea8555 100644 --- a/tex/context/base/mkxl/good-mth.lmt +++ b/tex/context/base/mkxl/good-mth.lmt @@ -74,7 +74,7 @@ local function withscriptcode(tfmdata,unicode,data,action) end end -local function finalize(tfmdata,feature,value) +local function finalize(tfmdata,feature,value,...) -- if tfmdata.mathparameters then -- funny, cambria text has this local goodies = tfmdata.goodies if goodies then @@ -122,8 +122,8 @@ local function finalize(tfmdata,feature,value) if xoffset == "llx" then local d = descriptions[unicode] if d then - xoffset = - d.boundingbox[1] * hfactor - character.width = character.width + xoffset + xoffset = - d.boundingbox[1] + character.width = character.width + xoffset * hfactor xoffset = rightcommand[xoffset] else xoffset = nil diff --git a/tex/context/base/mkxl/lang-hup.lmt b/tex/context/base/mkxl/lang-hup.lmt index 6658f0aab..2099f9d1b 100644 --- a/tex/context/base/mkxl/lang-hup.lmt +++ b/tex/context/base/mkxl/lang-hup.lmt @@ -14,6 +14,9 @@ local basename = file.basename local status = status local nodes = nodes +local is_letter = characters.is_letter +local is_hyphenator = characters.is_hyphenator + local specialskips = nodes.specialskipcodes local nodecodes = nodes.nodecodes local disc_code = nodecodes.disc @@ -59,12 +62,18 @@ local function collect(head) local u = characters[id][char].unicode -- we could cache it if type(u) == "table" then for i=1,#u do - -- word[#word+1] = utfchar(u[i]) - w = w + 1 ; word[w] = utfchar(u[i]) + local c = u[i] + if is_letter[c] or is_hyphenator[c] then + -- word[#word+1] = utfchar(c) + w = w + 1 ; word[w] = utfchar(c) + end end else - -- word[#word+1] = utfchar(u or char) - w = w + 1 ; word[w] = utfchar(u or char) + local c = u or char + if is_letter[c] or is_hyphenator[c] then + -- word[#word+1] = utfchar(c) + w = w + 1 ; word[w] = utfchar(c) + end end last = head elseif id == disc_code then @@ -156,17 +165,30 @@ function nodes.handlers.showhyphenation(head) return head end -local initialize ; initialize = function() +local initialize initialize = function() logs.registerfinalactions(function() logs.startfilelogging(report,"hyphenated words") if hash and next(hash) then + local oldname = file.nameonly(tex.jobname) .. "-hyphenated-words-old.txt" + local newname = file.nameonly(tex.jobname) .. "-hyphenated-words-new.txt" + local old = string.splitlines(string.strip(io.loaddata(oldname) or "")) or { } + local hsh = table.tohash(old) + local new = { } for word, count in sortedhash(hash) do report("%4i : %s",count,word) + if not hsh[word] then + new[#new+1] = word + end end + logs.stopfilelogging() + report("old word list : %a",oldname) + report("new word list : %a",newname) + report("to be checked : %a",#new) + io.savedata(newname,concat(new,"\n")) else report("nothing hyphenated") + logs.stopfilelogging() end - logs.stopfilelogging() end) -- statistics.register("hyphenation",function() diff --git a/tex/context/base/mkxl/lang-ini.mkxl b/tex/context/base/mkxl/lang-ini.mkxl index 4c9d11a1a..a8cf1b1fb 100644 --- a/tex/context/base/mkxl/lang-ini.mkxl +++ b/tex/context/base/mkxl/lang-ini.mkxl @@ -436,6 +436,7 @@ + \forcehandlerhyphenationmodecode % kick in the handler (could be an option) + \feedbackcompoundhyphenationmodecode % feedback compound snippets + \ignoreboundshyphenationmodecode % just in case we have hyphens at the edges +% + \collapsehyphenationmodecode % collapse -- and --- \relax \hccode"002D "002D diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt index ce938a5c2..590d69c58 100644 --- a/tex/context/base/mkxl/lpdf-lmt.lmt +++ b/tex/context/base/mkxl/lpdf-lmt.lmt @@ -434,23 +434,54 @@ do -- luatex where we have more widths arrays and these reflect the cheated -- widths (goes wrong elsewhere). +-- local naturalwidths = setmetatableindex(function(t,font) +-- local d = descriptions[font] +-- local c = characters[font] +-- local f = parameters[font].hfactor or parameters[font].factor +-- local v = setmetatableindex(function(t,char) +-- local w +-- local e = d and d[char] +-- if e then +-- w = e.width +-- if w then +-- w = w * f +-- end +-- end +-- if not w then +-- e = c and c[char] +-- if e then +-- w = e.width or 0 +-- end +-- end +-- if not w then +-- w = 0 +-- end +-- t[char] = w +-- return w +-- end) +-- t[font] = v +-- return v +-- end) + + -- when changing this, check math: compact-001.tex (rule width) + local naturalwidths = setmetatableindex(function(t,font) local d = descriptions[font] local c = characters[font] local f = parameters[font].hfactor or parameters[font].factor local v = setmetatableindex(function(t,char) local w - local e = d and d[char] + local e = c and c[char] if e then - w = e.width - if w then - w = w * f - end + w = e.width or 0 end if not w then - e = c and c[char] + e = d and d[char] if e then - w = e.width or 0 + w = e.width + if w then + w = w * f + end end end if not w then @@ -463,42 +494,6 @@ do return v end) - -- when changing this, check math: compact-001.tex (rule width) - --- this goes wrong with adapted widths in (virtual) fonts so we really --- need the above .. --- --- so, what was the failing test? if so, maybe adapt threshold (now 10pt) - --- local xnaturalwidths = setmetatableindex(function(t,font) --- local d = descriptions[font] --- local c = characters[font] --- local f = parameters[font].hfactor or parameters[font].factor --- local v = setmetatableindex(function(t,char) --- local w --- local e = c and c[char] --- if e then --- w = e.width or 0 --- end --- if not w then --- e = d and d[char] --- if e then --- w = e.width --- if w then --- w = w * f --- end --- end --- end --- if not w then --- w = 0 --- end --- t[char] = w --- return w --- end) --- t[font] = v --- return v --- end) - local function setup_fontparameters(font,factor,f,e,sx,sy) local slant = fontparameters.slantfactor or 0 local extend = fontparameters.extendfactor or 1 @@ -520,6 +515,7 @@ do cur_f = f cur_e = e tj_delta = 0 + cw = 0 f_x_scale = 1.0 f_y_scale = 1.0 fs = fontparameters.size * bpfactor @@ -632,12 +628,12 @@ do local move = calc_pdfpos(pos_h,pos_v) - -- if trace_threshold then - -- report( - -- "font %i, char %C, factor %i, naturalwidth %p, move %l, tm %l, hpos %p, delta %p, threshold %p, cw %p", - -- font,char,factor,naturalwidth[char],move,need_tm,pos_h,tj_delta,threshold,cw - -- ) - -- end +if trace_threshold then + report( + "before: font %i, char %C, factor %i, naturalwidth %p, move %l, tm %l, hpos %p, delta %p, threshold %p, cw %p", + font,char,factor,naturalwidth[char],move,need_tm,pos_h,tj_delta,threshold,cw + ) +end if move or need_tm then if not need_tm then @@ -677,6 +673,12 @@ do end end +if trace_threshold then + report( + "after : font %i, char %C, factor %i, naturalwidth %p, move %l, tm %l, hpos %p, delta %p, threshold %p, cw %p", + font,char,factor,naturalwidth[char],move,need_tm,pos_h,tj_delta,threshold,cw + ) +end if mode == "chararray" then begin_charmode() end diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index 9f541c351..041246bca 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -541,16 +541,16 @@ \permanent\protected\def\mathfrak#1{{\mathfraktur #1}} % for AMS compatibility \permanent\protected\def\mathbb #1{{\mathblackboard#1}} % for AMS compatibility -\ifdefined\normaltf \else \permanent\let\normaltf\tf \fi \permanent\protected\def\tf{\ifmmode\mathtf\else\normaltf\fi} -\ifdefined\normalbf \else \permanent\let\normalbf\bf \fi \permanent\protected\def\bf{\ifmmode\mathbf\else\normalbf\fi} -\ifdefined\normalit \else \permanent\let\normalit\it \fi \permanent\protected\def\it{\ifmmode\mathit\else\normalit\fi} -\ifdefined\normalsl \else \permanent\let\normalsl\sl \fi \permanent\protected\def\sl{\ifmmode\mathsl\else\normalsl\fi} -\ifdefined\normalbi \else \permanent\let\normalbi\bi \fi \permanent\protected\def\bi{\ifmmode\mathbi\else\normalbi\fi} -\ifdefined\normalbs \else \permanent\let\normalbs\bs \fi \permanent\protected\def\bs{\ifmmode\mathbs\else\normalbs\fi} +\ifdefined\normaltf \else \permanent\let\normaltf\tf \fi \permanent\protected\def\tf{\ifmmode\expandafter\mathtf\else\expandafter\normaltf\fi} +\ifdefined\normalbf \else \permanent\let\normalbf\bf \fi \permanent\protected\def\bf{\ifmmode\expandafter\mathbf\else\expandafter\normalbf\fi} +\ifdefined\normalit \else \permanent\let\normalit\it \fi \permanent\protected\def\it{\ifmmode\expandafter\mathit\else\expandafter\normalit\fi} +\ifdefined\normalsl \else \permanent\let\normalsl\sl \fi \permanent\protected\def\sl{\ifmmode\expandafter\mathsl\else\expandafter\normalsl\fi} +\ifdefined\normalbi \else \permanent\let\normalbi\bi \fi \permanent\protected\def\bi{\ifmmode\expandafter\mathbi\else\expandafter\normalbi\fi} +\ifdefined\normalbs \else \permanent\let\normalbs\bs \fi \permanent\protected\def\bs{\ifmmode\expandafter\mathbs\else\expandafter\normalbs\fi} -\permanent\protected\def\rm{\ifmmode\mathrm\else\normalrm\fi} -\permanent\protected\def\ss{\ifmmode\mathss\else\normalss\fi} -\permanent\protected\def\tt{\ifmmode\mathtt\else\normaltt\fi} +\permanent\protected\def\rm{\ifmmode\expandafter\mathrm\else\expandafter\normalrm\fi} +\permanent\protected\def\ss{\ifmmode\expandafter\mathss\else\expandafter\normalss\fi} +\permanent\protected\def\tt{\ifmmode\expandafter\mathtt\else\expandafter\normaltt\fi} \ifdefined\mr \else \let\mr\relax \fi % hm ... permanent \ifdefined\mb \else \let\mb\relax \fi % hm ... permanent @@ -641,20 +641,20 @@ \aliased\let\mathnothing\firstofoneunexpanded \aliased\let\mathalpha \firstofoneunexpanded -\setnewconstant\mathordcode \zerocount \letvalue{\??mathcodecommand ord}\mathord -\setnewconstant\mathopcode \plusone \letvalue{\??mathcodecommand op}\mathop -\setnewconstant\mathbincode \plustwo \letvalue{\??mathcodecommand bin}\mathbin -\setnewconstant\mathrelcode \plusthree \letvalue{\??mathcodecommand rel}\mathrel -\setnewconstant\mathopencode \plusfour \letvalue{\??mathcodecommand open}\mathopen -\setnewconstant\mathclosecode \plusfive \letvalue{\??mathcodecommand close}\mathclose -\setnewconstant\mathpunctcode \plussix \letvalue{\??mathcodecommand punct}\mathpunct -\setnewconstant\mathalphacode \plusseven \letvalue{\??mathcodecommand alpha}\mathalpha -\setnewconstant\mathinnercode \zerocount \letvalue{\??mathcodecommand inner}\mathinner -\setnewconstant\mathnothingcode \zerocount \letvalue{\??mathcodecommand nothing}\mathnothing -\setnewconstant\mathlimopcode \plusone \letvalue{\??mathcodecommand limop}\mathlimop -\setnewconstant\mathnolopcode \plusone \letvalue{\??mathcodecommand nolop}\mathnolop -\setnewconstant\mathboxcode \zerocount \letvalue{\??mathcodecommand box}\mathbox -\setnewconstant\mathchoicecode \zerocount %letvalue{\??mathcodecommand choice}\mathnothing +\setnewconstant\mathordcode \zerocount \letcsname\??mathcodecommand ord\endcsname\mathord +\setnewconstant\mathopcode \plusone \letcsname\??mathcodecommand op\endcsname\mathop +\setnewconstant\mathbincode \plustwo \letcsname\??mathcodecommand bin\endcsname\mathbin +\setnewconstant\mathrelcode \plusthree \letcsname\??mathcodecommand rel\endcsname\mathrel +\setnewconstant\mathopencode \plusfour \letcsname\??mathcodecommand open\endcsname\mathopen +\setnewconstant\mathclosecode \plusfive \letcsname\??mathcodecommand close\endcsname\mathclose +\setnewconstant\mathpunctcode \plussix \letcsname\??mathcodecommand punct\endcsname\mathpunct +\setnewconstant\mathalphacode \plusseven \letcsname\??mathcodecommand alpha\endcsname\mathalpha +\setnewconstant\mathinnercode \zerocount \letcsname\??mathcodecommand inner\endcsname\mathinner +\setnewconstant\mathnothingcode \zerocount \letcsname\??mathcodecommand nothing\endcsname\mathnothing +\setnewconstant\mathlimopcode \plusone \letcsname\??mathcodecommand limop\endcsname\mathlimop +\setnewconstant\mathnolopcode \plusone \letcsname\??mathcodecommand nolop\endcsname\mathnolop +\setnewconstant\mathboxcode \zerocount \letcsname\??mathcodecommand box\endcsname\mathbox +\setnewconstant\mathchoicecode \zerocount %letcsname\??mathcodecommand choice\endcsname\mathnothing \setnewconstant\mathaccentcode \pluseight \setnewconstant\mathradicalcode \plusnine @@ -715,9 +715,15 @@ % % now we need this (kind of inefficient): +% \protected\def\math_strut_htdp#1% nasty! +% {\s!height\dimexpr\mathscale#1\fontcharht#1\c_math_strut/\glyphscale\relax +% \s!depth \dimexpr\mathscale#1\fontchardp#1\c_math_strut/\glyphscale\relax} +% +% this overflows so we use this instead: + \protected\def\math_strut_htdp#1% nasty! - {\s!height\dimexpr\mathscale#1\fontcharht#1\c_math_strut/\glyphscale\relax - \s!depth \dimexpr\mathscale#1\fontchardp#1\c_math_strut/\glyphscale\relax} + {\s!height\dimexpr(\fontcharht#1\c_math_strut/\glyphscale)*\mathscale#1\relax + \s!depth \dimexpr(\fontchardp#1\c_math_strut/\glyphscale)*\mathscale#1\relax} \protected\def\math_strut_normal {\vrule @@ -1395,8 +1401,8 @@ \def\math_bidi_enable {\clf_setmathdirection\plusone \relax\c_math_bidi\plusone} \def\math_bidi_disable{\clf_setmathdirection\zerocount\relax\c_math_bidi\attributeunsetvalue} -\letvalue{\??mathbidi\v!yes}\math_bidi_enable -\letvalue{\??mathbidi\v!no }\math_bidi_disable +\letcsname\??mathbidi\v!yes\endcsname\math_bidi_enable +\letcsname\??mathbidi\v!no \endcsname\math_bidi_disable \appendtoks \edef\p_bidi{\mathematicsparameter\c!bidi}% still needed ? @@ -1425,9 +1431,9 @@ \newconstant\c_math_greek_attribute -\setvalue{\??mathgreek\v!none }{1} -\setvalue{\??mathgreek\v!normal}{2} -\setvalue{\??mathgreek\v!italic}{3} +\defcsname\??mathgreek\v!none \endcsname{1} +\defcsname\??mathgreek\v!normal\endcsname{2} +\defcsname\??mathgreek\v!italic\endcsname{3} % \appendtoks % \edef\p_sygreek{\mathematicsparameter\s!sygreek}% @@ -1481,11 +1487,11 @@ \setnewconstant\c_math_collapsing_attribute\attributeunsetvalue -\letvalue{\??mathcollapsing 1}\plusone % specials -\letvalue{\??mathcollapsing 2}\plustwo % specials + mathlist -\letvalue{\??mathcollapsing 3}\plusthree % mathlist + specials -\letvalue{\??mathcollapsing\v!none }\attributeunsetvalue -\letvalue{\??mathcollapsing\v!reset}\attributeunsetvalue +\letcsname\??mathcollapsing 1\endcsname\plusone % specials +\letcsname\??mathcollapsing 2\endcsname\plustwo % specials + mathlist +\letcsname\??mathcollapsing 3\endcsname\plusthree % mathlist + specials +\letcsname\??mathcollapsing\v!none \endcsname\attributeunsetvalue +\letcsname\??mathcollapsing\v!reset\endcsname\attributeunsetvalue \def\math_collapsing_initialize {\ifnum\c_math_collapsing_attribute=\attributeunsetvalue \else @@ -1517,12 +1523,12 @@ \setnewconstant\c_math_italics_attribute\attributeunsetvalue -\letvalue{\??mathitalics 1}\plusone % fontitalics -\letvalue{\??mathitalics 2}\plustwo % fontdata -\letvalue{\??mathitalics 3}\plusthree % quad based -\letvalue{\??mathitalics 4}\plusfour % combination of 1 and 3 -\letvalue{\??mathitalics\v!none }\attributeunsetvalue -\letvalue{\??mathitalics\v!reset}\attributeunsetvalue +\letcsname\??mathitalics 1\endcsname\plusone % fontitalics +\letcsname\??mathitalics 2\endcsname\plustwo % fontdata +\letcsname\??mathitalics 3\endcsname\plusthree % quad based +\letcsname\??mathitalics 4\endcsname\plusfour % combination of 1 and 3 +\letcsname\??mathitalics\v!none \endcsname\attributeunsetvalue +\letcsname\??mathitalics\v!reset\endcsname\attributeunsetvalue \def\math_italics_initialize {\ifnum\c_math_italics_attribute=\attributeunsetvalue \else @@ -1706,43 +1712,43 @@ \catcode\c_math_period \activecatcode \catcode\c_math_semicolon\activecatcode - \setgvalue{\??mathautopunctuation\v!no}% + \gdefcsname\??mathautopunctuation\v!no\endcsname {\let,\math_punctuation_nop_comma \let.\math_punctuation_nop_period \let;\math_punctuation_nop_semicolon} % more efficient list: % - % \setgvalue{\??mathautopunctuation\v!no}% + % \gdefcsname\??mathautopunctuation\v!no\endcsname % {\Umathcode\c_math_period\mathordcode \zerocount\c_math_period % \Umathcode\c_math_comma \mathpunctcode\zerocount\c_math_comma } - \setgvalue{\??mathautopunctuation\v!yes}% + \gdefcsname\??mathautopunctuation\v!yes\endcsname {\let,\math_punctuation_yes_comma \let.\math_punctuation_yes_period \let;\math_punctuation_nop_semicolon} - \setgvalue{\??mathautopunctuation\v!all}% + \gdefcsname\??mathautopunctuation\v!all\endcsname {\let,\math_punctuation_all_comma \let.\math_punctuation_all_period \let;\math_punctuation_nop_semicolon} - \setgvalue{\??mathautopunctuation comma}% + \gdefcsname\??mathautopunctuation comma\endcsname {\let,\math_punctuation_yes_comma \let.\math_punctuation_yes_period \let;\math_punctuation_nop_semicolon} - \setgvalue{\??mathautopunctuation\v!yes\string,semicolon}% + \gdefcsname\??mathautopunctuation\v!yes\string,semicolon\endcsname {\let,\math_punctuation_yes_comma \let.\math_punctuation_yes_period \let;\math_punctuation_yes_semicolon} - \setgvalue{\??mathautopunctuation comma\string,semicolon}% + \gdefcsname\??mathautopunctuation comma\string,semicolon\endcsname {\let,\math_punctuation_yes_comma \let.\math_punctuation_yes_period \let;\math_punctuation_yes_semicolon} - \setgvalue{\??mathautopunctuation\v!all\string,semicolon}% + \gdefcsname\??mathautopunctuation\v!all\string,semicolon\endcsname {\let,\math_punctuation_all_comma \let.\math_punctuation_all_period \let;\math_punctuation_all_semicolon} @@ -2322,18 +2328,18 @@ \def\math_style_collect#1% {\csname\??mathstylecommand#1\endcsname} -\setvalue{\??mathstylecommand\s!display }{\c_math_styles_state_style \plusone} -\setvalue{\??mathstylecommand\s!text }{\c_math_styles_state_style \plustwo} -\setvalue{\??mathstylecommand\s!script }{\c_math_styles_state_style \plusthree} -\setvalue{\??mathstylecommand\s!scriptscript}{\c_math_styles_state_style \plusfour} +\defcsname\??mathstylecommand\s!display \endcsname{\c_math_styles_state_style \plusone} +\defcsname\??mathstylecommand\s!text \endcsname{\c_math_styles_state_style \plustwo} +\defcsname\??mathstylecommand\s!script \endcsname{\c_math_styles_state_style \plusthree} +\defcsname\??mathstylecommand\s!scriptscript\endcsname{\c_math_styles_state_style \plusfour} -\setvalue{\??mathstylecommand\s!uncramped }{\c_math_styles_state_cramped\plusone} -\setvalue{\??mathstylecommand\s!cramped }{\c_math_styles_state_cramped\plustwo} -\setvalue{\??mathstylecommand\v!normal }{\c_math_styles_state_cramped\plusone} -\setvalue{\??mathstylecommand\v!packed }{\c_math_styles_state_cramped\plustwo} +\defcsname\??mathstylecommand\s!uncramped \endcsname{\c_math_styles_state_cramped\plusone} +\defcsname\??mathstylecommand\s!cramped \endcsname{\c_math_styles_state_cramped\plustwo} +\defcsname\??mathstylecommand\v!normal \endcsname{\c_math_styles_state_cramped\plusone} +\defcsname\??mathstylecommand\v!packed \endcsname{\c_math_styles_state_cramped\plustwo} -\setvalue{\??mathstylecommand\v!small }{\c_math_styles_state_size \plusone} -\setvalue{\??mathstylecommand\v!big }{\c_math_styles_state_size \plustwo} +\defcsname\??mathstylecommand\v!small \endcsname{\c_math_styles_state_size \plusone} +\defcsname\??mathstylecommand\v!big \endcsname{\c_math_styles_state_size \plustwo} \permanent\protected\def\setupmathstyle[#1]% {\edef\m_math_style_asked{#1}% @@ -2386,8 +2392,8 @@ \gletcsname\??mathstylecache\m_math_style_asked\normalexpanded{\endcsname\math_style_add_to_cache_choice}% \csname\??mathstylecache\m_math_style_asked\endcsname} -\letvalue{\??mathstyle \??mathstyle }\math_style_set_mathstyle_mathstyle % still needed? -\letvalue{\??mathstylecache\??mathstylecache}\math_style_set_mathstyle_mathstylecache % still needed? +\letcsname\??mathstyle \??mathstyle \endcsname\math_style_set_mathstyle_mathstyle % still needed? +\letcsname\??mathstylecache\??mathstylecache\endcsname\math_style_set_mathstyle_mathstylecache % still needed? %D \startbuffer %D $x\begingroup\setupmathstyle[script]x\endgroup x$ diff --git a/tex/context/base/mkxl/math-noa.lmt b/tex/context/base/mkxl/math-noa.lmt index 118ab1826..a4858363b 100644 --- a/tex/context/base/mkxl/math-noa.lmt +++ b/tex/context/base/mkxl/math-noa.lmt @@ -116,6 +116,7 @@ local getsubtype = nuts.getsubtype local getchar = nuts.getchar local getfont = nuts.getfont local getfam = nuts.getfam +local getcharspec = nuts.getcharspec local getattr = nuts.getattr local getattrs = nuts.getattrs local getlist = nuts.getlist @@ -152,6 +153,7 @@ local fonthashes = fonts.hashes local fontdata = fonthashes.identifiers local fontcharacters = fonthashes.characters local fontitalics = fonthashes.italics +local fontparameters = fonthashes.parameters local variables = interfaces.variables local texsetattribute = tex.setattribute @@ -245,9 +247,7 @@ local function process(start,what,n,parent) if id == noad_code then report_processing("%w%S, class %a",n*2,nutstring(start),noadcodes[getsubtype(start)]) elseif id == mathchar_code then - local char = getchar(start) - local font = getfont(start) - local fam = getfam(start) + local char, font, fam = getcharspec(start) report_processing("%w%S, family %a, font %a, char %a, shape %c",n*2,nutstring(start),fam,font,char,char) else report_processing("%w%S",n*2,nutstring(start)) @@ -593,15 +593,16 @@ do -- no bold delimiters in unicode a = a - 3 end + local fam = getfontoffamily(a) local char = getfield(pointer,"small_char") - local okay = fontcharacters[getfontoffamily(a)][char] + local okay = fontcharacters[fam][char] if okay then setfield(pointer,"small_fam",a) elseif a > 2 then setfield(pointer,"small_fam",a-3) end local char = getfield(pointer,"large_char") - local okay = fontcharacters[getfontoffamily(a)][char] + local okay = fontcharacters[fam][char] if okay then setfield(pointer,"large_fam",a) elseif a > 2 then @@ -672,8 +673,7 @@ do end local function checked(pointer) - local char = getchar(pointer) - local font = getfont(pointer) + local char, font = getcharspec(pointer) local data = fontcharacters[font] if not data[char] then local specials = characters.data[char].specials @@ -702,8 +702,7 @@ do -- local g, a = getattrs(pointer,a_mathgreek,a_mathalphabet) -- if not a then a = 0 end -- if not g then g = 0 end - local char = getchar(pointer) - local font = getfont(pointer) + local char, font, fam = getcharspec(pointer) local characters = fontcharacters[font] if a > 0 or g > 0 then if a > 0 then @@ -758,7 +757,6 @@ do end end if not characters[char] then - local fam = getfam(pointer) local fnt = getfontoffamily(fam,1) setchar(pointer,errorchar(font,char)) if font ~= fnt then @@ -804,12 +802,11 @@ do render[mathchar_code] = function(pointer) local attr = getattr(pointer,a_mathrendering) if attr and attr > 0 then - local char = getchar(pointer) + local char, font = getcharspec(pointer) local renderset = rendersets[attr] if renderset then local newchar = renderset[char] if newchar then - local font = getfont(pointer) local characters = fontcharacters[font] if characters and characters[newchar] then setchar(pointer,newchar) @@ -851,29 +848,25 @@ do local size = a % 100 setattr(pointer,a_mathsize,0) local delimiter = getfield(pointer,"delimiter") - local chr = getchar(delimiter) - if chr > 0 then - local fam = getfam(delimiter) - local id = getfontoffamily(fam) - if id > 0 then - local data = fontdata[id] - local char = mathematics.big(data,chr,size,method) - local ht = getheight(pointer) - local dp = getdepth(pointer) - if ht == 1 or dp == 1 then -- 1 scaled point is a signal - local chardata = data.characters[char] - if ht == 1 then - setheight(pointer,chardata.height) - end - if dp == 1 then - setdepth(pointer,chardata.depth) - end + local chr, fnt, fam = getcharspec(delimiter) + if chr > 0 and fnt > 0 then + local data = fontdata[fnt] + local char = mathematics.big(data,chr,size,method) + local ht = getheight(pointer) + local dp = getdepth(pointer) + if ht == 1 or dp == 1 then -- 1 scaled point is a signal + local chardata = data.characters[char] + if ht == 1 then + setheight(pointer,chardata.height) end - if trace_fences then - report_fences("replacing %C by %C using method %a and size %a",chr,char,method,size) + if dp == 1 then + setdepth(pointer,chardata.depth) end - setchar(delimiter,char) end + if trace_fences then + report_fences("replacing %C by %C using method %a and size %a",chr,char,method,size) + end + setchar(delimiter,char) end end end @@ -899,8 +892,7 @@ do local f = new_fence() -- todo: attr if char then local sym = getnucleus(char) - local chr = getchar(sym) - local fam = getfam(sym) + local chr, fnt, fam = getcharspec(sym) if chr == dummyfencechar then chr = 0 end @@ -1515,7 +1507,7 @@ do if trace_alternates then local what = attributes[r] report_alternates("alternate %a, value %a, replacing glyph %U by glyph %U", - tostring(what.feature),tostring(what.value),getchar(pointer),alt) + tostring(what.feature),tostring(what.value),char,alt) end setchar(pointer,alt) break @@ -1639,8 +1631,7 @@ do italics[mathchar_code] = function(pointer,what,n,parent) local method = getattr(pointer,a_mathitalics) if method and method > 0 and method < 100 then - local char = getchar(pointer) - local font = getfont(pointer) + local char, font = getcharspec(pointer) local correction, visual = getcorrection(method,font,char) if correction and correction ~= 0 then local next_noad = getnext(parent) @@ -1767,21 +1758,20 @@ do kernpairs[mathchar_code] = function(pointer,what,n,parent) if getattr(pointer,a_kernpairs) == 1 then - local font = getfont(pointer) - local list = hash[font] + local first, firstfont = getcharspec(pointer) + local list = hash[firstfont] if list then - local first = getchar(pointer) local found = list[first] if found then local next = getnext(parent) if next and getid(next) == noad_code then pointer = getnucleus(next) if pointer then - if getfont(pointer) == font then - local second = getchar(pointer) - local kern = found[second] + local second, secondfont = getcharspec(pointer) + if secondfont == firstfont then + local kern = found[second] if kern then - kern = kern * fonts.hashes.parameters[font].hfactor + kern = kern * fontparameters[firstfont].hfactor if trace_kernpairs then report_kernpairs("adding %p kerning between %C and %C",kern,first,second) end diff --git a/tex/context/base/mkxl/math-tag.lmt b/tex/context/base/mkxl/math-tag.lmt index eb58b5450..0d02d271c 100644 --- a/tex/context/base/mkxl/math-tag.lmt +++ b/tex/context/base/mkxl/math-tag.lmt @@ -8,8 +8,10 @@ if not modules then modules = { } end modules ['math-tag'] = { -- todo: have a local list with local tags that then get appended -- todo: use tex.getmathcodes (no table) - --- use lpeg matchers +-- todo: add more spacing details + check text stuff for latest additions +-- todo: some more font related cleanup + adaption to new scaling +-- todo: tracing +-- todo: maybe use lpeg matchers local find, match = string.find, string.match local insert, remove, concat = table.insert, table.remove, table.concat @@ -20,18 +22,15 @@ local nodes = nodes local nuts = nodes.nuts local tonut = nuts.tonut -local getnext = nuts.getnext -local getid = nuts.getid local getchar = nuts.getchar -local getfont = nuts.getfont +local getcharspec = nuts.getcharspec +local getdata = nuts.getdata local getlist = nuts.getlist local getfield = nuts.getfield local getdisc = nuts.getdisc -local getsubtype = nuts.getsubtype local getattr = nuts.getattr local getattrlist = nuts.getattrlist local setattr = nuts.setattr ------ getcomponents = nuts.getcomponents -- not really needed local getwidth = nuts.getwidth local getnucleus = nuts.getnucleus @@ -161,17 +160,8 @@ local fencesstack = { } -- glyph nodes and such can happen in under and over stuff --- local function getunicode(n) -- instead of getchar --- local char = getchar(n) --- -- local font = getfontoffamily(getfield(n,"fam")) --- local font = getfont(n) --- local data = fontcharacters[font][char] --- return data.unicode or char --- end - local function getunicode(n) -- instead of getchar - -- local char, font = isglyph(n) -- no, we have a mathchar - local char, font = getchar(n), getfont(n) + local char, font = getcharspec(n) local data = fontcharacters[font][char] return data.unicode or char -- can be a table but unlikely for math characters end @@ -207,15 +197,13 @@ end process = function(start) -- we cannot use the processor as we have no finalizers (yet) local mtexttag = nil - while start do - local id = getid(start) --- showtag(start,id,true) + for start, id, subtype in nextnode, start do -- current if id == glyph_code or id == disc_code then if not mtexttag then mtexttag = start_tagged("mtext") end setattr(start,a_tagged,mtexttag) - elseif mtexttag and id == kern_code and (getsubtype(start) == fontkern_code or getsubtype(start) == italickern_code) then -- italickern + elseif mtexttag and id == kern_code and subtype == fontkern_code or subtype == italickern_code then -- italickern setattr(start,a_tagged,mtexttag) else if mtexttag then @@ -455,8 +443,7 @@ process = function(start) -- we cannot use the processor as we have no finalizer process(scriptscript) end elseif id == fence_code then - local subtype = getsubtype(start) - local delim = getfield(start,"delimiter") + local delim = getfield(start,"delimiter") if subtype == leftfence_code then -- left local properties = { } @@ -530,7 +517,6 @@ process = function(start) -- we cannot use the processor as we have no finalizer stop_tagged() end elseif id == accent_code then - local subtype = getsubtype(start) local accent = getfield(start,"accent") local bot_accent = getfield(start,"bot_accent") if bot_accent then @@ -578,7 +564,6 @@ process = function(start) -- we cannot use the processor as we have no finalizer end end -- showtag(start,id,false) - start = getnext(start) end if mtexttag then stop_tagged() diff --git a/tex/context/base/mkxl/node-nut.lmt b/tex/context/base/mkxl/node-nut.lmt index b9af5551d..9bd7b1889 100644 --- a/tex/context/base/mkxl/node-nut.lmt +++ b/tex/context/base/mkxl/node-nut.lmt @@ -45,6 +45,7 @@ local d_getboth = direct.getboth local nuts = { check_discretionaries = direct.check_discretionaries, + collapsing = direct.collapsing, copy = direct.copy, copy_list = direct.copy_list, copy_node = direct.copy, @@ -75,6 +76,7 @@ local nuts = { getbox = direct.getbox, getboxglue = direct.getglue, getchar = direct.getchar, + getcharspec = direct.getcharspec, getcomponents = direct.getcomponents, getdata = direct.getdata, getdepth = direct.getdepth, diff --git a/tex/context/base/mkxl/node-tex.lmt b/tex/context/base/mkxl/node-tex.lmt index aae084740..b856d5d4b 100644 --- a/tex/context/base/mkxl/node-tex.lmt +++ b/tex/context/base/mkxl/node-tex.lmt @@ -14,12 +14,13 @@ local nuts = nodes.nuts local hyphenate = language.hyphenate +local collapsing = nuts.collapsing local hyphenating = nuts.hyphenating local ligaturing = nuts.ligaturing local kerning = nuts.kerning -function kernel.hyphenation(head) - return (hyphenate(head)) -- nodes ! +function kernel.collapsing(head) + return (collapsing(head)) -- for now we don't pass the three character numbers end function kernel.hyphenating(head) @@ -34,6 +35,7 @@ function kernel.kerning(head) return (kerning(head)) end +callbacks.register('collapse' , false, "normal collapsing routine, called elsewhere") callbacks.register('hyphenate' , false, "normal hyphenation routine, called elsewhere") callbacks.register('ligaturing', false, "normal ligaturing routine, called elsewhere") callbacks.register('kerning' , false, "normal kerning routine, called elsewhere") diff --git a/tex/context/base/mkxl/spac-par.mkxl b/tex/context/base/mkxl/spac-par.mkxl index 134a60e2a..66b08633d 100644 --- a/tex/context/base/mkxl/spac-par.mkxl +++ b/tex/context/base/mkxl/spac-par.mkxl @@ -143,7 +143,7 @@ \ifcsname\??parwrapbefore#3\endcsname \else \spac_paragraph_install_pair#1#2{#3}% \fi - #1\csname\??parwrapbefore#3\endcsname{\advance\csname\??parwrapcount#3\endcsname\plusone\relax + #1\csname\??parwrapbefore#3\endcsname{\global\advance\csname\??parwrapcount#3\endcsname\plusone\relax % global, see (!) \clf_setparwrapper{#3}#4}% #2\csname\??parwrapafter #3\endcsname{#5}% \clf_newparwrapper{#3}% @@ -153,7 +153,7 @@ {\ifcsname\??parwrapcount#3\endcsname \else \spac_paragraph_install_count{#3}% \fi - \csname\??parwrapcount#3\endcsname\plusone + \global\csname\??parwrapcount#3\endcsname\plusone % global, see (!) #4\wrapuppar{#5}} \protected\def\spac_register_par_wrapper @@ -168,7 +168,7 @@ \csname\??eparwrap\the\currentgrouplevel\endcsname\emptytoks} \permanent\protected\def\unregisterparwrapper#1% - {\csname\??parwrapcount#1\endcsname\zerocount + {\global\csname\??parwrapcount#1\endcsname\zerocount % global, see (!) \ifcsname\??parwrapbefore#1\endcsname \lastnamedcs\emptytoks \csname\??parwrapafter#1\endcsname\emptytoks @@ -200,6 +200,16 @@ %appendtoks\spac_paragraph_wrap \to\everypar %appendtoks\spac_paragraph_freeze \to\everypar +% (!) testcase for global setting of count +% +% \starttext +% \hsize3cm +% Aaa\wordright{Aaa}\par +% \sc{Bbb\wordright{Bbb}}\par +% {\sc Ccc\wordright{Ccc}}\par +% \sc{Ddd}\wordright{\sc{Ddd}}\par +% \stoptext + \setparagraphfreezing \appendtoks\enforced\let\spac_paragraph_wrap\relax\to\everyforgetall diff --git a/tex/context/base/mkxl/syst-aux.mkxl b/tex/context/base/mkxl/syst-aux.mkxl index e4cecfe58..aa521130d 100644 --- a/tex/context/base/mkxl/syst-aux.mkxl +++ b/tex/context/base/mkxl/syst-aux.mkxl @@ -3987,18 +3987,18 @@ \m_syst_helpers_handle_group_b} \def\syst_helpers_handle_group_nop_b - {\bgroup + {\beginsimplegroup \aftergroup\m_syst_helpers_handle_group_a \aftergroup\egroup \m_syst_helpers_handle_group_b} \protected\def\syst_helpers_handle_group_normal - {\bgroup + {\beginsimplegroup \afterassignment\m_syst_helpers_handle_group_normal_before \let\next=} \def\m_syst_helpers_handle_group_normal_before - {\bgroup + {\beginsimplegroup \m_syst_helpers_handle_group_b \bgroup \aftergroup\m_syst_helpers_handle_group_a @@ -4006,26 +4006,26 @@ \aftergroup\egroup} \protected\def\syst_helpers_handle_group_simple% no inner group (so no kerning interference) - {\bgroup + {\beginsimplegroup \afterassignment\m_syst_helpers_handle_group_simple_before \let\next=} \def\m_syst_helpers_handle_group_simple_before - {\bgroup + {\beginsimplegroup \aftergroup\m_syst_helpers_handle_group_simple_after \m_syst_helpers_handle_group_b} \def\m_syst_helpers_handle_group_simple_after {\m_syst_helpers_handle_group_a - \egroup}% + \egroup} \protected\def\syst_helpers_handle_group_pickup% no inner group (so no kerning interference) - {\bgroup + {\beginsimplegroup \afterassignment\m_syst_helpers_handle_group_pickup_before \let\next=} \def\m_syst_helpers_handle_group_pickup_before - {\bgroup + {\beginsimplegroup \aftergroup\m_syst_helpers_handle_group_a \aftergroup\egroup \aftergroup\m_syst_helpers_handle_group_p @@ -4036,20 +4036,20 @@ \begingroup \aftergroup\endgroup \else - \bgroup + \beginsimplegroup \aftergroup\egroup \fi \m_syst_helpers_handle_group_b} \protected\def\syst_helpers_handle_group_normal_x - {\bgroup + {\beginsimplegroup \afterassignment\m_syst_helpers_handle_group_normal_before_x \let\next=} \def\m_syst_helpers_handle_group_normal_before_x - {\bgroup - \m_syst_helpers_handle_group_b - \bgroup + {\beginsimplegroup + \expandafter\m_syst_helpers_handle_group_b + \ifmmode\beginsimplegroup\else\bgroup\fi % is this save enough? also the other ones? \aftergroup\egroup \aftergroup\egroup} @@ -4079,12 +4079,23 @@ \def\m_syst_helpers_handle_group_a{#2}% \futureexpandis\bgroup\syst_helpers_handle_group_simple\syst_helpers_handle_group_nop} +\permanent\protected\def\simplegroupedcommandcs#1#2% + {\let\m_syst_helpers_handle_group_b#1% + \let\m_syst_helpers_handle_group_a#2% + \futureexpandis\bgroup\syst_helpers_handle_group_simple\syst_helpers_handle_group_nop} + \permanent\protected\def\pickupgroupedcommand#1#2#3% {\def\m_syst_helpers_handle_group_b{#1}% \def\m_syst_helpers_handle_group_a{#2}% \def\m_syst_helpers_handle_group_p{#3}% \futureexpandis\bgroup\syst_helpers_handle_group_pickup\syst_helpers_handle_group_nop} +\permanent\protected\def\pickupgroupedcommandcs#1#2#3% + {\let\m_syst_helpers_handle_group_b#1% + \let\m_syst_helpers_handle_group_a#2% + \let\m_syst_helpers_handle_group_p#3% + \futureexpandis\bgroup\syst_helpers_handle_group_pickup\syst_helpers_handle_group_nop} + \permanent\protected\def\triggergroupedcommand#1% {\def\m_syst_helpers_handle_group_b{#1}% \futureexpandis\bgroup\syst_helpers_handle_group_normal_x\syst_helpers_handle_group_nop_x} diff --git a/tex/context/base/mkxl/syst-ini.mkxl b/tex/context/base/mkxl/syst-ini.mkxl index fb85531b7..be2571a3d 100644 --- a/tex/context/base/mkxl/syst-ini.mkxl +++ b/tex/context/base/mkxl/syst-ini.mkxl @@ -634,8 +634,8 @@ \permanent\protected\def\defUmathtopaccent #1#2#3#4{\global\immutable\protected\def#1{\Umathaccent "#2 "#3 "#4 }} \permanent\protected\def\defUmathbotaccent #1#2#3#4{\global\immutable\protected\def#1{\Umathbotaccent "#2 "#3 "#4 }} -\permanent\protected\def\defUdelimiterover #1#2#3#4{\global\immutable\protected\def#1{\Udelimiterover "#2 "#3 }} -\permanent\protected\def\defUdelimiterunder #1#2#3#4{\global\immutable\protected\def#1{\Udelimiterunder "#2 "#3 }} +\permanent\protected\def\defUdelimiterover #1#2#3#4{\writestatus{!}{\string#1}\global\immutable\protected\def#1{\Udelimiterover "#2 "#3 }} +\permanent\protected\def\defUdelimiterunder #1#2#3#4{\writestatus{!}{\string#1}\global\immutable\protected\def#1{\Udelimiterunder "#2 "#3 }} \permanent\protected\def\defUdelimiter #1#2#3#4{\global\immutable\protected\def#1{\Udelimiter "#2 "#3 "#4 }} \permanent\protected\def\defUradical #1#2#3{\global\immutable\protected\def#1{\Uradical "#2 "#3 }} \permanent\protected\def\defUroot #1#2#3{\global\immutable\protected\def#1{\Uroot "#2 "#3 }} diff --git a/tex/context/base/mkxl/typo-cap.lmt b/tex/context/base/mkxl/typo-cap.lmt index 67acb2535..3f53b65e0 100644 --- a/tex/context/base/mkxl/typo-cap.lmt +++ b/tex/context/base/mkxl/typo-cap.lmt @@ -24,7 +24,7 @@ local nuts = nodes.nuts local getnext = nuts.getnext local getid = nuts.getid local getattr = nuts.getattr -local getfont = nuts.getfont +local getcharspec = nuts.getcharspec local getsubtype = nuts.getsubtype local getchar = nuts.getchar local isglyph = nuts.isglyph @@ -261,8 +261,8 @@ end local function randomized(start,attr,lastfont,n,count,where,first) local used = first or start - local char = getchar(used) - local font = getfont(used) + local char, + font = getcharfont(used) local tfm = fontchar[font] lastfont[n] = false local kind = categories[char] diff --git a/tex/context/fonts/mkiv/pagella-math.lfg b/tex/context/fonts/mkiv/pagella-math.lfg index 0e8ac1f70..3908112d0 100644 --- a/tex/context/fonts/mkiv/pagella-math.lfg +++ b/tex/context/fonts/mkiv/pagella-math.lfg @@ -1,6 +1,6 @@ local kern_V = { bottomright = { { kern = -200 } } } local kern_W = { bottomright = { { kern = -100 } } } --- local kern_f = { bottomright = { { kern = -100 } } } +----- kern_f = { bottomright = { { kern = -100 } } } local offset_f = { xoffset = "llx" } -- Beware of updates in ssty slots! diff --git a/tex/context/interface/mkii/keys-nl.xml b/tex/context/interface/mkii/keys-nl.xml index 87fe9ba15..9797b8d1f 100644 --- a/tex/context/interface/mkii/keys-nl.xml +++ b/tex/context/interface/mkii/keys-nl.xml @@ -780,6 +780,8 @@ <cd:constant name='deepnumbercommand' value='diepnummercommando'/> <cd:constant name='deeptextcommand' value='dieptekstcommando'/> <cd:constant name='default' value='default'/> + <cd:constant name='defaultheight' value='defaulthoogte'/> + <cd:constant name='defaultwidth' value='defaultbreedte'/> <cd:constant name='define' value='definieer'/> <cd:constant name='delay' value='wachttijd'/> <cd:constant name='depth' value='diepte'/> @@ -1124,6 +1126,7 @@ <cd:constant name='print' value='print'/> <cd:constant name='printable' value='printbaar'/> <cd:constant name='process' value='proces'/> + <cd:constant name='processors' value='processors'/> <cd:constant name='profile' value='profile'/> <cd:constant name='properties' value='properties'/> <cd:constant name='pubsep' value='pubsep'/> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 168eb7418..c3e8104ea 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 : 2021-04-18 18:04 +-- merge date : 2021-04-20 18:41 do -- begin closure to overcome local limits and interference |