diff options
Diffstat (limited to 'tex/context/base/mkxl')
57 files changed, 2446 insertions, 1154 deletions
diff --git a/tex/context/base/mkxl/anch-pgr.lmt b/tex/context/base/mkxl/anch-pgr.lmt index 5ef6ecacb..575d4e906 100644 --- a/tex/context/base/mkxl/anch-pgr.lmt +++ b/tex/context/base/mkxl/anch-pgr.lmt @@ -34,6 +34,7 @@ local context = context local implement = interfaces.implement local texgetcount = tex.getcount +local texiscount = tex.iscount local getmacro = tokens.getters.macro local expandasvalue = tex.expandasvalue @@ -61,6 +62,8 @@ local f_pair = formatters["(%p,%p)"] local f_path = formatters["%--t--cycle"] local f_pair_i = formatters["(%r,%r)"] -- rounded +local c_realpageno = texiscount("realpageno") + graphics = graphics or { } local backgrounds = { } graphics.backgrounds = backgrounds @@ -254,7 +257,7 @@ end nodes.handlers.textbackgrounds = function(head,where,parent) -- we have hlistdir and local dir -- todo enable action in register index = index + 1 - realpage = texgetcount("realpageno") + realpage = texgetcount(c_realpageno) return processranges(a_textbackground,flush,head,parent) end @@ -1214,7 +1217,7 @@ backgrounds.fetchmultipar = fetchmultipar local function getwhatever(action) local tags = scanmpstring() local anchor = scanmpstring() - local page = texgetcount("realpageno") + local page = texgetcount(c_realpageno) if tags == "self" then tags = expandasvalue(string_value,"mpcategoryparameter",true,"self") elseif type(tags) == "string" then diff --git a/tex/context/base/mkxl/anch-pos.lmt b/tex/context/base/mkxl/anch-pos.lmt index fc668f699..6488a2fd7 100644 --- a/tex/context/base/mkxl/anch-pos.lmt +++ b/tex/context/base/mkxl/anch-pos.lmt @@ -65,6 +65,8 @@ local tex = tex local texgetdimen = tex.getdimen local texgetcount = tex.getcount local texgetinteger = tex.getintegervalue or tex.getcount +local texiscount = tex.iscount +local texisdimen = tex.isdimen local texsetcount = tex.setcount local texget = tex.get local texsp = tex.sp @@ -133,15 +135,19 @@ local default = { -- not r and paragraphs etc } } -local f_b_tag = formatters["b:%s"] -local f_e_tag = formatters["e:%s"] -local f_p_tag = formatters["p:%s"] ------ f_w_tag = formatters["w:%s"] +local f_b_tag = formatters["b:%s"] +local f_e_tag = formatters["e:%s"] +local f_p_tag = formatters["p:%s"] +----- f_w_tag = formatters["w:%s"] -local f_region = formatters["region:%s"] +local f_region = formatters["region:%s"] -local f_tag_three = formatters["%s:%s:%s"] -local f_tag_two = formatters["%s:%s"] +local f_tag_three = formatters["%s:%s:%s"] +local f_tag_two = formatters["%s:%s"] + +local c_realpageno = texiscount("realpageno") +local d_strutht = texisdimen("strutht") +local d_strutdp = texisdimen("strutdp") -- Because positions are set with a delay we cannot yet make the tree -- so that -- is a finalizer step. But, we already have a dual split. @@ -902,7 +908,7 @@ local function enhance(data) data.y = y ~= 0 and y or nil end if data.p == true then - data.p = texgetcount("realpageno") -- we should use a variable set in otr + data.p = texgetcount(c_realpageno) -- we should use a variable set in otr end if data.c == true then data.c = column @@ -1075,7 +1081,7 @@ local function b_region(specification) local x, y = getpos() last.x = x ~= 0 and x or nil last.y = y ~= 0 and y or nil - last.p = texgetcount("realpageno") + last.p = texgetcount(c_realpageno) insert(regions,tag) -- todo: fast stack region = tag end @@ -1117,7 +1123,7 @@ local function setregionbox(n,tag,index,k,lo,ro,to,bo,column) -- kind -- these auto regions (comning from framed). Too messy and the split in the -- setter is fast enough. tobesaved[tag] = { - -- p = texgetcount("realpageno"), -- we copy them + -- p = texgetcount(c_realpageno), -- we copy them x = 0, y = 0, w = w ~= 0 and w or nil, @@ -1191,6 +1197,8 @@ end do + local c_anch_positions_paragraph = texiscount("c_anch_positions_paragraph") + local nofparagraphs = 0 local function enhancepar_1(data) @@ -1205,7 +1213,7 @@ do if y ~= 0 then data.y = y end - data.p = texgetcount("realpageno") -- we should use a variable set in otr + data.p = texgetcount(c_realpageno) -- we should use a variable set in otr if column then data.c = column end @@ -1253,7 +1261,7 @@ do if y ~= 0 then data.y = y end - data.p = texgetcount("realpageno") -- we should use a variable set in otr + data.p = texgetcount(c_realpageno) if column then data.c = column end @@ -1268,10 +1276,10 @@ do name = "parpos", actions = function() nofparagraphs = nofparagraphs + 1 - texsetcount("global","c_anch_positions_paragraph",nofparagraphs) + texsetcount("global",c_anch_positions_paragraph,nofparagraphs) local name = f_p_tag(nofparagraphs) - local h = texgetdimen("strutht") - local d = texgetdimen("strutdp") + local h = texgetdimen(d_strutht) + local d = texgetdimen(d_strutdp) -- local top = texgetnest("top","head") local nxt = top.next @@ -1429,8 +1437,8 @@ do public = true, protected = true, actions = function(name) - local h = texgetdimen("strutht") - local d = texgetdimen("strutdp") + local h = texgetdimen(d_strutht) + local d = texgetdimen(d_strutdp) local spec = { p = true, c = column, @@ -1453,8 +1461,8 @@ do public = true, protected = true, actions = function(name,kind) - local h = texgetdimen("strutht") - local d = texgetdimen("strutdp") + local h = texgetdimen(d_strutht) + local d = texgetdimen(d_strutdp) local spec = { k = kind, p = true, @@ -1476,7 +1484,7 @@ end function jobpositions.getreserved(tag,n) if tag == v_column then - local fulltag = f_tag_three(tag,texgetcount("realpageno"),n or 1) + local fulltag = f_tag_three(tag,texgetcount(c_realpageno),n or 1) local data = collected[fulltag] if data then return data, fulltag @@ -1484,7 +1492,7 @@ function jobpositions.getreserved(tag,n) tag = v_text end if tag == v_text then - local fulltag = f_tag_two(tag,texgetcount("realpageno")) + local fulltag = f_tag_two(tag,texgetcount(c_realpageno)) return collected[fulltag] or false, fulltag end return collected[tag] or false, tag @@ -2257,7 +2265,7 @@ implement { public = true, protected = true, actions = function(list) - doifelse(onsamepage(list,tostring(texgetcount("realpageno")))) + doifelse(onsamepage(list,tostring(texgetcount(c_realpageno)))) end } diff --git a/tex/context/base/mkxl/anch-pos.mkxl b/tex/context/base/mkxl/anch-pos.mkxl index fef8e54f6..f8891eb33 100644 --- a/tex/context/base/mkxl/anch-pos.mkxl +++ b/tex/context/base/mkxl/anch-pos.mkxl @@ -17,10 +17,19 @@ %D early, but starting in 2012 more dramatic changes started to happen, especially %D in relation to background graphics. It will probably take some time to settle. -\registerctxluafile{anch-pos}{autosuffix} - \unprotect +\newcount\c_anch_column % will be delegated to lua +\newcount\c_anch_text % will be delegated to lua +\newcount\c_anch_free +\newtoks \t_anch_positions_tracers +\newcount\c_anch_positions_paragraph + +\newbox \b_anch_position +\newif \ifpositioning % sort of public + +\registerctxluafile{anch-pos}{autosuffix} + %D The first application of positional information was embedded graphics. Since we %D are interacting with text, it made sense to take the current line height and %D depth into account too. This is why we have position macros for simple positions @@ -43,8 +52,8 @@ % \dosetpositionstrut #1 % defined at lua end % \dosetpositionstrutkind #1#2 % defined at lua end -\newbox\b_anch_position -\newif \ifpositioning % sort of public +% see top: \newbox\b_anch_position +% see top: \newif \ifpositioning % sort of public \mutable\let\currentposition \empty \mutable\let\currentpositionaction\empty @@ -282,8 +291,8 @@ \permanent\def\textanchor {text:\the\realpageno} \permanent\def\regionanchor{region:0} -\newcount\c_anch_column % will be delegated to lua -\newcount\c_anch_text % will be delegated to lua +% see top: \newcount\c_anch_column % will be delegated to lua +% see top: \newcount\c_anch_text % will be delegated to lua % beware we need to pass \somethingexpanded or { } @@ -336,7 +345,7 @@ \expandafter\gobblesixarguments \fi} -\newcount\c_anch_free +% see top: \newcount\c_anch_free \protected\def\anch_mark_tagged_box_free_yes#1#2#3#4#5#6% only needed when positions {\global\advance\c_anch_free\plusone % could be done at the lua end @@ -408,8 +417,8 @@ %D can keep track of them. This mechanism is activated automatically based on %D information collected in the previous pass. -\newtoks \t_anch_positions_tracers -\newcount\c_anch_positions_paragraph +% see top: \newtoks \t_anch_positions_tracers +% see top: \newcount\c_anch_positions_paragraph \permanent\protected\def\tracepositions {\the\t_anch_positions_tracers} diff --git a/tex/context/base/mkxl/buff-ini.lmt b/tex/context/base/mkxl/buff-ini.lmt index 985c834ff..1d4722531 100644 --- a/tex/context/base/mkxl/buff-ini.lmt +++ b/tex/context/base/mkxl/buff-ini.lmt @@ -573,7 +573,7 @@ local function savebuffer(list,name,prefix,option,directory) -- name is optional if directory ~= "" and dir.makedirs(directory) then name = file.join(directory,name) end - io.savedata(name,replacenewlines(content),"\n",option == v_append) + savedata(name,replacenewlines(content),"\n",option == v_append) end implement { diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 5fb6ae5b6..e8f8e5e2e 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.09.16 14:39} +\newcontextversion{2022.10.14 10:13} %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 cd7075d5e..bf5dd9a07 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.09.16 14:39} +\immutable\edef\contextversion{2022.10.14 10:13} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/core-env.lmt b/tex/context/base/mkxl/core-env.lmt index 486beeec4..f5b382f12 100644 --- a/tex/context/base/mkxl/core-env.lmt +++ b/tex/context/base/mkxl/core-env.lmt @@ -135,30 +135,30 @@ end) tex.isdefined = isdefined -function tex.isdimen(name) - local hit = cache[name] - return hit.command == dimencode and hit.index or true -end - -function tex.iscount(name) - local hit = cache[name] - return hit.command == countcode and hit.index or true -end - -function tex.istoken(name) - local hit = cache[name] - return hit.command == tokencode and hit.index or true -end - -function tex.isskip(name) - local hit = cache[name] - return hit.command == skipcode and hit.index or true -end - -function tex.ismuskip(name) - local hit = cache[name] - return hit.command == muskipcode and hit.index or true -end +-- function tex.isdimen(name) +-- local hit = cache[name] +-- return hit.command == dimencode and hit.index or true +-- end +-- +-- function tex.iscount(name) +-- local hit = cache[name] +-- return hit.command == countcode and hit.index or true +-- end +-- +-- function tex.istoken(name) +-- local hit = cache[name] +-- return hit.command == tokencode and hit.index or true +-- end +-- +-- function tex.isskip(name) +-- local hit = cache[name] +-- return hit.command == skipcode and hit.index or true +-- end +-- +-- function tex.ismuskip(name) +-- local hit = cache[name] +-- return hit.command == muskipcode and hit.index or true +-- end function tex.type(name) return types[cache[name].command] or "macro" diff --git a/tex/context/base/mkxl/core-uti.lmt b/tex/context/base/mkxl/core-uti.lmt index 2266119de..d533de5f3 100644 --- a/tex/context/base/mkxl/core-uti.lmt +++ b/tex/context/base/mkxl/core-uti.lmt @@ -448,8 +448,8 @@ end) function statistics.formatruntime(runtime) if not environment.initex then -- else error when testing as not counters yet -- stoptiming(statistics) -- to be sure - local shipped = texgetcount('nofshipouts') - local pages = texgetcount('realpageno') + local shipped = texgetcount("nofshipouts") + local pages = texgetcount("realpageno") if pages > shipped then pages = shipped end diff --git a/tex/context/base/mkxl/font-con.lmt b/tex/context/base/mkxl/font-con.lmt index ddaf8afb1..319d5fe48 100644 --- a/tex/context/base/mkxl/font-con.lmt +++ b/tex/context/base/mkxl/font-con.lmt @@ -533,12 +533,6 @@ function constructors.scale(tfmdata,specification) targetparameters.scriptscale = scriptscale targetparameters.scriptscriptscale = scriptscriptscale - -- todo: maybe retrofit to font-con.lua - - local oldmath = properties.oldmath - targetproperties.oldmath = oldmath - target.oldmath = oldmath - local mathcontrol = properties.mathcontrol targetproperties.mathcontrol = mathcontrol target.mathcontrol = mathcontrol @@ -706,10 +700,26 @@ function constructors.scale(tfmdata,specification) if vi and vi ~= 0 then chr.vitalic = vi*hdelta end - local va = character.accent +-- local va = character.accent +-- if va and not chr.topanchor then +-- chr.topanchor = va +-- end + local va = character.topanchor + if va then + chr.topanchor = va*vdelta + end + va = character.bottomanchor if va then - chr.topaccent = va*vdelta + chr.bottomanchor = va*vdelta end + local vo = character.topovershoot + if vo then + chr.topovershoot = vo*hdelta + end + -- vo = character.bottomovershoot + -- if vo then + -- chr.bottomovershoot = vo*hdelta + -- end if stackmath then -- not ok yet local mk = character.mathkerns if mk then @@ -755,6 +765,10 @@ function constructors.scale(tfmdata,specification) if sm then chr.smaller = sm end + local mi = character.mirror + if mi then + chr.mirror = mi + end local fa = character.flataccent if fa then chr.flataccent = fa diff --git a/tex/context/base/mkxl/font-ctx.lmt b/tex/context/base/mkxl/font-ctx.lmt index 585547cbf..75572e089 100644 --- a/tex/context/base/mkxl/font-ctx.lmt +++ b/tex/context/base/mkxl/font-ctx.lmt @@ -1221,23 +1221,23 @@ do -- else too many locals "integer", }, actions = function ( - global, -- \ifx\fontclass\empty\s!false\else\s!true\fi - cs, -- {#csname}% - str, -- \somefontfile - size, -- \d_font_scaled_font_size - inheritancemode, -- \c_font_feature_inheritance_mode - classfeatures, -- \m_font_class_features - fontfeatures, -- \m_font_features - classfallbacks, -- \m_font_class_fallbacks - fontfallbacks, -- \m_font_fallbacks - mathsize, -- \fontface - textsize, -- \d_font_scaled_text_face - classgoodies, -- \m_font_class_goodies - goodies, -- \m_font_goodies - classdesignsize, -- \m_font_class_designsize - fontdesignsize, -- \m_font_designsize - scaledfontmode -- \scaledfontmode - ) + global, -- \ifx\fontclass\empty\s!false\else\s!true\fi + cs, -- {#csname}% + str, -- \somefontfile + size, -- \d_font_scaled_font_size + inheritancemode, -- \c_font_feature_inheritance_mode + classfeatures, -- \m_font_class_features + fontfeatures, -- \m_font_features + classfallbacks, -- \m_font_class_fallbacks + fontfallbacks, -- \m_font_fallbacks + mathsize, -- \fontface + textsize, -- \d_font_scaled_text_face + classgoodies, -- \m_font_class_goodies + goodies, -- \m_font_goodies + classdesignsize, -- \m_font_class_designsize + fontdesignsize, -- \m_font_designsize + scaledfontmode -- \scaledfontmode + ) if trace_defining then report_defining("start stage two: %s, size %s, features %a & %a, mode %a",str,size,classfeatures,fontfeatures,inheritancemode) end @@ -1397,7 +1397,7 @@ do -- else too many locals busy = false mathematics.finishfallbacks(tfmdata,specification,fallbacks) tfmdata.original = specification.specification -constructors.beforepassingfonttotex(tfmdata) + constructors.beforepassingfonttotex(tfmdata) local id = definefont(tfmdata,properties.id) csnames[id] = specification.cs properties.id = id -- already set diff --git a/tex/context/base/mkxl/font-imp-effects.lmt b/tex/context/base/mkxl/font-imp-effects.lmt index 38d86498a..8dce81087 100644 --- a/tex/context/base/mkxl/font-imp-effects.lmt +++ b/tex/context/base/mkxl/font-imp-effects.lmt @@ -238,11 +238,12 @@ local function manipulateeffect(tfmdata) parameters.hshift = hshift parameters.vshift = vshift for unicode, character in next, characters do - local oldwidth = character.width - local oldheight = character.height - local olddepth = character.depth - local olditalic = character.italic - local oldtopaccent = character.topaccent + local oldwidth = character.width + local oldheight = character.height + local olddepth = character.depth + local olditalic = character.italic + local oldtopanchor = character.topanchor + local oldbottomanchor = character.bottomanchor if oldwidth and oldwidth > 0 then character.width = oldwidth + wdelta end @@ -252,13 +253,16 @@ local function manipulateeffect(tfmdata) if olddepth and olddepth > 0 then character.depth = olddepth + ddelta end - if olditalic or oldtopaccent then + if olditalic or oldtopaccent or oldbottomaccent then local factor = character.width / oldwidth if olditalic and olditalic > 0 then character.italic = olditalic * factor end - if oldtopaccent and oldtopaccent > 0 then - character.topaccent = oldtopaccent * factor + if oldtopanchor and oldtopanchor > 0 then + character.topanchor = oldtopanchor * factor + end + if oldbottomanchor and oldbottomanchor > 0 then + character.bottomanchor = oldbottomanchor * factor end end end diff --git a/tex/context/base/mkxl/font-imp-math.lmt b/tex/context/base/mkxl/font-imp-math.lmt index 9811cb7c8..04fe5c04c 100644 --- a/tex/context/base/mkxl/font-imp-math.lmt +++ b/tex/context/base/mkxl/font-imp-math.lmt @@ -225,30 +225,6 @@ registerotffeature { -- end local function initialize(tfmdata,value) - if value then - local rawdata = tfmdata.shared.rawdata - local rawresources = rawdata and rawdata.resources - local mathconstants = rawresources.mathconstants - if mathconstants then - tfmdata.properties.oldmath = true - end - end -end - -registerotffeature { - name = "oldmath", - description = "deal with fake opentype fonts", - -- manipulators = { - -- base = manipulate, - -- node = manipulate, - -- }, - initializers = { - base = initialize, - node = initialize, - } -} - -local function initialize(tfmdata,value) if type(value) == "string" then local rawdata = tfmdata.shared.rawdata local rawresources = rawdata and rawdata.resources @@ -318,46 +294,45 @@ registerotffeature { -- is. So the quick and dirty solution is: -- -- add copies in private slots --- use a pseudo feature to acess those +-- use a pseudo feature to access those -- and optionally afterwards replace the original slots -local coverage = { } - -local function initialize(tfmdata,value) - if value then - if not next(coverage) then - for k, char in next, mathematics.alphabets.sr.tf.lcletters do - coverage[char] = 0xFE800 + k - end - for k, char in next, mathematics.alphabets.sr.tf.ucletters do - coverage[char] = 0xFE800 + k - end - fonts.handlers.otf.addfeature { - name = "savemathscripts", - type = "substitution", - data = coverage, - } - end - local characters = tfmdata.characters - local descriptions = tfmdata.descriptions - for char, private in next, coverage do - local data = characters[char] - if data and not characters[private] then - -- otherwise we need a virtual - characters [private] = copytable(data) - descriptions[private] = copytable(descriptions[char]) - end - end - end -end - -registerotffeature { - name = "copymathscripts", - description = "copy math script", - prepend = 1, - initializers = { - base = initialize, - node = initialize, - } -} - +-- local coverage = { } +-- +-- local function initialize(tfmdata,value) +-- if value then +-- if not next(coverage) then +-- for k, char in next, mathematics.alphabets.sr.tf.lcletters do +-- coverage[char] = 0xFE800 + k +-- end +-- for k, char in next, mathematics.alphabets.sr.tf.ucletters do +-- coverage[char] = 0xFE800 + k +-- end +-- fonts.handlers.otf.addfeature { +-- name = "savemathscripts", +-- type = "substitution", +-- data = coverage, +-- } +-- end +-- local characters = tfmdata.characters +-- local descriptions = tfmdata.descriptions +-- for char, private in next, coverage do +-- local data = characters[char] +-- if data and not characters[private] then +-- -- otherwise we need a virtual +-- characters [private] = copytable(data) +-- descriptions[private] = copytable(descriptions[char]) +-- end +-- end +-- end +-- end +-- +-- registerotffeature { +-- name = "copymathscripts", +-- description = "copy math script", +-- prepend = 1, +-- initializers = { +-- base = initialize, +-- node = initialize, +-- } +-- } diff --git a/tex/context/base/mkxl/font-ini.mklx b/tex/context/base/mkxl/font-ini.mklx index 473f37da2..67663b7db 100644 --- a/tex/context/base/mkxl/font-ini.mklx +++ b/tex/context/base/mkxl/font-ini.mklx @@ -657,8 +657,8 @@ % 4:x{\definedfont[Serif sa 4]x}\par % 5:x{\definedfont[Serif sa 5]x}\par -\permanent\def\safontscale{\number\dimexpr\v_font_size_absolute\relax} -\permanent\def\mofontscale{\number\dimexpr\font_basics_set_mapped_fontsize\v_font_size_absolute\relax} +% \permanent\def\safontscale{\number\dimexpr\v_font_size_absolute\relax} +% \permanent\def\mofontscale{\number\dimexpr\font_basics_set_mapped_fontsize\v_font_size_absolute\relax} \mutable\let\somefontname \s!unknown \mutable\let\somefontspec \s!unknown @@ -991,7 +991,7 @@ \newif\ifskipfontcharacteristics \skipfontcharacteristicstrue -\tracingfonts\plussix % <id: name @ size> +% \tracingfonts\plussix % <id: name @ size> %D When fontclasses are used, we define the font global, since namespaces are %D used. Otherwise we parse the specs each time. diff --git a/tex/context/base/mkxl/font-mat.mklx b/tex/context/base/mkxl/font-mat.mklx index 20925157b..0f3a2a222 100644 --- a/tex/context/base/mkxl/font-mat.mklx +++ b/tex/context/base/mkxl/font-mat.mklx @@ -15,6 +15,26 @@ \unprotect +%D The original (\MKIV) approach to bidi is that we have two extra families for +%D regular, bold and pseudobold: +%D +%D regular normal=0 l2r=1 r2l=2 +%D bold normal=3 l2r=4 r2l=5 +%D pseudobold normal=6 l2r=7 r2l=8 +%D +%D where l2r is just an alias. Because we're now using the mirror lookup (like +%D we do a smaller lookup) in the engine we not just have: +%D +%D regular normal=0 +%D bold normal=3 +%D pseudobold normal=6 +%D +%D And when one can wonder if pseudobold is needed (just bolden); we can then +%D actually go down to only two families. It is one of these cases when it hurts +%D to throw away a nice old mechanism that worked quite well so here we keep it +%D commented. For what it's worth: this variant switches a bit faster too and +%D produces less logging but I doubt if anyone will notice that. + %D Be nice: \ifdefined\??fontinstanceready \else \installcorenamespace{fontinstanceready} \fi @@ -55,16 +75,16 @@ % todo: \c_font_fam_mr \aliased\let\c_font_fam_mr \zerocount % math regular -\aliased\let\c_font_fam_mr_lr\plusone % math regular l2r -\aliased\let\c_font_fam_mr_rl\plustwo % math regular r2l +%aliased\let\c_font_fam_mr_lr\plusone % math regular l2r +%aliased\let\c_font_fam_mr_rl\plustwo % math regular r2l \aliased\let\c_font_fam_mb \plusthree % math bold -\aliased\let\c_font_fam_mb_lr\plusfour % math bold l2r -\aliased\let\c_font_fam_mb_rl\plusfive % math bold r2l +%aliased\let\c_font_fam_mb_lr\plusfour % math bold l2r +%aliased\let\c_font_fam_mb_rl\plusfive % math bold r2l \definesystemattribute[mathfamily][public] -\newconditional\c_font_bidirectional_mathstrategy % can be default, not that much overhead: \settrue\c_font_bidirectional_mathstrategy +%newconditional\c_font_bidirectional_mathstrategy % can be default, not that much overhead: \settrue\c_font_bidirectional_mathstrategy \newconditional\c_font_complete_bold_mathstrategy \settrue\c_font_complete_bold_mathstrategy % \frozen ... @@ -106,9 +126,12 @@ \mutable\let\fontfamily\relax % for now public but it is a helper +\newconditional\c_math_last_family_set + \def\font_helpers_set_math_family_indeed_normal#mrtag#family% \fontface etc are also used later on {\let\savedfontbody\fontbody \let\fontfamily#family% + \settrue\c_math_last_family_set % the order is important as we depend on known id's when completing fonts % enabling is needed when we have fallbacks which spoils the families \let\mathsizesuffix\mathscriptscriptsuffix\let\fontface\!!plusthree @@ -139,6 +162,7 @@ \def\font_helpers_set_math_family_indeed_compact#mrtag#family% \fontface etc are also used later on {\let\savedfontbody\fontbody \let\fontfamily#family% + \settrue\c_math_last_family_set \font_helpers_set_math_family_set_scales_compact % the order is important as we depend on known id's when completing fonts % enabling is needed when we have fallbacks which spoils the families @@ -163,6 +187,7 @@ \let\defaultfontclass\fontclass % else truefontname falls back on the wrong one \let\savedfontbody\fontbody \let\fontfamily#familytag% + \settrue\c_math_last_family_set \font_helpers_set_math_family_set_scales_normal \let\mathsizesuffix\mathscriptscriptsuffix\let\fontface\!!plusthree \font_helpers_set_math_family_bold_a\scriptscriptfont#mbfam#mrfam% defines @@ -183,6 +208,7 @@ \let\defaultfontclass\fontclass % else truefontname falls back on the wrong one \let\savedfontbody\fontbody \let\fontfamily#familytag% + \settrue\c_math_last_family_set \let\mathsizesuffix\mathtextsuffix \let\fontface\!!plusone \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% defines \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% enables @@ -309,77 +335,114 @@ \let\m_font_fallbacks\empty \let\m_font_goodies \empty -\appendtoks % can be analyzed once - % why here .. - %\edef\m_font_class_direction{\ifcsname\??fontclass\fontclass\s!mm\s!direction\endcsname\csname\??fontclass\fontclass\s!mm\s!direction\endcsname\fi}% - \edef\m_font_class_direction{\begincsname\??fontclass\fontclass\s!mm\s!direction\endcsname}% - % ... - \ifx\m_font_class_direction\v!both - \settrue\c_font_bidirectional_mathstrategy - \else - \setfalse\c_font_bidirectional_mathstrategy - \fi -\to \t_font_math_strategies - -\def\font_helpers_bidirectional_mathstrategy_yes - {\font_helpers_set_math_family\c_font_fam_mr_lr\s!mrlr - \font_helpers_set_math_family\c_font_fam_mr_rl\s!mrrl - \ifnum\fontid\textfont\c_font_fam_mr=\fontid\textfont\c_font_fam_mr_lr\else - \font_helpers_bidirectional_mathstrategy_yes_changed - \fi} - -\def\font_helpers_bidirectional_mathstrategy_yes_changed - {\textfont \c_font_fam_mr\textfont \c_font_fam_mr_lr - \scriptfont \c_font_fam_mr\scriptfont \c_font_fam_mr_lr - \scriptscriptfont\c_font_fam_mr\scriptscriptfont\c_font_fam_mr_lr} - -\def\font_helpers_bidirectional_mathstrategy_nop - {\font_helpers_set_math_family\c_font_fam_mr\s!mr - \ifnum\fontid\textfont\c_font_fam_mr_rl=\fontid\textfont\c_font_fam_mr\else - \font_helpers_bidirectional_mathstrategy_nop_changed - \fi} - -\def\font_helpers_bidirectional_mathstrategy_nop_changed - {\textfont \c_font_fam_mr_lr\textfont \c_font_fam_mr - \scriptfont \c_font_fam_mr_lr\scriptfont \c_font_fam_mr - \scriptscriptfont\c_font_fam_mr_lr\scriptscriptfont\c_font_fam_mr - \textfont \c_font_fam_mr_rl\textfont \c_font_fam_mr - \scriptfont \c_font_fam_mr_rl\scriptfont \c_font_fam_mr - \scriptscriptfont\c_font_fam_mr_rl\scriptscriptfont\c_font_fam_mr} +% \appendtoks % can be analyzed once +% % why here .. +% %\edef\m_font_class_direction{\ifcsname\??fontclass\fontclass\s!mm\s!direction\endcsname\csname\??fontclass\fontclass\s!mm\s!direction\endcsname\fi}% +% \edef\m_font_class_direction{\begincsname\??fontclass\fontclass\s!mm\s!direction\endcsname}% +% % ... +% \ifx\m_font_class_direction\v!both +% \settrue\c_font_bidirectional_mathstrategy +% \else +% \setfalse\c_font_bidirectional_mathstrategy +% \fi +% \to \t_font_math_strategies +% +% \def\font_helpers_bidirectional_mathstrategy_yes +% {\font_helpers_set_math_family\c_font_fam_mr_lr\s!mrlr +% \font_helpers_set_math_family\c_font_fam_mr_rl\s!mrrl +% \ifnum\fontid\textfont\c_font_fam_mr=\fontid\textfont\c_font_fam_mr_lr\else +% \font_helpers_bidirectional_mathstrategy_yes_changed +% \fi} +% +% \def\font_helpers_bidirectional_mathstrategy_yes_changed +% {\textfont \c_font_fam_mr\textfont \c_font_fam_mr_lr +% \scriptfont \c_font_fam_mr\scriptfont \c_font_fam_mr_lr +% \scriptscriptfont\c_font_fam_mr\scriptscriptfont\c_font_fam_mr_lr} +% +% \def\font_helpers_bidirectional_mathstrategy_nop +% {\font_helpers_set_math_family\c_font_fam_mr\s!mr +% \ifnum\fontid\textfont\c_font_fam_mr_rl=\fontid\textfont\c_font_fam_mr\else +% \font_helpers_bidirectional_mathstrategy_nop_changed +% \fi} +% +% \def\font_helpers_bidirectional_mathstrategy_nop +% {\font_helpers_set_math_family\c_font_fam_mr\s!mr} +% +% \def\font_helpers_bidirectional_mathstrategy_nop_changed +% {\textfont \c_font_fam_mr_lr\textfont \c_font_fam_mr +% \scriptfont \c_font_fam_mr_lr\scriptfont \c_font_fam_mr +% \scriptscriptfont\c_font_fam_mr_lr\scriptscriptfont\c_font_fam_mr +% \textfont \c_font_fam_mr_rl\textfont \c_font_fam_mr +% \scriptfont \c_font_fam_mr_rl\scriptfont \c_font_fam_mr +% \scriptscriptfont\c_font_fam_mr_rl\scriptscriptfont\c_font_fam_mr} +% +% \appendtoks +% \ifconditional\c_font_bidirectional_mathstrategy +% \font_helpers_bidirectional_mathstrategy_yes +% \else +% \font_helpers_bidirectional_mathstrategy_nop +% \fi +% \to \t_font_math_strategies \appendtoks - \ifconditional\c_font_bidirectional_mathstrategy - \font_helpers_bidirectional_mathstrategy_yes - \else - \font_helpers_bidirectional_mathstrategy_nop - \fi + \font_helpers_set_math_family\c_font_fam_mr\s!mr \to \t_font_math_strategies -\def\font_helpers_complete_bold_mathstrategy_yes_bidi - {\font_helpers_set_math_family_bold\c_font_fam_mb_lr\s!mblr\c_font_fam_mr_lr - \font_helpers_set_math_family_bold\c_font_fam_mb_rl\s!mbrl\c_font_fam_mr_rl - \ifnum\fontid\textfont\c_font_fam_mb=\fontid\textfont\c_font_fam_mb_lr\else - \font_helpers_complete_bold_mathstrategy_yes_bidi_changed - \fi} - -\def\font_helpers_complete_bold_mathstrategy_yes_bidi_changed - {\textfont \c_font_fam_mb\textfont \c_font_fam_mb_lr - \scriptfont \c_font_fam_mb\scriptfont \c_font_fam_mb_lr - \scriptscriptfont\c_font_fam_mb\scriptscriptfont\c_font_fam_mb_lr} +% \def\font_helpers_complete_bold_mathstrategy_yes_bidi +% {\font_helpers_set_math_family_bold\c_font_fam_mb_lr\s!mblr\c_font_fam_mr_lr +% \font_helpers_set_math_family_bold\c_font_fam_mb_rl\s!mbrl\c_font_fam_mr_rl +% \ifnum\fontid\textfont\c_font_fam_mb=\fontid\textfont\c_font_fam_mb_lr\else +% \font_helpers_complete_bold_mathstrategy_yes_bidi_changed +% \fi} +% +% \def\font_helpers_complete_bold_mathstrategy_yes_bidi_changed +% {\textfont \c_font_fam_mb\textfont \c_font_fam_mb_lr +% \scriptfont \c_font_fam_mb\scriptfont \c_font_fam_mb_lr +% \scriptscriptfont\c_font_fam_mb\scriptscriptfont\c_font_fam_mb_lr} +% +% \def\font_helpers_complete_bold_mathstrategy_yes +% {\font_helpers_set_math_family_bold\c_font_fam_mb\s!mb\c_font_fam_mr\relax +% \ifnum\fontid\textfont\c_font_fam_mb_rl=\fontid\textfont\c_font_fam_mb\else +% \font_helpers_complete_bold_mathstrategy_yes_changed +% \fi} +% +% \def\font_helpers_complete_bold_mathstrategy_yes_changed +% {\textfont \c_font_fam_mb_rl\textfont \c_font_fam_mb +% \scriptfont \c_font_fam_mb_rl\scriptfont \c_font_fam_mb +% \scriptscriptfont\c_font_fam_mb_rl\scriptscriptfont\c_font_fam_mb +% \textfont \c_font_fam_mb_lr\textfont \c_font_fam_mb +% \scriptfont \c_font_fam_mb_lr\scriptfont \c_font_fam_mb +% \scriptscriptfont\c_font_fam_mb_lr\scriptscriptfont\c_font_fam_mb} +% +% \def\font_helpers_complete_bold_mathstrategy_nop +% {\ifnum\fontid\textfont\c_font_fam_mb=\fontid\textfont\c_font_fam_mr\else +% \font_helpers_complete_bold_mathstrategy_nop_changed +% \fi} +% +% \def\font_helpers_complete_bold_mathstrategy_nop_changed +% {\textfont \c_font_fam_mb \textfont \c_font_fam_mr +% \scriptfont \c_font_fam_mb \scriptfont \c_font_fam_mr +% \scriptscriptfont\c_font_fam_mb \scriptscriptfont\c_font_fam_mr +% \textfont \c_font_fam_mb_lr\textfont \c_font_fam_mr_lr +% \scriptfont \c_font_fam_mb_lr\scriptfont \c_font_fam_mr_lr +% \scriptscriptfont\c_font_fam_mb_lr\scriptscriptfont\c_font_fam_mr_lr +% \textfont \c_font_fam_mb_rl\textfont \c_font_fam_mr_rl +% \scriptfont \c_font_fam_mb_rl\scriptfont \c_font_fam_mr_rl +% \scriptscriptfont\c_font_fam_mb_rl\scriptscriptfont\c_font_fam_mr_rl} +% +% \def\font_helpers_apply_complete_bold_mathstrategy +% {\ifconditional\c_font_complete_bold_mathstrategy +% \ifconditional\c_font_bidirectional_mathstrategy +% \font_helpers_complete_bold_mathstrategy_yes_bidi +% \else +% \font_helpers_complete_bold_mathstrategy_yes +% \fi +% \else +% \font_helpers_complete_bold_mathstrategy_nop +% \fi} \def\font_helpers_complete_bold_mathstrategy_yes - {\font_helpers_set_math_family_bold\c_font_fam_mb\s!mb\c_font_fam_mr\relax - \ifnum\fontid\textfont\c_font_fam_mb_rl=\fontid\textfont\c_font_fam_mb\else - \font_helpers_complete_bold_mathstrategy_yes_changed - \fi} - -\def\font_helpers_complete_bold_mathstrategy_yes_changed - {\textfont \c_font_fam_mb_rl\textfont \c_font_fam_mb - \scriptfont \c_font_fam_mb_rl\scriptfont \c_font_fam_mb - \scriptscriptfont\c_font_fam_mb_rl\scriptscriptfont\c_font_fam_mb - \textfont \c_font_fam_mb_lr\textfont \c_font_fam_mb - \scriptfont \c_font_fam_mb_lr\scriptfont \c_font_fam_mb - \scriptscriptfont\c_font_fam_mb_lr\scriptscriptfont\c_font_fam_mb} + {\font_helpers_set_math_family_bold\c_font_fam_mb\s!mb\c_font_fam_mr\relax} \def\font_helpers_complete_bold_mathstrategy_nop {\ifnum\fontid\textfont\c_font_fam_mb=\fontid\textfont\c_font_fam_mr\else @@ -389,21 +452,11 @@ \def\font_helpers_complete_bold_mathstrategy_nop_changed {\textfont \c_font_fam_mb \textfont \c_font_fam_mr \scriptfont \c_font_fam_mb \scriptfont \c_font_fam_mr - \scriptscriptfont\c_font_fam_mb \scriptscriptfont\c_font_fam_mr - \textfont \c_font_fam_mb_lr\textfont \c_font_fam_mr_lr - \scriptfont \c_font_fam_mb_lr\scriptfont \c_font_fam_mr_lr - \scriptscriptfont\c_font_fam_mb_lr\scriptscriptfont\c_font_fam_mr_lr - \textfont \c_font_fam_mb_rl\textfont \c_font_fam_mr_rl - \scriptfont \c_font_fam_mb_rl\scriptfont \c_font_fam_mr_rl - \scriptscriptfont\c_font_fam_mb_rl\scriptscriptfont\c_font_fam_mr_rl} + \scriptscriptfont\c_font_fam_mb \scriptscriptfont\c_font_fam_mr} \def\font_helpers_apply_complete_bold_mathstrategy {\ifconditional\c_font_complete_bold_mathstrategy - \ifconditional\c_font_bidirectional_mathstrategy - \font_helpers_complete_bold_mathstrategy_yes_bidi - \else - \font_helpers_complete_bold_mathstrategy_yes - \fi + \font_helpers_complete_bold_mathstrategy_yes \else \font_helpers_complete_bold_mathstrategy_nop \fi} @@ -420,27 +473,33 @@ \fam\zerocount % all characters and symbols are in this family \to \everymathematics +% \protected\def\font_helpers_synchronize_math_family_mr +% {\c_attr_mathfamily\ifconditional\c_font_bidirectional_mathstrategy +% \ifconditional\c_math_right_to_left +% \plustwo +% \else +% \plusone +% \fi +% \else +% \zerocount +% \fi} +% +% \protected\def\font_helpers_synchronize_math_family_mb +% {\c_attr_mathfamily\ifconditional\c_font_bidirectional_mathstrategy +% \ifconditional\c_math_right_to_left +% \ifconditional\c_font_pseudo_bold_math_state\pluseight\else\plusfive\fi +% \else +% \ifconditional\c_font_pseudo_bold_math_state\plusseven\else\plusfour\fi +% \fi +% \else +% \ifconditional\c_font_pseudo_bold_math_state\plussix\else\plusthree\fi +% \fi} + \protected\def\font_helpers_synchronize_math_family_mr - {\c_attr_mathfamily\ifconditional\c_font_bidirectional_mathstrategy - \ifconditional\c_math_right_to_left - \plustwo - \else - \plusone - \fi - \else - \zerocount - \fi} + {\c_attr_mathfamily\zerocount} \protected\def\font_helpers_synchronize_math_family_mb - {\c_attr_mathfamily\ifconditional\c_font_bidirectional_mathstrategy - \ifconditional\c_math_right_to_left - \ifconditional\c_font_pseudo_bold_math_state\pluseight\else\plusfive\fi - \else - \ifconditional\c_font_pseudo_bold_math_state\plusseven\else\plusfour\fi - \fi - \else - \ifconditional\c_font_pseudo_bold_math_state\plussix\else\plusthree\fi - \fi} + {\c_attr_mathfamily\ifconditional\c_font_pseudo_bold_math_state\plussix\else\plusthree\fi} \installcorenamespace{fontmathsynchronizer} \installcorenamespace{fontmathstoredstrategy} @@ -471,7 +530,6 @@ \fi \to \t_font_math_strategies -%def\font_helpers_synchronize_math_bold_strategy{\csname\??fontmathstoredstrategy\fontclass\endcsname} \def\font_helpers_synchronize_math_bold_strategy{\begincsname\??fontmathstoredstrategy\fontclass\endcsname} \newconditional\c_font_pseudo_bold_math_state @@ -569,4 +627,19 @@ \permanent\protected\def\setmscale#1{\ifmmode\scaledmathstyle\numericscale#1\relax\fi} +%D This is nasty, as the engine only stores the last set family parameters (per style) which +%D in our case can be bold. + +\def\font_helpers_synchronize_math_parameters + {\textfont \zerocount\textfont \zerocount + \scriptfont \zerocount\scriptfont \zerocount + \scriptscriptfont\zerocount\scriptscriptfont\zerocount + \setfalse\c_math_last_family_set} + +\appendtoks + \ifconditional\c_math_last_family_set + \font_helpers_synchronize_math_parameters + \fi +\to\everybodyfont + \protect \endinput diff --git a/tex/context/base/mkxl/font-mps.lmt b/tex/context/base/mkxl/font-mps.lmt index 9a123a25e..7afc48d0f 100644 --- a/tex/context/base/mkxl/font-mps.lmt +++ b/tex/context/base/mkxl/font-mps.lmt @@ -46,6 +46,14 @@ function metapost.boundingbox(d,factor) return f_boundingbox(llx,lly,urx,lly,urx,ury,llx,ury) end +function metapost.baseline(d,factor) + local bounds = d.boundingbox + local factor = factor or 1 + local llx = factor*bounds[1] + local urx = factor*bounds[3] + return f_vertical(llx,0,urx,0) +end + function metapost.widthline(d,factor) local bounds = d.boundingbox local factor = factor or 1 diff --git a/tex/context/base/mkxl/font-otl.lmt b/tex/context/base/mkxl/font-otl.lmt index 85b32470b..b7889fc05 100644 --- a/tex/context/base/mkxl/font-otl.lmt +++ b/tex/context/base/mkxl/font-otl.lmt @@ -52,7 +52,7 @@ local report_otf = logs.reporter("fonts","otf loading") local fonts = fonts local otf = fonts.handlers.otf -otf.version = 3.120 -- beware: also sync font-mis.lua and in mtx-fonts +otf.version = 3.121 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otl", otf.version, true) otf.svgcache = containers.define("fonts", "svg", otf.version, true) otf.pngcache = containers.define("fonts", "png", otf.version, true) @@ -426,9 +426,9 @@ local function copytotfm(data,cache_id) character.vitalic = vitalic end -- - local accent = m.accent -- taccent? - if accent then - character.accent = accent + local topanchor = m.topanchor or m.accent -- for now + if topanchor then + character.topanchor = topanchor end -- local kerns = m.kerns @@ -766,14 +766,14 @@ end -- moved from font-oth.lua, todo: also afm -local function getgsub(tfmdata,k,kind,value) +local function getgsub(tfmdata,k,kind,value,script,language) local shared = tfmdata.shared local rawdata = shared and shared.rawdata if rawdata then local sequences = rawdata.resources.sequences if sequences then local properties = tfmdata.properties - local validlookups, lookuplist = otf.collectlookups(rawdata,kind,properties.script,properties.language) + local validlookups, lookuplist = otf.collectlookups(rawdata,kind,script or properties.script,language or properties.language) if validlookups then -- local choice = tonumber(value) or 1 -- no random here (yet) for i=1,#lookuplist do @@ -797,8 +797,8 @@ end otf.getgsub = getgsub -- returns value, gsub_kind -function otf.getsubstitution(tfmdata,k,kind,value) - local found, kind = getgsub(tfmdata,k,kind,value) +function otf.getsubstitution(tfmdata,k,kind,value,script,language) + local found, kind = getgsub(tfmdata,k,kind,value,script,language) if not found then -- elseif kind == "gsub_single" then @@ -812,16 +812,16 @@ end otf.getalternate = otf.getsubstitution -function otf.getmultiple(tfmdata,k,kind) - local found, kind = getgsub(tfmdata,k,kind) +function otf.getmultiple(tfmdata,k,kind,value,script,language) + local found, kind = getgsub(tfmdata,k,kind,value,script,language) if found and kind == "gsub_multiple" then return found end return { k } end -function otf.getkern(tfmdata,left,right,kind) - local kerns = getgsub(tfmdata,left,kind or "kern",true) -- for now we use getsub +function otf.getkern(tfmdata,left,right,kind,value,script,language) + local kerns = getgsub(tfmdata,left,kind or "kern",true,script,language) -- for now we use getsub if kerns then local found = kerns[right] local kind = type(found) diff --git a/tex/context/base/mkxl/font-ots.lmt b/tex/context/base/mkxl/font-ots.lmt index 2ab52a35a..73c9b7c56 100644 --- a/tex/context/base/mkxl/font-ots.lmt +++ b/tex/context/base/mkxl/font-ots.lmt @@ -169,13 +169,8 @@ local forcepairadvance = false -- for testing local repeatlastmultiple = context and true -directives.register("otf.forcediscretionaries",function(v) - forcediscretionaries = v -end) - -directives.register("otf.forcepairadvance",function(v) - forcepairadvance = v -end) +directives.register("otf.forcediscretionaries", function(v) forcediscretionaries = v end) +directives.register("otf.forcepairadvance", function(v) forcepairadvance = v end) local report_direct = logs.reporter("fonts","otf direct") local report_subchain = logs.reporter("fonts","otf subchain") @@ -200,7 +195,6 @@ local getboth = nuts.getboth local setboth = nuts.setboth local getid = nuts.getid local getstate = nuts.getstate -local setsubtype = nuts.setsubtype local getchar = nuts.getchar local setchar = nuts.setchar local getdisc = nuts.getdisc @@ -264,7 +258,6 @@ local lefttoright_code = nodes.dirvalues.lefttoright local righttoleft_code = nodes.dirvalues.righttoleft local discretionarydisc_code = nodes.disccodes.discretionary ------ ligatureglyph_code = glyphcodes.ligature local injections = nodes.injections local setmark = injections.setmark @@ -299,9 +292,9 @@ local marks = false local classes = false local currentfont = false local currentdynamic = false -local currentscale = 1000 -- false -local currentxscale = 1000 -- false -local currentyscale = 1000 -- false +local currentscale = 1000 +local currentxscale = 1000 +local currentyscale = 1000 local factor = 0 local threshold = 0 local checkmarks = false @@ -503,7 +496,6 @@ local function markstoligature(head,start,stop,char) end resetinjection(base) setchar(base,char) - -- setsubtype(base,ligatureglyph_code) setcomponents(base,start) setlink(prev,base,next) flushcomponents(start) @@ -525,7 +517,7 @@ local glyphoptioncodes = tex.glyphoptioncodes local no_left_ligature_code = glyphoptioncodes.noleftligature local no_right_ligature_code = glyphoptioncodes.norightligature -local no_left_kern_code = glyphoptioncodes.noleftkern +----- no_left_kern_code = glyphoptioncodes.noleftkern local no_right_kern_code = glyphoptioncodes.norightkern local hasglyphoption = nuts.hasglyphoption @@ -558,7 +550,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou if start == stop and getchar(start) == char and not hasmarks then resetinjection(start) setchar(start,char) --- fonts.collections.direct(start) + -- fonts.collections.direct(start) return head, start end if inhibited(start,stop) then @@ -575,9 +567,8 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou end resetinjection(base) setchar(base,char) --- fonts.collections.direct(base) + -- fonts.collections.direct(base) setoptions(base,getoptions(start) | getoptions(stop)) -- maybe only lig options - -- setsubtype(base,ligatureglyph_code) setcomponents(base,comp) setlink(prev,base,next) if not discfound then @@ -1379,7 +1370,7 @@ as less as needed but that would also make the code even more messy.</p> -- To be done (example needed): what if > 1 steps --- this is messy: do we need this disc checking also in alternaties? +-- this is messy: do we need this disc checking also in alternates? local function reportzerosteps(dataset,sequence) logwarning("%s: no steps",cref(dataset,sequence)) @@ -2058,9 +2049,7 @@ local function setdiscchecked(d,pre,post,replace) setdisc(d,pre,post,replace) end -local noflags = { false, false, false, false } - -local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) +local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck,where) local size = ck[5] - ck[4] + 1 local chainlookups = ck[6] @@ -2076,26 +2065,30 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) -- -- bad rules -- end local chainlookup = chainlookups[1] - for j=1,#chainlookup do - local chainstep = chainlookup[j] - if chainstep then - local chainkind = chainstep.type - local chainproc = chainprocs[chainkind] - if chainproc then - local ok - -- HH: chainindex 1 added here (for KAI to check too), there are weird ligatures e.g. - -- char + mark -> char where mark has to disappear - -- head, start, ok = chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,1) - head, start, ok = chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash) - if ok then - done = true + if chainlookup then + for j=1,#chainlookup do + local chainstep = chainlookup[j] + if chainstep then + local chainkind = chainstep.type + local chainproc = chainprocs[chainkind] + if chainproc then + local ok + -- HH: chainindex 1 added here (for KAI to check too), there are weird ligatures e.g. + -- char + mark -> char where mark has to disappear + -- head, start, ok = chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,1) + head, start, ok = chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash) + if ok then + done = true + end + else + logprocess("%s: %s is not yet supported (1)",cref(dataset,sequence),chainkind) end else - logprocess("%s: %s is not yet supported (1)",cref(dataset,sequence),chainkind) + logprocess("%s: has an issue (1)",cref(dataset,sequence)) end - else - logprocess("%s: has an issue (1)",cref(dataset,sequence)) end + else + -- whatever end else @@ -2185,7 +2178,7 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) else done = true if trace_contexts then - logprocess("%s: skipping match",cref(dataset,sequence)) + logprocess("%s: skipping match @ %i",cref(dataset,sequence),where) end end end @@ -2215,6 +2208,8 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) local last = start local prev = getprev(start) local hasglue = false + local useddisc = nil -- new 2022-09-25 + local usedstart = start -- new 2022-09-25 -- fishy: so we can overflow and then go on in the sweep? -- todo : id can also be glue_code as we checked spaces @@ -2376,15 +2371,14 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) end end end + local done = false if lookaheaddisc then - local cf = start local cl = getprev(lookaheaddisc) local cprev = getprev(start) local insertedmarks = 0 - while cprev do local nxt, char = isnextchar(cf,currentfont,currentdynamic,currentscale,currentxscale,currentyscale) if char and marks[char] then @@ -2423,14 +2417,14 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) end if not notmatchpre[lookaheaddisc] then local ok = false - cf, start, ok = chainrun(cf,start,cl,dataset,sequence,rlmode,skiphash,ck) + cf, start, ok = chainrun(cf,start,cl,dataset,sequence,rlmode,skiphash,ck,1) if ok then done = true end end if not notmatchreplace[lookaheaddisc] then local ok = false - new, cnew, ok = chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck) + new, cnew, ok = chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck,2) if ok then done = true end @@ -2441,16 +2435,14 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) setdisc(lookaheaddisc,cf,post,new) end start = getprev(lookaheaddisc) + useddisc = lookaheaddisc -- new 2022-09-25 sweephead[cf] = getnext(clast) or false sweephead[new] = getnext(cl) or false - elseif backtrackdisc then - local cf = getnext(backtrackdisc) local cl = start local cnext = getnext(start) local insertedmarks = 0 - while cnext do local nxt, char = isnextchar(cnext,currentfont,currentdynamic,currentscale,currentxscale,currentyscale) if char and marks[char] then @@ -2476,14 +2468,14 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) end if not notmatchpost[backtrackdisc] then local ok = false - cf, start, ok = chainrun(cf,start,last,dataset,sequence,rlmode,skiphash,ck) + cf, start, ok = chainrun(cf,start,last,dataset,sequence,rlmode,skiphash,ck,3) if ok then done = true end end if not notmatchreplace[backtrackdisc] then local ok = false - new, cnew, ok = chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck) + new, cnew, ok = chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck,4) if ok then done = true end @@ -2504,33 +2496,57 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) setdisc(backtrackdisc,pre,post,replace) end start = getprev(backtrackdisc) + useddisc = backtrackdisc -- new 2022-09-25 sweephead[post] = getnext(clast) or false sweephead[replace] = getnext(last) or false - else local ok = false - head, start, ok = chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) + head, start, ok = chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck,5) if ok then done = true end end - - return head, start, done + if useddisc and start ~= usedstart then -- make this option per font -- new 2022-09-25 + start = getnext(start) -- new 2022-09-25 + end -- new 2022-09-25 + return head, start, done, useddisc -- new 2022-09-25 end -local function chaintrac(head,start,dataset,sequence,rlmode,skiphash,ck,match,discseen,sweepnode) - local rule = ck[1] - local lookuptype = ck[8] or ck[2] - local nofseq = #ck[3] - local first = ck[4] - local last = ck[5] - local char = getchar(start) - logwarning("%s: rule %s %s at char %s for (%s,%s,%s) chars, lookuptype %a, %sdisc seen, %ssweeping", - cref(dataset,sequence),rule,match and "matches" or "nomatch", - gref(char),first-1,last-first+1,nofseq-last,lookuptype, - discseen and "" or "no ", sweepnode and "" or "not ") +local chaintrac do + + local level = 0 + local last = { } + + chaintrac = function(head,start,dataset,sequence,rlmode,skiphash,ck,match,discseen,sweepnode) + if dataset then + level = level + 1 + last[level] = start + local rule = ck[1] + local lookuptype = ck[8] or ck[2] + local nofseq = #ck[3] -- ck[3].n + local first = ck[4] + local last = ck[5] + local char = getchar(start) + logwarning("+ %i : %s: rule %s %s at char %s for (%s,%s,%s) chars, lookuptype %a, %sdisc seen, %ssweeping", + level,cref(dataset,sequence),rule,match and "matches" or "nomatch", + gref(char),first-1,last-first+1,nofseq-last,lookuptype, + discseen and "" or "no ", sweepnode and "" or "not ") + else + -- (start,done) + local what = start and "done" or "continue" + local where = head == last[level] and "same" or "different" + local char = getchar(head) + if char then + logwarning("- %i : %s at char %s, %s node",level,what,gref(char),where) + else + logwarning("- %i : %s, %s node",level,what,where) + end + level = level - 1 + end + end + end -- The next one is quite optimized but still somewhat slow, fonts like ebgaramond @@ -2544,6 +2560,9 @@ end -- the previous disc .. such be it (<before><disc><current=fl><after> with only f done) local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,skiphash) + if not contexts then + return head, start, false + end -- optimizing for rlmode gains nothing local sweepnode = sweepnode local sweeptype = sweeptype @@ -2579,17 +2598,17 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s -- fonts can have many steps (each doing one check) or many contexts -- todo: make a per-char cache so that we have small contexts (when we have a context - -- n == 1 and otherwise it can be more so we can even distingish n == 1 or more) + -- n == 1 and otherwise it can be more so we can even distinguish n == 1 or more) local nofcontexts = contexts.n -- #contexts local startchar = nofcontext == 1 or ischar(start,currentfont) -- already checked for k=1,nofcontexts do -- does this disc mess work well with n > 1 - local ck = contexts[k] - local seq = ck[3] - local f = ck[4] -- first current -local last = start + local ck = contexts[k] + local seq = ck[3] + local f = ck[4] -- first current + local last = start if not startchar or not seq[f][startchar] then -- report("no hit in %a at %i of %i contexts",sequence.type,k,nofcontexts) goto next @@ -2600,7 +2619,9 @@ local last = start else local l = ck[5] -- last current local current = start --- local last = start + -- local last = start + + -- current match if l > f then -- before/current/after | before/current | current/after @@ -2712,7 +2733,7 @@ local last = start -- before if f > 1 then - if startprev then + -- if startprev then -- new 2022-09-25 local prev = startprev if prereplace and prev == checkdisc then prev = getprev(sweepnode) @@ -2837,9 +2858,9 @@ local last = start else goto next end - else - goto next - end + -- else -- new 2022-09-25 + -- goto next -- new 2022-09-25 + -- end -- new 2022-09-25 end -- after @@ -2968,19 +2989,21 @@ local last = start chaintrac(head,start,dataset,sequence,rlmode,skipped and skiphash,ck,true,discseen,sweepnode) end if discseen or sweepnode then + -- When we process a disc we can collapse and therefore we backtrack one node (start) and + -- reprocess. This is needed because there might be more in the collapsed list. head, start, done = chaindisk(head,start,dataset,sequence,rlmode,skipped and skiphash,ck) else - head, start, done = chainrun(head,start,last,dataset,sequence,rlmode,skipped and skiphash,ck) + head, start, done = chainrun(head,start,last,dataset,sequence,rlmode,skipped and skiphash,ck,6) + end + if trace_contexts then + chaintrac(start,done) end if done then break -- else -- next context end - ::next:: - -- if trace_chains then - -- chaintrac(head,start,dataset,sequence,rlmode,skipped and skiphash,ck,false,discseen,sweepnode) - -- end + ::next:: end if discseen then notmatchpre = { } @@ -2999,21 +3022,46 @@ handlers.gsub_reversecontextchain = handle_contextchain handlers.gpos_contextchain = handle_contextchain handlers.gpos_context = handle_contextchain --- this needs testing +-- local function chained_contextchain(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash) +-- local steps = currentlookup.steps +-- local nofsteps = currentlookup.nofsteps +-- if nofsteps > 1 then +-- reportmoresteps(dataset,sequence) +-- end +-- -- probably wrong +-- local l = steps[1].coverage[getchar(start)] +-- if l then +-- return handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) +-- else +-- return head, start, false +-- end +-- end +-- new 2022-09-25 + local function chained_contextchain(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash) local steps = currentlookup.steps local nofsteps = currentlookup.nofsteps - if nofsteps > 1 then - reportmoresteps(dataset,sequence) - end - -- probably wrong - local l = steps[1].coverage[getchar(start)] - if l then - return handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) + local char = getchar(start) + if nofsteps == 1 then + local s = steps[1] + local l = s.coverage[char] + if l then + return handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) + end else - return head, start, false + for i=1,nofsteps do + local s = steps[i] + local l = s.coverage[char] + if l then + local h, s, d = handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) + if d then + return h, s, d + end + end + end end + return head, start, false end chainprocs.gsub_context = chained_contextchain @@ -3152,7 +3200,7 @@ do -- overcome local limit end -- Functions like kernrun, comprun etc evolved over time and in the end look rather --- complex. It's a bit of a compromis between extensive copying and creating subruns. +-- complex. It's a bit of a compromise between extensive copying and creating subruns. -- The logic has been improved a lot by Kai and Ivo who use complex fonts which -- really helped to identify border cases on the one hand and get insight in the diverse -- ways fonts implement features (not always that consistent and efficient). At the same @@ -3259,7 +3307,7 @@ local function kernrun(disc,k_run,...) if done and trace_testruns then report_disc("done",disc) end --- return nextstart, done + -- return nextstart, done return nextstart end @@ -3313,7 +3361,7 @@ local function comprun(disc,c_run,...) -- vararg faster than the whole list setdisc(disc,pre,post,replace) end -- --- return getnext(disc), renewed + -- return getnext(disc), renewed return getnext(disc) end @@ -3442,7 +3490,7 @@ local function testrun(disc,t_run,c_run,...) end end -- next can have changed (copied list) --- return getnext(disc), renewed + -- return getnext(disc), renewed return getnext(disc) end @@ -3978,20 +4026,13 @@ do start = nxt elseif id == disc_code then if not discs or discs[start] == true then --- local ok if gpossing then --- start, ok = kernrun(start,k_run_single, lookupcache,step,dataset,sequence,rlmode,skiphash,handler) start = kernrun(start,k_run_single, lookupcache,step,dataset,sequence,rlmode,skiphash,handler) elseif forcetestrun then --- start, ok = testrun(start,t_run_single,c_run_single,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) start = testrun(start,t_run_single,c_run_single,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) else --- start, ok = comprun(start,c_run_single, lookupcache,step,dataset,sequence,rlmode,skiphash,handler) start = comprun(start,c_run_single, lookupcache,step,dataset,sequence,rlmode,skiphash,handler) end - -- if ok then - -- done = true - -- end else start = nxt end @@ -4002,7 +4043,7 @@ do start = nxt -- elseif id == par_code and startofpar(start) then -- rlparmode, rlmode = pardirstate(start) - -- start = nxt + -- start = nxt else start = nxt end @@ -4051,15 +4092,11 @@ do start = nxt elseif id == disc_code then if not discs or discs[start] == true then --- local ok if gpossing then --- start, ok = kernrun(start,k_run_multiple, steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) start = kernrun(start,k_run_multiple, steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) elseif forcetestrun then --- start, ok = testrun(start,t_run_multiple,c_run_multiple,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) start = testrun(start,t_run_multiple,c_run_multiple,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) else --- start, ok = comprun(start,c_run_multiple, steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) start = comprun(start,c_run_multiple, steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) end else @@ -4098,9 +4135,6 @@ do currentfont = font currentdynamic = false --- currentscale = false --- currentxscale = false --- currentyscale = false currentscale = 1000 currentxscale = 1000 currentyscale = 1000 @@ -4191,7 +4225,7 @@ do start = nxt -- elseif id == par_code and startofpar(start) then -- rlparmode, rlmode = pardirstate(start) - -- start = nxt + -- start = nxt else start = nxt end diff --git a/tex/context/base/mkxl/font-pre.mkxl b/tex/context/base/mkxl/font-pre.mkxl index 3c7a01857..8cb0b5b6c 100644 --- a/tex/context/base/mkxl/font-pre.mkxl +++ b/tex/context/base/mkxl/font-pre.mkxl @@ -427,10 +427,6 @@ language=dflt, script=math] -\definefontfeature - [oldmath] - [oldmath=yes] - \ifdefined\mathnolimitsmode \mathnolimitsmode\plusone % font driven (only opentype) \fi diff --git a/tex/context/base/mkxl/grph-trf.mkxl b/tex/context/base/mkxl/grph-trf.mkxl index a08cec904..0f1458873 100644 --- a/tex/context/base/mkxl/grph-trf.mkxl +++ b/tex/context/base/mkxl/grph-trf.mkxl @@ -117,7 +117,7 @@ \setupcurrentscale[#2]% \fi % - \dowithnextboxcs\grph_scale_finish\hbox} + \dowithnextboxcs\grph_scale_finish\naturalhbox} % intercept direction \def\grph_scale_finish {% todo: p_scale_ diff --git a/tex/context/base/mkxl/lpdf-ano.lmt b/tex/context/base/mkxl/lpdf-ano.lmt index 85fe050a2..b0d398457 100644 --- a/tex/context/base/mkxl/lpdf-ano.lmt +++ b/tex/context/base/mkxl/lpdf-ano.lmt @@ -386,6 +386,8 @@ local v_minheight = variables.minheight local v_fit = variables.fit local v_tight = variables.tight +local c_realpageno = tex.iscount("realpageno") + -- nicer is to create dictionaries and set properties but it's a bit overkill -- The problem with the following settings is that they are guesses: we never know @@ -466,7 +468,7 @@ end) local function flushdestination(specification) local names = specification.names local view = specification.view - local r = pdfpagereference(texgetcount("realpageno")) + local r = pdfpagereference(c_realpageno) if (references.innermethod ~= v_name) and (view == defaultview or not view or view == "") then r = pagedestinations[r] else @@ -1079,7 +1081,7 @@ end function specials.deltapage(var,actions) local p = tonumber(var.operation) if p then - p = references.checkedrealpage(p + texgetcount("realpageno")) + p = references.checkedrealpage(p + texgetcount(c_realpageno)) return pdflinkpage(p) end end diff --git a/tex/context/base/mkxl/lpdf-emb.lmt b/tex/context/base/mkxl/lpdf-emb.lmt index 6932879e7..3ce288b48 100644 --- a/tex/context/base/mkxl/lpdf-emb.lmt +++ b/tex/context/base/mkxl/lpdf-emb.lmt @@ -872,6 +872,7 @@ do FontName = basefont, Flags = 4, FontBBox = fontbbox, +-- FontMatrix = pdfarray { 0.001, 0, 0, 0.001, 0, 0 }, Ascent = scale(ascender), Descent = scale(descender), ItalicAngle = round(italicangle or 0), @@ -971,7 +972,6 @@ do return int4tag .. tointeger4(n) end - local e = false local z = byte("0") local dp = 10 local ep = 11 @@ -985,6 +985,7 @@ do local s = fg(v) local t = { [0] = realtag } local n = 0 + local e = false for s in gmatch(s,".") do if s == "e" or s == "E" then e = true @@ -1027,6 +1028,73 @@ do return t end + -- -- An alternative + -- + -- local fg = formatters["%0.14gE%i"] + -- + -- todictreal = function(v) + -- local E = 0 + -- if v >= 10.0 then + -- while v >= 10.0 do + -- v = v / 10.0 + -- E = E + 1 + -- end + -- elseif v < 1.0 then + -- while v < 1.0 do + -- v = v * 10.0 + -- E = E - 1 + -- end + -- end + -- local s = fg(v,E) + -- local t = { [0] = realtag } + -- local n = 0 + -- local e = false + -- for s in gmatch(s,".") do + -- if s == "e" or s == "E" then + -- e = true + -- elseif s == "+" then + -- -- skip + -- elseif s == "-" then + -- n = n + 1 + -- if e then + -- t[n] = em + -- e = false + -- else + -- t[n] = mn + -- end + -- else + -- if e then + -- n = n + 1 + -- t[n] = ep + -- e = false + -- end + -- n = n + 1 + -- if s == "." then + -- t[n] = dp + -- else + -- t[n] = byte(s) - z + -- end + -- end + -- end + -- n = n + 1 + -- t[n] = es + -- if (n % 2) ~= 0 then + -- n = n + 1 + -- t[n] = es + -- end + -- local j = 0 + -- for i=1,n,2 do + -- j = j + 1 + -- t[j] = char(t[i]*0x10+t[i+1]) + -- end + -- -- print(v,s) + -- -- for i=0,j do + -- -- print(string.format("%02X",utf.byte(t[i]))) + -- -- end + -- t = concat(t,"",0,j) + -- return t + -- end + todictnumber = function(n) if not n or n == 0 then return todictinteger(0) @@ -1063,7 +1131,8 @@ do local function todictdeltas(t) local r = { } for i=1,#t do - r[i] = todictnumber(t[i]-(t[i-1] or 0)) +-- r[i] = todictnumber(t[i]-(t[i-1] or 0)) + r[i] = todictnumber(t[i]+(t[i-1] or 0)) end return concat(r) end @@ -1140,7 +1209,7 @@ do -- local charstrings = fontfile.charstrings local nofglyphs = #charstrings + 1 - local fontmatrix = { 0.001, 0, 0, 0.001, 0, 0 } -- todo +-- local fontmatrix = { 0.001, 0, 0, 0.001, 0, 0 } -- todo local fontbbox = fontfile.fontbbox local defaultwidth = cffinfo.defaultwidth or 0 local nominalwidth = cffinfo.nominalwidth or 0 @@ -1153,6 +1222,8 @@ do local bluefuzz = cffinfo.bluefuzz local stdhw = cffinfo.stdhw local stdvw = cffinfo.stdvw + local stemsnaph = cffinfo.stemsnaph + local stemsnapv = cffinfo.stemsnapv -- if defaultwidth == 0 then defaultwidth = nil end if nomimalwidth == 0 then nominalwidth = nil end @@ -1163,8 +1234,10 @@ do if bluescale then bluescale = todictnumber(bluescale) end if blueshift then blueshift = todictnumber(blueshift) end if bluefuzz then bluefuzz = todictnumber(bluefuzz) end - if stdhw then stdhw = todictdeltas(stdhw) end - if stdvw then stdvw = todictdeltas(stdvw) end + if stemsnaph then stemsnaph = todictarray(stemsnaph) end + if stemsnapv then stemsnapv = todictarray(stemsnapv) end + if stdhw then stdhw = todictnumber(stdhw) end + if stdvw then stdvw = todictnumber(stdvw) end -- local fontversion = todictstring(fontfile,fontheader.fontversion or "uknown version") local familyname = todictstring(fontfile,cffinfo.familyname or names.family or basefontname) @@ -1177,7 +1250,7 @@ do local underlineposition = todictnumber(cffinfo.underlineposition) local underlinethickness = todictnumber(cffinfo.underlinethickness) local charstringtype = todictnumber(2) - local fontmatrix = todictarray(fontmatrix) +-- local fontmatrix = todictarray(fontmatrix) local ros = todictstring(fontfile,"Adobe") -- registry .. todictstring(fontfile,"Identity") -- identity .. todictnumber(0) -- supplement @@ -1191,18 +1264,21 @@ do -- local defaultwidthx = todictnumber(defaultwidth) local nominalwidthx = todictnumber(nominalwidth) + -- the order of the blues is important! local private = "" - .. (defaultwidthx and (defaultwidthx .. todictkey(20)) or "") - .. (nominalwidthx and (nominalwidthx .. todictkey(21)) or "") - .. (bluevalues and (bluevalues .. todictkey(6)) or "") - .. (otherblues and (otherblues .. todictkey(7)) or "") - .. (familyblues and (familyblues .. todictkey(8)) or "") - .. (familyotherblues and (familyotherblues .. todictkey(9)) or "") - .. (bluescale and (bluescale .. todictkey(12,9)) or "") - .. (blueshift and (blueshift .. todictkey(12,10)) or "") - .. (bluefuzz and (bluefuzz .. todictkey(12,11)) or "") - .. (stdhw and (stdhw .. todictkey(12,12)) or "") - .. (stdvw and (stdvw .. todictkey(12,13)) or "") + .. (bluevalues and (bluevalues .. todictkey( 6)) or "") + .. (otherblues and (otherblues .. todictkey( 7)) or "") + .. (familyblues and (familyblues .. todictkey( 8)) or "") + .. (familyotherblues and (familyotherblues .. todictkey( 9)) or "") + .. (bluescale and (bluescale .. todictkey(12, 9)) or "") + .. (blueshift and (blueshift .. todictkey(12,10)) or "") + .. (bluefuzz and (bluefuzz .. todictkey(12,11)) or "") + .. (stdhw and (stdhw .. todictkey(10)) or "") + .. (stdvw and (stdvw .. todictkey(11)) or "") + .. (stemsnaph and (stemsnaph .. todictkey(12,12)) or "") + .. (stemsnapv and (stemsnapv .. todictkey(12,13)) or "") + .. (defaultwidthx and (defaultwidthx .. todictkey(20)) or "") + .. (nominalwidthx and (nominalwidthx .. todictkey(21)) or "") local privatesize = todictnumber(#private) local privatespec = privatesize .. privateoffset -- @@ -1245,7 +1321,7 @@ do .. underlineposition .. todictkey(12, 3) .. underlinethickness .. todictkey(12, 4) .. charstringtype .. todictkey(12, 6) - .. fontmatrix .. todictkey(12, 7) +-- .. fontmatrix .. todictkey(12, 7) .. strokewidth .. todictkey(12, 8) .. topvars } @@ -1272,6 +1348,10 @@ do -- -- fdselect -- + -- see printer mail thread / experiments with Leah Neukirchen: some printers + -- (probaby with an old GS on board) need this matrix because oitherwise they + -- accumulate the top one (resulting in very tiny invisible results) + -- local fdselect = tocardinal1(3) -- format .. tocardinal2(1) -- n of ranges @@ -1301,8 +1381,8 @@ do offset = writestring(target,private,offset,"private") -- local fdarray = { - fontname .. todictkey(12,38) - .. privatespec .. todictkey(18) + fontname .. todictkey(12,38) + .. privatespec .. todictkey(18) -- case 1 } fdarrayoffset = todictoffset(offset) offset = writeindex(target,fdarray,offset,"fdarray") @@ -1314,19 +1394,18 @@ do .. charsetoffset .. todictkey(15) .. fdarrayoffset .. todictkey(12,36) .. fdselectoffset .. todictkey(12,37) - .. privatespec .. todictkey(18) + .. privatespec .. todictkey(18) -- case 2 target[dictof] = topdict .. topvars -- target = concat(target) -- if trace_details then - -- local name = "temp.cff" - -- report_fonts("saving %a",name) - -- io.savedata(name,target) - -- inspect(fonts.handlers.otf.readers.cffcheck(name)) + -- local name = "temp.cff" + -- report_fonts("saving %a",name) + -- io.savedata(name,target) + -- inspect(fonts.handlers.otf.readers.cffcheck(name)) -- end return target end - end -- todo: check widths (missing a decimal) @@ -1468,6 +1547,7 @@ do FontName = basefont, Flags = 4, FontBBox = fontbbox, +-- FontMatrix = pdfarray { 0.001, 0, 0, 0.001, 0, 0 }, Ascent = scale(ascender), Descent = scale(descender), ItalicAngle = round(italicangle or 0), diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt index bf1142119..d937e3dea 100644 --- a/tex/context/base/mkxl/lpdf-lmt.lmt +++ b/tex/context/base/mkxl/lpdf-lmt.lmt @@ -202,6 +202,7 @@ local usedfontstreams = { } local usedindices = setmetatableindex(function(t,k) local n = 0 +-- n = 31 local v = setmetatableindex(function(tt,kk) if n >= 0xFFFF then report_fonts("registering character index: overflow in hash %a, todo: use overflow font") @@ -2488,11 +2489,12 @@ end do - local names = { } - local cache = { } - local nofpages = 0 + local names = { } + local cache = { } + local nofpages = 0 - local texgetcount = tex.getcount + local texgetcount = tex.getcount + local c_realpageno = tex.iscount("realpageno") pdfreserveobject = function(name) nofobjects = nofobjects + 1 @@ -2511,7 +2513,7 @@ do pdfpagereference = function(n,complete) -- true | false | nil | n [true,false] if n == true or not n then complete = n - n = texgetcount("realpageno") + n = texgetcount(c_realpageno) end if n > nofpages then nofpages = n diff --git a/tex/context/base/mkxl/lpdf-rul.lmt b/tex/context/base/mkxl/lpdf-rul.lmt index ca38dcaa8..2c8227be9 100644 --- a/tex/context/base/mkxl/lpdf-rul.lmt +++ b/tex/context/base/mkxl/lpdf-rul.lmt @@ -146,9 +146,7 @@ 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) 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) diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt index f0b132d66..7fb4f9b9f 100644 --- a/tex/context/base/mkxl/math-act.lmt +++ b/tex/context/base/mkxl/math-act.lmt @@ -23,6 +23,11 @@ local trace_tweaking = false trackers.register("math.tweaks", function(v) local report_math = logs.reporter("mathematics","initializing") local report_mathtweak = logs.reporter("mathematics","tweak") +local getfontoffamily = tex.getfontoffamily +local fontcharacters = fonts.hashes.characters +local chardata = characters.data +local extensibles = mathematics.extensibles + local context = context local commands = commands local mathematics = mathematics @@ -166,28 +171,6 @@ function mathematics.checkaccentbaseheight(target,original) end end --- function mathematics.checkprivateparameters(target,original) --- local mathparameters = target.mathparameters --- if mathparameters then --- local parameters = target.parameters --- local properties = target.properties --- if parameters then --- local size = parameters.size --- if size then --- -- gone --- elseif properties then --- report_math("invalid parameters in font %a",properties.fullname or "?") --- else --- report_math("invalid parameters in font") --- end --- elseif properties then --- report_math("no parameters in font %a",properties.fullname or "?") --- else --- report_math("no parameters and properties in font") --- end --- end --- end - function mathematics.overloadparameters(target,original) if use_math_goodies then local mathparameters = target.mathparameters @@ -200,6 +183,8 @@ function mathematics.overloadparameters(target,original) if mathematics then local parameters = mathematics.parameters local bigslots = mathematics.bigslots or mathematics.bigs +-- inspect(parameters) +-- print("before",mathparameters.AxisHeight) if parameters then if trace_defining then report_math("overloading math parameters in %a @ %p",target.properties.fullname,target.parameters.size) @@ -222,6 +207,7 @@ function mathematics.overloadparameters(target,original) end mathparameters[name] = newvalue end +-- print("after ",mathparameters.AxisHeight) for name, value in next, parameters do local tvalue = type(value) if tvalue == "string" then @@ -265,7 +251,7 @@ local function report_tweak(fmt,target,original,...) (target and target .shared.rawdata.metadata) local parameters = target.parameters report_mathtweak( - "%a, size %p, math size %i, %s", + "%a, size %P, math size %i, %s", metadata and metadata.fontname or "unknown", parameters.size or 655360, parameters.mathsize or 1, @@ -276,6 +262,39 @@ local function report_tweak(fmt,target,original,...) end end +mathtweaks.subsets = { + acenorsuvxz = { 0x1D44E, 0x1D450, 0x1D452, 0x1D45B, 0x1D45C, 0x1D45F, 0x1D460, 0x1D462, 0x1D463, 0x1D465, 0x1D467 }, + bhklt = { 0x1D44F, 0x1D455, 0x1D458, 0x1D459, 0x1D461 }, + d = { 0x1D451 }, + f = { 0x1D453 }, + gjqy = { 0x1D454, 0x1D457, 0x1D45E, 0x1D466 }, + i = { 0x1D456 }, + mw = { 0x1D45A, 0x1D464 }, + p = { 0x1D45D }, + dotless = { 0x00049, 0x0004A, 0x00131, 0x00237, 0x1D6A4, 0x1D6A5 }, + integrals = { 0x0222B, 0x0222C, 0x0222D, 0x0222E, 0x0222F, 0x02230, 0x02231, 0x02232, 0x02233, 0x02A0B, 0x02A0C, 0x02A0D, 0x02A0E, 0x02A0F, 0x02A10, 0x02A11, 0x02A12, 0x02A13, 0x02A14, 0x02A15, 0x02A16, 0x02A17, 0x02A18, 0x02A19, 0x02A1A, 0x02A1B, 0x02A1C }, +} + +local function getalso(target,original) + local also = target.tweakalso -- maybe + if not also then + also = { } + for k, v in sortedhash(target.characters) do + local u = v.unicode + if u and k ~= u then + local a = also[u] + if a then + a[#a+1] = k + else + also[u] = { k } + end + end + end + target.tweakalso = also + end + return also +end + -- { -- tweak = "dimensions", -- list = { @@ -398,32 +417,33 @@ do extend = factor, }, v) end - local original = v.original - if not original then + local originalslot = v.original + if not originalslot then local delta = v.delta if delta then - original = k + delta + originalslot = k + delta end end - if original then - original = mathgaps[original] or original - local data = targetcharacters[original] + if originalslot then + originalslot = mathgaps[originalslot] or originalslot + local data = targetcharacters[originalslot] if data then data = copytable(data) - data.unicode = original + data.unicode = originalslot targetcharacters[k] = data character = data else - report_mathtweak("no slot %U",original) + report_mathtweak("no slot %U",originalslot) return end end -- - local width = character.width - local height = character.height - local depth = character.depth - local italic = character.italic - local topaccent = character.topaccent + local width = character.width + local height = character.height + local depth = character.depth + local italic = character.italic + local topanchor = character.topanchor + local bottomanchor = character.bottomanchor -- local widthfactor = v.width local heightfactor = v.height @@ -442,7 +462,7 @@ do if advancefactor then character.advance = advancefactor * width else - character.advance = width -- so advance is oldwidth + character.advance = character.advance or width -- so advance is oldwidth end if widthfactor then character.width = widthfactor * width @@ -470,8 +490,11 @@ do end end if anchorfactor then - character.topaccent = anchorfactor * (topaccent or width) + character.topanchor = anchorfactor * (topanchor or width) end +-- if anchorfactor then +-- character.bottomaccent = anchorfactor * (bottomanchor or width) +-- end -- begin experiment local line = v.wline if line then @@ -575,12 +598,26 @@ end do + function mathtweaks.showinfo(target,original,parameters) + local mathparameters = target.mathparameters + for k, v in sortedhash(mathparameters) do + report_mathtweak("%s : %s",k,v) + end + end + +end + + +do + function mathtweaks.wipevariants(target,original,parameters) local list = parameters.list if list then local targetcharacters = target.characters -- local originalcharacters = original.characters local count = 0 + -- local also = getalso(target,original) + -- local done = { } for k, v in sortedhash(list) do local ori = targetcharacters[k] local nxt = ori.next @@ -675,17 +712,6 @@ do -- maybe we'll have a different name - mathtweaks.subsets = { - acenorsuvxz = { 0x1D44E, 0x1D450, 0x1D452, 0x1D45B, 0x1D45C, 0x1D45F, 0x1D460, 0x1D462, 0x1D463, 0x1D465, 0x1D467 }, - bhklt = { 0x1D44F, 0x1D455, 0x1D458, 0x1D459, 0x1D461 }, - d = { 0x1D451 }, - f = { 0x1D453 }, - gjqy = { 0x1D454, 0x1D457, 0x1D45E, 0x1D466 }, - i = { 0x1D456 }, - mw = { 0x1D45A, 0x1D464}, - p = { 0x1D45D }, - } - function mathtweaks.kernpairs(target,original,parameters) local list = parameters.list if list then @@ -749,37 +775,11 @@ end do - -- What a mess ... should be a different alphabet. - - local function expand(target,original,list,selector,feature) - if feature then - local getsubstitution = fonts.handlers.otf.getsubstitution - for _, char in next, list do - local variant = getsubstitution(original,char,feature,true) - if variant then - mathematics.addvariant(target,char,variant,selector) - end - end - else - for i, char in next, list do - mathematics.addvariant(target,char,0xFE800+i,selector) - end - end - end - function mathtweaks.variants(target,original,parameters) - local feature = parameters.feature - local selector = parameters.selector - local kind = parameters.kind - if kind == "script" then - if selector then - expand(target,original,mathematics.alphabets.sr.tf.lcletters,selector,feature) - expand(target,original,mathematics.alphabets.sr.tf.ucletters,selector,feature) - end - end + report_mathtweak("todo: remove 'variants' tweak from goodie file") end - mathtweaks.variant = mathtweaks.variants + mathtweaks.variant = mathtweaks.variants end @@ -1052,80 +1052,219 @@ do local factor = tonumber(parameters.factor) or 0 if factor ~= 0 then for k, v in next, targetcharacters do - local a = v.topaccent + local a = v.topanchor if a and a > 0 then - v.topaccent = a * factor + v.topanchor = a * factor end end end end - -- local default = { - -- "digitsnormal", - -- "lowercasedoublestruck", - -- "uppercasedoublestruck", - -- } + mathtweaks.fixaccents = mathtweaks.fixanchors + +end + +do + + -- actually this should be a an engine feature driven by category because we don't + -- want this in display mode .. only a test for MS and HH + + local issymbol = characters.is_symbol + + function mathtweaks.oldstylemath(target,original,parameters) + local characters = target.characters + local axis = target.mathparameters.AxisHeight + local delta = (parameters.factor or .1) * axis + target.mathparameters.AxisHeight = (axis - delta) + for k, v in sortedhash(characters) do + if issymbol[k] then -- quick hack, engine knows + v.yoffset = -delta + v.height = (v.height or 0) - delta + v.depth = (v.depth or 0) - delta + end + end + end - local function wipe(target,original,parameters,field) - local targetcharacters = target.characters +end + +do + + function mathtweaks.simplifykerns(target,original,parameters) + local characters = target.characters + local simplified = 0 + for k, v in sortedhash(characters) do + local mathkerns = v.mathkerns + if mathkerns then + local k = mathkerns.topleft + if k then + k = k[#k].kern + if k then + v.topleft = k + end + end + local k = mathkerns.topright + if k then + k = k[#k].kern + if k then + v.topright = k + end + end + local k = mathkerns.bottomleft + if k then + k = k[1].kern -- todo get value at baseline + if k then + v.bottomleft = k + end + end + local k = mathkerns.bottomright + if k then + k = k[1].kern -- todo get value at baseline + if k then + v.bottomright = k + end + end + v.mathkerns = nil + simplified = simplified + 1 + end + end + if simplified == 0 then + report_tweak("no need to simplify mathkerns",target,original) + elseif trace_tweaking then + report_tweak("%i mathkerns simplified",target,original,simplified) + end + end + +end + +do + + local function wipe(target,original,parameters,field,move,integrals) + local targetcharacters = target.characters + local targetdescriptions = target.descriptions + local factor = target.parameters.factor + local correct = parameters.correct + local function getllx(u) + local d = targetdescriptions[u] + if d then + local b = d.boundingbox + if b then + local llx = b[1] + if llx < 0 then + return - llx + end + end + end + return false + end local function step(s,l) - local done = false while s do - local c = targetcharacters[mathgaps[s] or s] + local u = mathgaps[s] or s + local c = targetcharacters[u] if c then - local v = c[field] - if v then - if trace_tweaking then - if l then - report_tweak("removing %a in range %a from %C",target,original,field,l,s) + if field == "topanchor" then + if c.topanchor then + c.topanchor = nil + else + goto smaller + end + else + local done = false + local italic = c.italic + if move then + local width = c.width or 0 + c.advance = width + if correct then + local llx = getllx(u) + if llx then + local topanchor = c.topanchor + llx = llx * factor + width = width + llx + c.xoffset = llx + if topanchor then + c.topanchor = topanchor + llx + end +-- if c.bottomleft or c.topleft then +-- print("BEFORE",c.bottomleft,c.topleft,llx) +-- c.bottomleft = (c.bottomleft or 0) - llx +-- c.topleft = (c.topleft or 0) - llx +-- print("AFTER",c.bottomleft,c.topleft,llx) +-- else + c.bottomleft = (c.bottomleft or 0) - llx + c.topleft = (c.topleft or 0) - llx +-- end + done = true + end + end + if italic and italic ~= 0 then + c.width = width + italic +-- print(">>>",bottomright) + c.bottomright = - italic +-- c.bottomright = c.bottomright - italic + done = true else - report_tweak("removing %a from %C",target,original,field,s) + c.width = width end end - c[field] = nil - done = true + if italic then + c.italic = nil + done = true + end + if not done then + goto smaller + end end + if trace_tweaking then + if l then + report_tweak("%s %a in range %a from %C","removing",target,original,field,l,s) + else + report_tweak("%s %a from %C","removing",target,original,field,s) + end + end + goto smaller + ::smaller:: s = c.smaller else break end end - return done end local list = parameters.list -- todo: ranges - -- if list == "default" then - -- list = default - -- else if type(list) == "string" then list = { list } end for i=1,#list do local l = list[i] - local r = blocks[l] - if r then - local done = false - for i=r.first,r.last do - if step(i,l) then - done = true - end - end - if not done and trace_tweaking then - report_mathtweak("there is no need to remove %a range %a",field,l) + if type(l) == "table" then + for i=1,#l do + step(i,l[i]) end else - stepper(l,step) + local r = blocks[l] + if r then + for i=r.first,r.last do + step(i,l) + end + else + stepper(l,step) + end end end end function mathtweaks.wipeanchors(target,original,parameters) - wipe(target,original,parameters,"topaccent") + wipe(target,original,parameters,"topanchor") end + mathtweaks.wipeaccents = mathtweaks.wipeanchors + function mathtweaks.wipeitalics(target,original,parameters) wipe(target,original,parameters,"italic") end + function mathtweaks.moveitalics(target,original,parameters) + wipe(target,original,parameters,"italic",true) + end + -- function mathtweaks.fixdigits(target,original,parameters) -- mathtweaks.fixanchors(target,original,{ list = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } }) -- end @@ -1134,6 +1273,88 @@ end do + function mathtweaks.topanchors(target,original,parameters) + local characters = target.characters + local list = parameters.list + if list then + for k, v in sortedhash(list) do + local c = characters[k] + if c then + local w = c.width + if w and w ~= 0 then + c.topanchor = v * w + if trace_tweaking then + -- todo + end + end + end + end + -- todo: small + end + end + + mathtweaks.topaccents = mathtweaks.topanchors + + function mathtweaks.limits(target,original,parameters) + local characters = target.characters + local list = parameters.list + if list then + local factor = parameters.factor or 1 + local also = getalso(target,original) + local done = { } + local function relocate(u,factor) + if done[u] then + return + end + done[u] = true + local c = characters[u] + if c then + local italic = c.italic + if italic and italic ~= 0 then + local width = c.width or 0 + local half = (italic/2) * factor + c.topanchor = width + half + c.bottomanchor = width - half + c.bottomright = - italic + c.italic = nil + if trace_tweaking then + -- todo + end + end + local s = c.smaller + if s then + relocate(s,factor) + end + local n = c.next + if n then + relocate(n,factor) + end + if also then + local a = also[u] + if a then + for i=1,#a do + relocate(a[i],factor) + end + end + end + end + end + if #list > 0 then + for i=1,#list do + relocate(list[i],factor) + end + else + for k, v in sortedhash(list) do + relocate(k,tonumber(v) or factor) + end + end + end + end + +end + +do + -- musical timestamp: March 2022, Antonio Sanches (Bad Hombre), live performance in NL function mathtweaks.kerns(target,original,parameters) @@ -1178,12 +1399,14 @@ do local characters = target.characters local function setone(unicode,data) local chardata = characters[mathgaps[unicode] or unicode] - local width = chardata.width or 0 - local total = (chardata.height or 0) + (chardata.depth or 0) - local k = data.left ; if k and k ~= 0 then chardata.leftmargin = k * width end - local k = data.right ; if k and k ~= 0 then chardata.rightmargin = k * width end - local k = data.top ; if k and k ~= 0 then chardata.topmargin = k * total end - local k = data.bottom ; if k and k ~= 0 then chardata.bottommargin = k * total end + if chardata then + local width = chardata.width or 0 + local total = (chardata.height or 0) + (chardata.depth or 0) + local k = data.left ; if k and k ~= 0 then chardata.leftmargin = k * width end + local k = data.right ; if k and k ~= 0 then chardata.rightmargin = k * width end + local k = data.top ; if k and k ~= 0 then chardata.topmargin = k * total end + local k = data.bottom ; if k and k ~= 0 then chardata.bottommargin = k * total end + end end for unicode, data in next, margins do setone(unicode,data) -- withscriptcode(tfmdata,unicode,data,kernone) @@ -1398,39 +1621,39 @@ end do - local addprivate = fonts.helpers.addprivate - local privateslot = fonts.helpers.privateslot - - -- function mathtweaks.addrules(target,original,parameters) - -- local characters = target.characters - -- local height = target.mathparameters.OverbarRuleThickness - -- local depth = target.mathparameters.UnderbarRuleThickness - -- local width = target.parameters.emwidth/2 - -- local step = 0.8 * width - -- characters[0x203E] = { -- over - -- width = width, - -- height = height, - -- depth = 0, - -- unicode = 0x203E, - -- commands = { { "rule", height, width } }, - -- hparts = { - -- { advance = width, ["end"] = step, glyph = 0x203E, start = 0 }, - -- { advance = width, ["end"] = 0, glyph = 0x203E, start = step, extender = 1 }, - -- } - -- } - -- characters[0x0332] = { -- under - -- width = width, - -- height = 0, - -- depth = depth, - -- yoffset = -depth, - -- unicode = 0x0332, - -- commands = { { "rule", height, width } }, - -- hparts = { - -- { advance = width, ["end"] = step, glyph = 0x0332, start = 0 }, - -- { advance = width, ["end"] = 0, glyph = 0x0332, start = step, extender = 1 }, - -- } - -- } - -- end + local addprivate = fonts.helpers.addprivate + local privateslot = fonts.helpers.privateslot + + -- function mathtweaks.addrules(target,original,parameters) + -- local characters = target.characters + -- local height = target.mathparameters.OverbarRuleThickness + -- local depth = target.mathparameters.UnderbarRuleThickness + -- local width = target.parameters.emwidth/2 + -- local step = 0.8 * width + -- characters[0x203E] = { -- over + -- width = width, + -- height = height, + -- depth = 0, + -- unicode = 0x203E, + -- commands = { { "rule", height, width } }, + -- hparts = { + -- { advance = width, ["end"] = step, glyph = 0x203E, start = 0 }, + -- { advance = width, ["end"] = 0, glyph = 0x203E, start = step, extender = 1 }, + -- } + -- } + -- characters[0x0332] = { -- under + -- width = width, + -- height = 0, + -- depth = depth, + -- yoffset = -depth, + -- unicode = 0x0332, + -- commands = { { "rule", height, width } }, + -- hparts = { + -- { advance = width, ["end"] = step, glyph = 0x0332, start = 0 }, + -- { advance = width, ["end"] = 0, glyph = 0x0332, start = step, extender = 1 }, + -- } + -- } + -- end function mathtweaks.addrules(target,original,parameters) local characters = target.characters @@ -1787,6 +2010,9 @@ end do + -- mirror + -- smaller + local list = { 0x221A, } @@ -1802,11 +2028,19 @@ do end data.height = depth data.depth = height +if data.rorrim then + -- the original does the magic +else data.yoffset = depth - height +end + end + local smaller = data.smaller + if smaller then + fix(target,original,characters,smaller) end - local small = data.smaller - if small then - fix(target,original,characters,small) + local mirror = data.mirror + if mirror then + fix(target,original,characters,mirror) end end end @@ -1823,6 +2057,70 @@ end do + local done = nil + + local function fix(target,original,characters,unicode,axis) + if done[unicode] then + return + end + done[unicode] = true + local data = characters[unicode] + if data then + local height = data.height or 0 + local depth = data.depth or 0 + if trace_tweaking then + report_tweak("swapping height and depth of %U",target,original,unicode) + end + local half = (height + depth)/2 + if data.rorrim then + -- the original does the magic + else + data.yoffset = depth - (half - axis) + end + height = half + axis + depth = half - axis + data.height = height + data.depth = depth + local smaller = data.smaller + if smaller then + fix(target,original,characters,smaller,axis) + end + local mirror = data.mirror + if mirror then + fix(target,original,characters,mirror,axis) + end + local next = data.next + if next then + fix(target,original,characters,next,axis) + end + end + end + + function mathtweaks.fixoldschool(target,original,parameters) + local characters = target.characters + local list = mathtweaks.subsets.integrals + local also = getalso(target,original) + local axis = target.mathparameters.AxisHeight + done = { } + for i=1,#list do + local unicode = list[i] + fix(target,original,characters,unicode,axis) + end + if also then + local a = also[u] + if a then + for i=1,#a do + fix(target,original,characters,a[i],axis) + end + end + end + done = nil + end + +end + +do + local list = { 0x2061, 0x2062, 0x2063, 0x2064 } function mathtweaks.wipecues(target,original,parameters) @@ -1896,12 +2194,12 @@ characters[hat] = copytable(characters[0x0302]) -- TODO local alias = entry[1] local stretchingdata = characters[stretching] if stretchingdata and stretchingdata.width == 0 then - local topaccent = stretchingdata.topaccent or 0 - local width = -topaccent - topaccent = width/2 + local topanchor = stretchingdata.topanchor or 0 + local width = -topanchor + topanchor = width/2 stretchingdata.width = width - stretchingdata.topaccent = topaccent - stretchingdata.commands = { rightcommand[width + topaccent], charcommand[stretching] } + stretchingdata.topanchor = topanchor + stretchingdata.commands = { rightcommand[width + topanchor], charcommand[stretching] } if trace_tweaking then report_tweak("width of initial extensible accent %U set",target,original,stretching) end @@ -1925,7 +2223,7 @@ characters[hat] = copytable(characters[0x0302]) -- TODO local flataccent = last.flataccent if flataccent then characters[flataccent].extensible = true - end + end break end end @@ -1947,7 +2245,7 @@ characters[hat] = copytable(characters[0x0302]) -- TODO depth = stretchingdata.depth, next = stretchingdata.next, commands = { charcommand[stretching] }, - topaccent = stretchingdata.topaccent, + topanchor = stretchingdata.topanchor, -- unicode = stretching, -- when we aliasize to combiners unicode = alias, -- when we keep the original } @@ -2018,7 +2316,9 @@ do local linewidth = target.MathConstants.RadicalRuleThickness -- make option local basechar = characters[radical] local baseheight = basechar.height +/2 local basedepth = basechar.depth +/2 local basetotal = baseheight + basedepth local used = baseheight -- @@ -2188,7 +2488,7 @@ do } } if trace_tweaking then - report_tweak("fourier %U added using %U",target,original,basecode,fourier) + report_tweak("fourier %U added using %U",target,original,basecode,fouriercode) end end end @@ -2284,17 +2584,17 @@ do function mathtweaks.fixellipses(target,original,parameters) local characters = target.characters local function fix(normal,raised) - local normalone = characters[normal] - if normalone then - local raisedone = copytable(normalone) - characters[raised] = raisedone - raisedone.unicode = weird - local height = raisedone.height + local normaldata = characters[normal] + if normaldata then + local raiseddata = copytable(normaldata) + characters[raised] = raiseddata + raiseddata.unicode = raised + local height = raiseddata.height local yoffset = (parameters.yoffset or 2) * height - raisedone.yoffset = yoffset - raisedone.height = height + yoffset + raiseddata.yoffset = yoffset + raiseddata.height = height + yoffset if trace_tweaking then - report_tweak("taking %U from %U",target,original,weird,normal) + report_tweak("taking %U from %U",target,original,raised,normal) end end end @@ -2358,6 +2658,163 @@ end do + -- We started with the list that xits has in rtlm but most of them can be derived from + -- the database, and others need to be added. + + -- Checked while watching/listening to Dave Matthews Band: The Central Park Concert + -- (with superb solos by Warren Haynes), a DVD I bought around when we started with the + -- LUATEX advanture. + + local mirrors = { + + [0x0002F] = true, -- slashes + [0x0005C] = true, + [0x000F7] = true, + + [0x02032] = true, -- primes + [0x02033] = true, + [0x02034] = true, + [0x02057] = true, + [0x02035] = true, + [0x02036] = true, + [0x02037] = true, + + [0x0221A] = true, -- radicals + [0x0221B] = true, + [0x0221C] = true, + [0x0221D] = true, + + [0x0222B] = true, -- integrals + [0x0222C] = true, + [0x0222D] = true, + [0x0222E] = true, + [0x0222F] = true, + [0x02230] = true, + [0x02231] = true, + [0x02232] = true, + [0x02233] = true, + + [0x02A0A] = true, -- seen in xits (to be checked) + [0x02A0B] = true, + [0x02A0C] = true, + [0x02A0D] = true, + [0x02A0E] = true, + + [0x02140] = true, + [0x02201] = true, + [0x02202] = true, + [0x02203] = true, + [0x02204] = true, + [0x02211] = true, + + [0x02239] = true, + [0x0225F] = true, + [0x0228C] = true, + [0x022A7] = true, + [0x022AA] = true, + [0x022AC] = true, + [0x022AD] = true, + [0x022AE] = true, + [0x022AF] = true, + [0x022F5] = true, + [0x022F8] = true, + [0x022F9] = true, + [0x022FF] = true, + [0x02320] = true, + [0x02321] = true, + [0x027C0] = true, + [0x029DC] = true, + [0x029F4] = true, + + [0x02A0F] = true, + [0x02A10] = true, + [0x02A11] = true, + [0x02A12] = true, + [0x02A13] = true, + [0x02A14] = true, + [0x02A15] = true, + [0x02A16] = true, + [0x02A17] = true, + [0x02A18] = true, + [0x02A19] = true, + [0x02A1A] = true, + [0x02A1B] = true, + [0x02A1C] = true, + [0x02A20] = true, + + [0x02A74] = true, + [0x02AA3] = true, + [0x02AE2] = true, + [0x02AE6] = true, + [0x1D715] = true, + } + + local new = fonts.helpers.newprivateslot + + local function add(target,original,characters,unicode,what) + local data = characters[unicode] + if data then + if not data.mirror then + local slot = new("mirror."..unicode) + local mirror = copytable(data) + data.mirror = slot + mirror.rorrim = unicode -- so we can check later + mirror.commands = { + { "offset", data.width, 0, unicode, -1, 1 } + } + if trace_tweaking then + report_tweak("adding mirror %U (%s)",target,original,unicode,what) + end + characters[slot] = mirror + elseif trace_tweaking then + report_tweak("skipping mirror %U (%s)",target,original,unicode,what) + end + local hparts = data.hparts + if hparts then + for i=1,#hparts do + add(target,original,characters,hparts[i],"hpart") + end + end + local vparts = data.vparts + if vparts then + for i=1,#vparts do + add(target,original,characters,vparts[i],"vpart") + end + end + local smaller = data.smaller + if smaller then + add(target,original,characters,"smaller") + end + local next = data.next + if next then + add(target,original,characters,next,"next") + end + end + end + + -- todo: also check the rtlm table if present + + function mathtweaks.addmirrors(target,original,parameters) + local characters = target.characters + for unicode, detail in sortedhash(characters) do + local data = chardata[unicode] + if data and data.mirror then + add(target,original,characters,unicode,"mirror") + end + end + for unicode, detail in sortedhash(mirrors) do + if characters[unicode] then + add(target,original,characters,unicode,"character") + elseif trace_tweaking then + report_tweak("ignoring mirror %U (%s)",target,original,unicode,what) + end + end + end + +end + +do + local reported = { } function mathtweaks.version(target,original,parameters) @@ -2380,6 +2837,215 @@ do report_tweak() end reported[fontname] = true + target.tweakversion = version + end + end + end + +end + +do + + function mathtweaks.diagnose(target,original,parameters) + local characters = target.characters + for k, v in sortedhash(characters) do + local italic = v.italic + if italic then + report_tweak("italics: %U %p",target,original,k,italic) + end + end +-- inspect(characters[0xF0929]) + end + +end + +do + + function mathtweaks.setoptions(target,original,parameters) + local setlist = parameters.set or parameters.list + local resetlist = parameters.reset + if setlist or resetlist then + local properties = target.properties + local codes = tex.mathcontrolcodes + local oldcontrol = tex.get("mathfontcontrol") + local newcontrol = oldcontrol + -- todo: reset + if resetlist then + for i=1,#resetlist do + local v = tonumber(codes[resetlist[i]]) + if v then + newcontrol = newcontrol & (not v) + end + end + end + if setlist then + for i=1,#setlist do + local v = tonumber(codes[setlist[i]]) + if v then + newcontrol = newcontrol | v + end + end + end + newcontrol = newcontrol | codes.usefontcontrol + properties.mathcontrol = newcontrol + target.mathcontrol = newcontrol + if trace_tweaking then + report_tweak("forcing math font options 0x%08X instead of 0x08X",target,original,newcontrol,oldcontrol) + end + end + end + +end + +do + + function mathtweaks.setovershoots(target,original,parameters) + local list = parameters.list + if list then + local characters = target.characters + local emwidth = target.parameters.quad + for i=1,#list do + local entry = list[i] + local target = entry.target + local top = entry.topovershoot + local quad = entry.quad + if target and top then + local range = blocks[target] + if range then + if quad then + quad = emwidth + end + for r = range.first, range.last do + local unicode = mathgaps[r] or r + local data = characters[unicode] + if data then + data.topovershoot = top * (quad or data.width or 0) + end + end + if trace_tweaking then + report_mathtweak("setting overshoots for %a",target) + end + end + end + end + end + end + + -- there is no real need for thios but let's play nice with memory anyway + + local efindex = 0 + local effects = setmetatableindex (function (t,k) + efindex = efindex + 1 + local v = "tweakreplacealphabets" .. efindex + local e = fonts.specifiers.presetcontext(v,"",k) + -- print(k,v,e) + t[k] = v + return v + end) + + function mathtweaks.replacealphabets(target,original,parameters) + local feature = parameters.feature + local features = target.specification.features.normal + if not feature or features[feature] == true then + local list = parameters.list + if list then + local definedfont = fonts.definers.internal + local copiedglyph = fonts.handlers.vf.math.copy_glyph +-- does a deep copy, including parts and so + local getsubstitution = fonts.handlers.otf.getsubstitution + local fontdata = fonts.hashes.identifiers + -- + local fonts = target.fonts + local size = target.size + local characters = target.characters + -- compact: size = 655360 + if not fonts then + fonts = { } + target.fonts = fonts + end + if #fonts == 0 then + fonts[1] = { id = 0, size = size } -- self, will be resolved later + end + for i=1,#list do + local entry = list[i] + local filename = entry.filename + local feature = entry.feature + local thesource = entry.source + local thetarget = entry.target or thesource + if thesource and thetarget then + local sourcerange = type(thesource) == "table" and thesource or blocks[thesource] -- .gaps + local targetrange = type(thetarget) == "table" and thetarget or blocks[thetarget] -- .gaps + if sourcerange and targetrange then + local firsttarget = targetrange.first + local firstsource = sourcerange.first + local lastsource = sourcerange.last or firstsource + if firstsource and firsttarget then + local offset = firsttarget - firstsource + local topovershoot = entry.topovershoot + if filename then + local rscale = entry.rscale or 1 -- todo + size = size * rscale -- maybe use scale in vf command + -- load font, todo: set language and script, the effect hack is ugly + local fullname = filename + local effect = features.effect + if effect then + fullname = fullname .. "*" .. effects["effect={"..effect.."}"] + end + local id = definedfont { + name = fullname, + size = size, + } + local chars = fontchars[id] + local dropin = fontdata[id] + local index = #fonts + 1 + fonts[index] = { id = id, size = size } + -- copy characters + for s=firstsource,lastsource do + local t = s + offset + local sourceunicode = mathgaps[s] or s + local targetunicode = mathgaps[t] or t + if feature then + sourceunicode = getsubstitution(dropin,sourceunicode,feature,true,"math","dflt") or sourceunicode + end + if trace_tweaking then + report_mathtweak("copying %s %U from file %a to %s %U",thesource,sourceunicode,filename,thetarget,targetunicode) + end + characters[targetunicode] = copiedglyph(target,characters,chars,sourceunicode,index) + end + elseif feature then + for s=firstsource,lastsource do + local t = s + offset + local sourceunicode = mathgaps[s] or s + local targetunicode = mathgaps[t] or t + local variant = getsubstitution(original,sourceunicode,feature,true,"math","dflt") + local data = characters[variant] + if data then + if trace_tweaking then + report_mathtweak("copying %s %U from feature %a to %s %U",thesource,sourceunicode,feature,thetarget,targetunicode) + end + characters[targetunicode] = copytable(data) + end + end + else + for s=firstsource,lastsource do + local t = s + offset + local sourceunicode = mathgaps[s] or s + local targetunicode = mathgaps[t] or t + local data = characters[sourceunicode] + if data then + if trace_tweaking then + report_mathtweak("copying %s %U to %s %U",thesource,sourceunicode,thetarget,targetunicode) + end + characters[targetunicode] = copytable(data) + end + end + end + else + -- error + end + end + end + end end end end @@ -2418,7 +3084,10 @@ local function applytweaks(when,target,original) if type(tweak) == "table" then local action = mathtweaks[tweak.tweak or ""] if action then - if original then + local version = tweak.version + if version and version ~= target.tweakversion then + report_math("skipping tweak %a version %a",tweak.tweak,version) + elseif original then action(target,original,tweak) else action(target,tweak) @@ -2456,6 +3125,65 @@ function mathematics.tweakaftercopyingfont(target,original) end end +do + + local defaults = { + { + source = "uppercasescript", + target = "uppercasecalligraphic", + }, + { + source = "lowercasescript", + target = "lowercasecalligraphic", + }, + { + source = "uppercaseboldscript", + target = "uppercaseboldcalligraphic", + }, + { + source = "lowercaseboldscript", + target = "lowercaseboldcalligraphic", + }, + } + + function mathematics.checkaftercopyingfont(target,original) + local mathparameters = target.mathparameters -- why not hasmath + if mathparameters then + local characters = target.characters + -- + for i=1,#defaults do + -- we assume no ssty here yet .. todo + local default = defaults[i] + local block = blocks[default.target] + local first = block.first + local last = block.last + if not characters[mathgaps[first] or last] then + mathtweaks.replacealphabets(target,original,{ + tweak = "replacealphabets", + list = { default } + }) + end + end + -- + local addvariant = mathematics.addvariant + local function register(old,new) + for i, cold in next, old do + local cnew = new[i] + addvariant(target,cold,cold,0xFE00) + addvariant(target,cnew,cnew,0xFE01) + addvariant(target,cnew,cold,0xFE00) + addvariant(target,cold,cnew,0xFE01) + end + end + local sr = mathematics.alphabets.sr.tf + local ca = mathematics.alphabets.ca.tf + register(sr.ucletters,ca.ucletters) + register(sr.lcletters,ca.lcletters) + end + end + +end + function mathematics.beforepassingfonttotex(target) if use_math_goodies then local mathparameters = target.mathparameters -- why not hasmath @@ -2472,20 +3200,13 @@ sequencers.appendaction("mathparameters","system","mathematics.checkaccentbasehe sequencers.appendaction("beforecopyingcharacters","system","mathematics.tweakbeforecopyingfont") sequencers.appendaction("aftercopyingcharacters", "system","mathematics.tweakaftercopyingfont") +sequencers.appendaction("aftercopyingcharacters", "system","mathematics.checkaftercopyingfont") sequencers.appendaction("beforepassingfonttotex", "system","mathematics.beforepassingfonttotex") -- no, it's a feature now (see good-mth): -- -- sequencers.appendaction("aftercopyingcharacters", "system","mathematics.overloaddimensions") --- helpers - -local getfontoffamily = tex.getfontoffamily - -local fontcharacters = fonts.hashes.characters -local chardata = characters.data -local extensibles = mathematics.extensibles - -- we use numbers at the tex end (otherwise we could stick to chars) local e_left = extensibles.left @@ -2657,7 +3378,7 @@ function mathematics.finishfallbacks(target,specification,fallbacks) if trace_collecting then report_math("adding fallback characters to font %a",specification.hash) end - local definedfont = fonts.definers.internal + ----- definedfont = fonts.definers.internal local copiedglyph = fonts.handlers.vf.math.copy_glyph local fonts = target.fonts local size = specification.size -- target.size diff --git a/tex/context/base/mkxl/math-ali.mkxl b/tex/context/base/mkxl/math-ali.mkxl index b6b037117..af6b48cee 100644 --- a/tex/context/base/mkxl/math-ali.mkxl +++ b/tex/context/base/mkxl/math-ali.mkxl @@ -1011,12 +1011,12 @@ \ifmmode\stopimath\fi \hfil \aligntab - \hskip\mathcasesparameter\c!distance\relax + \kern\mathcasesparameter\c!distance\relax % hskip \math_cases_strut % looks better \aligncontent \hfil \aligntab - \hskip\mathcasesparameter\c!numberdistance\relax + \kern\mathcasesparameter\c!numberdistance\relax % hskip \span\math_text_in_eqalign{\aligncontent}% \crcr} % todo: number @@ -1286,7 +1286,7 @@ \math_matrix_anchor % \ifdim\d_math_eqalign_distance>\zeropoint % \ifbitwiseand\c_math_matrix_anchor_mode\plustwo - % \hskip.5\d_math_eqalign_distance + % \kern.5\d_math_eqalign_distance % \fi % \fi \fi} @@ -1296,7 +1296,7 @@ \ifcase\c_math_matrix_anchor_mode\else % \ifdim\d_math_eqalign_distance>\zeropoint % \ifbitwiseand\c_math_matrix_anchor_mode\plusfour - % \hskip.5\d_math_eqalign_distance + % \kern.5\d_math_eqalign_distance % \fi % \fi \math_matrix_anchor @@ -1312,7 +1312,7 @@ \aligntab \aligntab \math_matrix_anchor - \hskip.5\d_math_eqalign_distance % kern + \kern.5\d_math_eqalign_distance % hskip \aligncontent \aligntab \global\advance\c_math_eqalign_column\plusone @@ -1358,27 +1358,40 @@ \dousecolorparameter\p_rulecolor \fi} -% \noaligned\permanent\tolerant\protected\def\math_matrix_HL[#1]#*% -% {\noalign\bgroup -% \math_matrix_check_rule[#1]% -% \divide\scratchdimen\plustwo -% \autorule\s!height\scratchdimen\s!depth\scratchdimen\relax -% \egroup} -% -% \permanent\tolerant\protected\def\math_matrix_VL[#1]#*% -% {\NC -% \math_matrix_check_rule[#1]% -% \divide\d_math_eqalign_distance\plustwo -% \hskip-\d_math_eqalign_distance -% \autorule\s!width\scratchdimen\relax -% \hskip-\d_math_eqalign_distance -% \NC} - % These offset are an experiment so we abuse some existing keys or we have to % cook up new ones. Maybe we then should provide small medium big halfline etc. % but all depends on actual demand for this feature. +% Musical timestamp VL, NL, SL: Bad Hombre II by Antonio Sanches +% +% \startformula +% \startmatrix[left=\left(,right=\right)] +% \NC 0 \NL 0 \NC 0 \NC 2x \NC 1 \NC 0 \NC 0 \NL \NR +% \NC 0 \VL 0 \NC 0 \NC 0 \NC 2x \NC 0 \NC 0 \NL \NR +% \NC 0 \VL 0 \NC 0 \NC 0 \NC 0 \NC 3x \NC 0 \NL \NR +% \NC 0 \NL 0 \NC 0 \NC 0 \NC 0 \NC 0 \NC 4x \VL \NR +% \stopmatrix +% \stopformula +% +% \startformula +% \startmatrix[left=\left(,right=\right)] +% \SL[3] \NL \NL \NL \NL \NL \NR +% \VL 2x \NL 1 \NL 0 \VL 0 \NL 0 \NL 0 \NL 0 \NL \NR +% \VL 0 \NL 2x \NL 1 \VL 0 \NL 0 \NL 0 \NL 0 \NL \NR +% \VL 0 \NL 0 \NL 2x \VL 0 \NL 0 \NL 0 \NL 0 \NL \NR +% \SL[5] \NL \NL \NL \NR +% \NL 0 \NL 0 \NL 0 \VL 2x \NL 1 \VL 0 \NL 0 \NL \NR +% \NL 0 \NL 0 \NL 0 \VL 0 \NL 2x \VL 0 \NL 0 \NL \NR +% \NL \NL \NL \SL[3] \NL \NL \NR +% \NL 0 \NL 0 \NL 0 \NL 0 \NL 0 \VL 3x \VL 0 \NL \NR +% \NL \NL \NL \NL \NL \SL[2] \NL \NR +% \NL 0 \NL 0 \NL 0 \NL 0 \NL 0 \NL 0 \VL 3x \VL \NR +% \NL \NL \NL \NL \NL \NL \SL[1] \NL \NR +% \stopmatrix +% \stopformula + \definesystemattribute[mathalignmentvrule][public] +\definesystemattribute[mathalignmenthrule][public] \setupmathmatrix [%c!toffset=\zeropoint, @@ -1417,32 +1430,136 @@ \fi \egroup} -\protected\def\math_matrix_vertical_rule#1% - {\math_matrix_check_rule[#1]% +\protected\def\math_matrix_vertical_rule_indeed#1#2% + {\math_matrix_check_rule[#2]% \enablematrixrules - \vrule + #1 \s!attr \mathalignmentvruleattribute\plusone \s!width \scratchdimen \s!top -\dimexpr\mathmatrixparameter\c!toffset\relax \s!bottom-\dimexpr\mathmatrixparameter\c!boffset\relax \relax} +\protected\def\math_matrix_vertical_rule_yes{\math_matrix_vertical_rule_indeed\vrule } +\protected\def\math_matrix_vertical_rule_nop{\math_matrix_vertical_rule_indeed\novrule} + +\installcorenamespace{mathmatrixrulealternative} + +\newboundary\c_math_matrix_vl_boundary +%newboundary\c_math_matrix_sl_boundary + +\protected\def\math_matrix_horizontal_rule_indeed#1#2% + {\math_matrix_check_rule[#2]% + \global\setfalse\c_math_matrix_first + \global\settrue\c_math_matrix_sl_seen + \enablematrixrules + \leaders#1% + \s!attr \mathalignmenthruleattribute\plusone + \s!height .5\scratchdimen + \s!depth .5\scratchdimen + % \s!top -\dimexpr\mathmatrixparameter\c!toffset\relax + % \s!bottom-\dimexpr\mathmatrixparameter\c!boffset\relax + \hfilll + \kern\dimexpr.5\d_math_eqalign_distance\relax + \aligntab} + +\protected\def\math_matrix_horizontal_rule_yes{\math_matrix_horizontal_rule_indeed\hrule } +\protected\def\math_matrix_horizontal_rule_nop{\math_matrix_horizontal_rule_indeed\nohrule} + +\def\math_matrix_hrule_progress_rest#1% + {\expandedloop + \plusone + \numexpr(\ifchknum#1\or#1\else\c_math_matrix_columns\fi)*\plustwo+\minusone\relax + \plusone + {\span\omit}}% + +\def\math_matrix_hrule_progress_first#1% + {\expandedloop + \plusone + \numexpr(\ifchknum#1\or#1\else\c_math_matrix_columns\fi+\minusone)*\plustwo+\plusone\relax + \plusone + {\span\omit}}% + +\def\math_matrix_hrule_progress + {\NL + \ifconditional\c_math_matrix_first + \expandafter\math_matrix_hrule_progress_first + \else + \expandafter\math_matrix_hrule_progress_rest + \fi} + +\tolerant\permanent\protected\def\SL[#1]#*[#2]#*% [n] [name] | [name] | [n] + {\ifcsname\??mathmatrixrulealternative#2\endcsname + \lastnamedcs{#1}{#2}% + \orelse\ifcsname\??mathmatrixrulealternative#1\endcsname + \lastnamedcs{#2}{#1}% + \else + \csname\??mathmatrixrulealternative\v!auto\endcsname{#1}{#2}% + \fi} + +\defcsname\??mathmatrixrulealternative\v!auto\endcsname#1#2% + {\math_matrix_hrule_progress{#1}% + \ifnum\c_math_matrix_first=\zerocount + \kern-\dimexpr\linewidth\relax + \else + \kern-\dimexpr.5\d_math_eqalign_distance+\linewidth\relax + \fi + \math_matrix_horizontal_rule_yes{#2}% + %boundary\c_math_matrix_sl_boundary + \enforced\let\NR\math_matrix_NL_NR} \permanent\tolerant\protected\def\math_matrix_VL[#1]#*% {\span\omit - \hskip.5\d_math_eqalign_distance - \math_matrix_vertical_rule{#1}% - \hskip.5\d_math_eqalign_distance - \aligntab} + \ifconditional\c_math_matrix_first\else + \kern.5\d_math_eqalign_distance % hskip + \fi + \math_matrix_vertical_rule_yes{#1}% + \kern.5\d_math_eqalign_distance % hskip + \global\setfalse\c_math_matrix_first + \aligntab + \boundary\c_math_matrix_vl_boundary + \enforced\let\NR\math_matrix_NL_NR + } + +\permanent\tolerant\protected\def\math_matrix_NL[#1]#*% + {\span\omit + \ifconditional\c_math_matrix_first\else + \kern.5\d_math_eqalign_distance % hskip + \fi + \math_matrix_vertical_rule_nop{#1}% + \kern.5\d_math_eqalign_distance % hskip + \global\setfalse\c_math_matrix_first + \aligntab + \boundary\c_math_matrix_vl_boundary + \enforced\let\NR\math_matrix_NL_NR} + +\permanent\protected\def\math_matrix_NL_NR + {\ifnum\lastboundary=\c_math_matrix_vl_boundary + \ifconditional \c_math_matrix_sl_seen + \kern-1.5\d_math_eqalign_distance % hskip + \else + \kern-.5\d_math_eqalign_distance % hskip + \fi + \fi + \math_matrix_anchor_last + \math_matrix_stop_row + \math_matrix_pickup + \crcr + \math_matrix_start_row} + +\appendtoks + \enforced\let\NL\math_matrix_NL + \global\setfalse\c_math_matrix_sl_seen +\to \everymathmatrix \permanent\tolerant\protected\def\math_matrix_VC[#1]#*% {\NC - \math_matrix_vertical_rule{#1}% + \math_matrix_vertical_rule_yes{#1}% \NC} \permanent\tolerant\protected\def\math_matrix_VT[#1]#*% {\span\omit - \math_matrix_vertical_rule{#1}% + \math_matrix_vertical_rule_yes{#1}% \aligntab} \def\math_matrix_start_row @@ -1531,6 +1648,7 @@ callback \s!attr \mathmatrixornamentattribute "10 \s!attr \mathalignmentvruleattribute \plusone + \s!attr \mathalignmenthruleattribute \plusone \bgroup % preamble \span\math_matrix_preamble @@ -2300,7 +2418,7 @@ \hpack to \displaywidth\bgroup \hss \strc_math_flush_number_box - \hskip\d_framed_locator_ro + \kern\d_framed_locator_ro \egroup \egroup \strc_math_flush_box_framed_fit_inline} @@ -2308,7 +2426,7 @@ \def\strc_math_number_left_overflow_inside {\setbox\b_strc_math_display\vpack\bgroup \hpack to \displaywidth\bgroup - % \hskip\d_framed_locator_lo + % \kern\d_framed_locator_lo \strc_math_flush_number_box \hss \egroup @@ -2722,7 +2840,7 @@ \ifzeropt\scratchdimen\else\kern\scratchdimen\fi \setbox\scratchbox\hbox{\mathsimplealignparameter\c!text}% \ifvoid\scratchbox\else - \hskip\mathsimplealignparameter\c!textdistance + \kern\mathsimplealignparameter\c!textdistance % hskip \vcenter{\box\scratchbox}% \fi \egroup diff --git a/tex/context/base/mkxl/math-del.mklx b/tex/context/base/mkxl/math-del.mklx index edfd77de2..cfb8dc5d2 100644 --- a/tex/context/base/mkxl/math-del.mklx +++ b/tex/context/base/mkxl/math-del.mklx @@ -105,6 +105,13 @@ [fourier] [\c!right=\delimitedrighttildeuc] +% \definemathdelimited +% [bannuity] +% [%topoffset=.2\exheight, +% \c!strut=no, +% \c!rightmargin=.05\emwidth, +% \c!right=\delimitedrightanutityuc] + % $ \autofences \fourier{(z+\frac12)} + \courier{(z+\frac12)} + \xourier{(z+\frac12)} $ \protect \endinput diff --git a/tex/context/base/mkxl/math-fbk.lmt b/tex/context/base/mkxl/math-fbk.lmt index 185bb0d55..052f15f50 100644 --- a/tex/context/base/mkxl/math-fbk.lmt +++ b/tex/context/base/mkxl/math-fbk.lmt @@ -168,7 +168,7 @@ end -- a few examples: -local addextra = mathematics.extras.add +-- local addextra = mathematics.extras.add -- addextra(0xFE350) -- MATHEMATICAL DOUBLE ARROW LEFT END -- addextra(0xFE351) -- MATHEMATICAL DOUBLE ARROW MIDDLE PART @@ -395,7 +395,7 @@ local addextra = mathematics.extras.add -- local height = target.parameters.xheight / 2 -- local c, done = accent_to_extensible(target,private,data.original,unicode,height,0,nil,-height,unicode) -- if done then --- c.topaccent = nil -- or maybe also all the others +-- c.topanchor = nil -- or maybe also all the others -- end -- return c -- end diff --git a/tex/context/base/mkxl/math-fen.mkxl b/tex/context/base/mkxl/math-fen.mkxl index 7cb775294..b3c85070f 100644 --- a/tex/context/base/mkxl/math-fen.mkxl +++ b/tex/context/base/mkxl/math-fen.mkxl @@ -53,6 +53,7 @@ \c!source=\zerocount, \c!height=\zeropoint, \c!depth=\zeropoint, + \c!distance=\zerocount, \c!factor=\v!auto] \appendtoks @@ -314,7 +315,66 @@ \installlocalcurrenthandler \??mathfences {mathfence} -\tolerant\protected\def\math_fenced_fenced#1#*[#2]% +%D The horizontal text variant was introduced for Alan Braslau. Because this is not +%D used that often we only support double text arguments. +%D +%D Musical timestamp: I am The Moon by Tedeschi Trucks Band + +% \definemathfence [tupdownarrows] [text] [\c!left="2191,\c!right="2193] + +\protected\def\math_fenced_horizontal_common#1#2#3#4% \Uwhatever class symbol source + {\c_math_fenced_class\mathfenceparameter#2\relax + \edef\p_fence{#3}% + #1% \Uleft \Umiddle \Uleft + \usedcolorparameterattributes{\mathfenceparameter\c!color}% + \s!leftclass \mathunspacedcode + \s!rightclass \mathunspacedcode + \s!class \mathunspacedcode + \s!source \numexpr\namedboxanchor{\mathfenceparameter#4}\relax + \Udelimiter\mathghostcode\fam\p_fence} + +\tolerant\protected\def\math_fenced_horizontal#1#*[#2]#:#*#3#4% + {% \csname math\mathfenceparameter\c!mathclass\endcsname + \mathord \bgroup % class here + \setlocalmathfencecurrent{#1}% \edef\currentmathfence{#1}% + \setupcurrentmathfence[#2]% + % \usemathstyleparameter\mathfenceparameter\c!mathstyle + \setmathsmalltextbox\scratchboxone\hbox{\usemathfencestyleandcolor\c!leftstyle \c!leftcolor #3}% + \setmathsmalltextbox\scratchboxtwo\hbox{\usemathfencestyleandcolor\c!rightstyle\c!rightcolor#4}% + \let\math_fenced_common\math_fenced_horizontal_common + \edef\p_fenced_middle{\mathfenceparameter\c!middle}% + \ifempty\p_fenced_middle\else + \letmathfenceparameter\c!left \p_fenced_middle + \letmathfenceparameter\c!right\zerocount + \fi + \scratchdistance\mathfenceparameter\c!distance + \box\scratchboxone + \kern\scratchdistance + \math_fenced_fenced_start\currentmathfence + \math_fenced_fenced_stop \currentmathfence + \kern\scratchdistance + \box\scratchboxtwo + \egroup} + +\tolerant\protected\def\math_fenced_fenced#1% + {\ifcstok{\namedmathfenceparameter{#1}\c!text}\v!yes % not the best keyword + \expandafter\math_fenced_horizontal + \else + \expandafter\math_fenced_vertical + \fi{#1}} + +% two step because we don't want to define text itself as command + +\definemathfence + [\v!text] + +\setupmathfence + [\v!text] + [\c!text=\v!yes, + \c!command=\v!yes, + \c!distance=.125\emwidth] + +\tolerant\protected\def\math_fenced_vertical#1#*[#2]% {\begingroup %{\beginmathgroup \setlocalmathfencecurrent{#1}% \edef\currentmathfence{#1}% @@ -1129,4 +1189,14 @@ \setmathoptions\mathmiddlecode bor \autoinjectclassoptioncode \relax} +%D New (to be completed): + +% $x + \tupdownarrows{left}{right} + x$ +% $x + \tdownuparrows{left}{right} + x$ +% $x + \tupanddownarrows[color=red,leftcolor=green,rightcolor=blue]{left}{right} + x$ + +\definemathfence [tupanddownarrows] [\v!text] [\c!left="2191,\c!right="2193] +\definemathfence [tupdownarrows] [\v!text] [\c!left="21C5,\c!right=0] +\definemathfence [tdownuparrows] [\v!text] [\c!middle="21F5] + \protect diff --git a/tex/context/base/mkxl/math-fnt.lmt b/tex/context/base/mkxl/math-fnt.lmt index 1901d79ae..cd4976900 100644 --- a/tex/context/base/mkxl/math-fnt.lmt +++ b/tex/context/base/mkxl/math-fnt.lmt @@ -50,13 +50,15 @@ local function register_extensible(font,char,style,box) 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) + if fonts.hashes.properties[font].compactmath then + nuts.setscales(g,1000,1000,1000) + end local n = new_hlist(g) -- if newcommands then oldchar.commands = newcommands end -- - -- local newchar = { -- unicode = unicode, -- width = wd, @@ -77,7 +79,6 @@ local function register_extensible(font,char,style,box) -- 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-frc.mkxl b/tex/context/base/mkxl/math-frc.mkxl index c0ef58c27..42e665f75 100644 --- a/tex/context/base/mkxl/math-frc.mkxl +++ b/tex/context/base/mkxl/math-frc.mkxl @@ -269,8 +269,8 @@ \Udelimiter\zerocount\fam\scratchcountertwo} \defcsname\??fractionmethods\v!vertical \v!auto \v!none\endcsname{\Uover} \defcsname\??fractionmethods\v!vertical \v!auto \endcsname{\Uoverwithdelims - \Udelimiter\zerocount\fam\scratchcounterone - \Udelimiter\zerocount\fam\scratchcountertwo} + \Udelimiter\zerocount\fam\scratchcounterone + \Udelimiter\zerocount\fam\scratchcountertwo} \defcsname\??fractionmethods\v!vertical \v!symbol \v!none\endcsname{\Ustretched \Udelimiter\zerocount\fam\scratchcounterthree} \defcsname\??fractionmethods\v!vertical \v!symbol \endcsname{\Ustretchedwithdelims @@ -452,34 +452,20 @@ \to \everysetupmathfraction \def\math_fraction_set_threshold_inline_auto - {\Umathfractiondelsize\textstyle \maxdimen - \Umathfractiondelsize\scriptstyle \maxdimen - \Umathfractiondelsize\scriptscriptstyle\maxdimen -\Umathfractiondelsize\crampedtextstyle \Umathfractiondelsize\textstyle -\Umathfractiondelsize\crampedscriptstyle \Umathfractiondelsize\scriptstyle -\Umathfractiondelsize\crampedscriptscriptstyle\Umathfractiondelsize\scriptscriptstyle - } + {\Umathfractiondelsize\allmathstyles\maxdimen} \def\math_fraction_set_threshold_display_auto - {\Umathfractiondelsize\displaystyle \maxdimen -\Umathfractiondelsize\crampeddisplaystyle \Umathfractiondelsize\displaystyle - } + {\Umathfractiondelsize\alldisplaystyles\maxdimen} \def\math_fraction_set_threshold_inline_ratio {\edef\p_threshold{\mathfractionparameter\c!inlinethreshold}% - \Umathfractiondelsize\textstyle \p_threshold\dimexpr\textface\relax - \Umathfractiondelsize\scriptstyle \p_threshold\dimexpr\scriptface\relax - \Umathfractiondelsize\scriptscriptstyle\p_threshold\dimexpr\scriptscriptface\relax -\Umathfractiondelsize\crampedtextstyle \Umathfractiondelsize\textstyle -\Umathfractiondelsize\crampedscriptstyle \Umathfractiondelsize\scriptstyle -\Umathfractiondelsize\crampedscriptscriptstyle\Umathfractiondelsize\scriptscriptstyle - } + \Umathfractiondelsize\alltextstyles \p_threshold\dimexpr\textface\relax + \Umathfractiondelsize\allscriptstyles \p_threshold\dimexpr\scriptface\relax + \Umathfractiondelsize\allscriptscriptstyles\p_threshold\dimexpr\scriptscriptface\relax} \def\math_fraction_set_threshold_display_ratio {\edef\p_threshold{\mathfractionparameter\c!displaythreshold}% - \Umathfractiondelsize\displaystyle \p_threshold\dimexpr\textface\relax -\Umathfractiondelsize\crampeddisplaystyle \Umathfractiondelsize\displaystyle - } + \Umathfractiondelsize\alldisplaystyles\p_threshold\dimexpr\textface\relax} \setupmathfractions [\c!inlinethreshold=.25, % no unit but fraction diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index bf674068a..d13c2447c 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -55,7 +55,7 @@ \registerctxluafile{math-ini}{autosuffix} \registerctxluafile{math-dim}{autosuffix} -% \registerctxluafile{math-act}{autosuffix} +%registerctxluafile{math-act}{autosuffix} \registerctxluafile{math-ext}{} \registerctxluafile{math-vfu}{autosuffix} \registerctxluafile{math-ttv}{} @@ -65,7 +65,7 @@ \registerctxluafile{math-noa}{autosuffix} \registerctxluafile{math-tag}{autosuffix} \registerctxluafile{math-fbk}{autosuffix} -\registerctxluafile{math-dir}{} +%registerctxluafile{math-dir}{} \registerctxluafile{math-spa}{autosuffix} \registerctxluafile{math-fnt}{autosuffix} \registerctxluafile{math-pre}{autosuffix} @@ -107,6 +107,8 @@ +\analyzescriptnucleuscharmathcontrolcode +\analyzescriptnucleuslistmathcontrolcode +\analyzescriptnucleusboxmathcontrolcode + +\accenttopskewwithoffsetmathcontrolcode + % +\ignorekerndimensionsmathcontrolcode % xits needs this (bad depth of fences) \relax % \mathpenaltiesmode\plusone @@ -513,8 +515,22 @@ \defaultmathclassoptions % +\checkligatureclassoptioncode +\checkkernpairclassoptioncode + % up to Mikael to decide, ok with italic chars, maybe less so with raw ints: + % +\operatoritaliccorrectionclassoptioncode \relax +% we tweak away weird italics so only special cases see this: +% +% \def\IntOr{\Umathchar\mathordinarycode"00"00222B } +% \def\IntOp{\Umathchar\mathoperatorcode"00"00222B } +% +% \showglyphs \showfontitalics +% $\IntOp\limits x \quad \IntOp\limits^1_2 x \quad \IntOp\nolimits^1_2 x $\blank +% $\IntOr\limits x \quad \IntOr\limits^1_2 x \quad \IntOr\nolimits^1_2 x $\blank +% +% $\mathop{f} (x) \quad \mathop{f}\limits (x) \quad \mathop{f}\nolimits (x)$\blank +% $\mathop{f}^a_b (x) \quad \mathop{f}\limits^a_b (x) \quad \mathop{f}\nolimits^a_b (x)$\blank + \setmathoptions\mathbinarycode\numexpr \defaultmathclassoptions +\lookaheadforendclassoptioncode @@ -1099,318 +1115,317 @@ \startsetups math:spacing:presets \resetmathspacing % - % \inherited\setmathspacing \mathordinarycode \mathordinarycode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathordinarycode \mathoperatorcode \allmathstyles \thinmuskip - \inherited\setmathspacing \mathordinarycode \mathbinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathordinarycode \mathbinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathordinarycode \mathrelationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathordinarycode \mathrelationcode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathordinarycode \mathopencode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathordinarycode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathordinarycode \mathmiddlecode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathordinarycode \mathclosecode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathordinarycode \mathpunctuationcode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathordinarycode \mathconstructcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathordinarycode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathordinarycode \mathellipsiscode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathordinarycode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathordinarycode \mathfractioncode \allsplitstyles \tinymuskip - \inherited\setmathspacing \mathordinarycode \mathfractioncode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathordinarycode \mathradicalcode \allsplitstyles \tinymuskip % 220705 Results in an unwanted space - % \inherited\setmathspacing \mathordinarycode \mathradicalcode \allscriptstyles \pettymuskip % 220705 Results in an unwanted space - % - \inherited\setmathspacing \mathoperatorcode \mathordinarycode \allmathstyles \thinmuskip - \inherited\setmathspacing \mathoperatorcode \mathoperatorcode \allmathstyles \thinmuskip - % \inherited\setmathspacing \mathoperatorcode \mathbinarycode \allmathstyles \ zeromuskip - \inherited\setmathspacing \mathoperatorcode \mathrelationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathoperatorcode \mathrelationcode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathoperatorcode \mathopencode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathoperatorcode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathoperatorcode \mathmiddlecode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathoperatorcode \mathclosecode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathoperatorcode \mathpunctuationcode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathoperatorcode \mathconstructcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathoperatorcode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathoperatorcode \mathellipsiscode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathoperatorcode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathoperatorcode \mathfractioncode \allmathstyles \thinmuskip - \inherited\setmathspacing \mathoperatorcode \mathradicalcode \allmathstyles \thinmuskip + % \inherited\setmathspacing \mathordinarycode \mathordinarycode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathordinarycode \mathoperatorcode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathordinarycode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathordinarycode \mathbinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathordinarycode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathordinarycode \mathrelationcode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathordinarycode \mathopencode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathordinarycode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathordinarycode \mathmiddlecode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathordinarycode \mathclosecode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathordinarycode \mathpunctuationcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathordinarycode \mathconstructcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathordinarycode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathordinarycode \mathellipsiscode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathordinarycode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathordinarycode \mathfractioncode \allsplitstyles \tinymuskip + \inherited\setmathspacing \mathordinarycode \mathfractioncode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathordinarycode \mathradicalcode \allsplitstyles \tinymuskip % 220705 Results in an unwanted space + % \inherited\setmathspacing \mathordinarycode \mathradicalcode \allunsplitstyles \pettymuskip % 220705 Results in an unwanted space % - \inherited\setmathspacing \mathbinarycode \mathordinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathbinarycode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathbinarycode \mathoperatorcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathbinarycode \mathoperatorcode \allscriptstyles \pettymuskip - %% \inherited\setmathspacing \mathbinarycode \mathbinarycode \allmathstyles \zeromuskip - %% \inherited\setmathspacing \mathbinarycode \mathrelationcode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathbinarycode \mathopencode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathbinarycode \mathopencode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathbinarycode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathbinarycode \mathmiddlecode \allscriptstyles \pettymuskip - %% \inherited\setmathspacing \mathbinarycode \mathclosecode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathbinarycode \mathpunctuationcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathbinarycode \mathpunctuationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathbinarycode \mathconstructcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathbinarycode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathbinarycode \mathellipsiscode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathbinarycode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathbinarycode \mathfractioncode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathbinarycode \mathfractioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathbinarycode \mathradicalcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathbinarycode \mathradicalcode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathoperatorcode \mathordinarycode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathoperatorcode \mathoperatorcode \allmathstyles \thinmuskip + % \inherited\setmathspacing \mathoperatorcode \mathbinarycode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathoperatorcode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathoperatorcode \mathrelationcode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathoperatorcode \mathopencode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathoperatorcode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathoperatorcode \mathmiddlecode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathoperatorcode \mathclosecode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathoperatorcode \mathpunctuationcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathoperatorcode \mathconstructcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathoperatorcode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathoperatorcode \mathellipsiscode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathoperatorcode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathoperatorcode \mathfractioncode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathoperatorcode \mathradicalcode \allmathstyles \thinmuskip % - \inherited\setmathspacing \mathrelationcode \mathordinarycode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathrelationcode \mathoperatorcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathoperatorcode \allscriptstyles \pettymuskip - %% \inherited\setmathspacing \mathrelationcode \mathbinarycode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathrelationcode \mathrelationcode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathrelationcode \mathopencode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathopencode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathrelationcode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathmiddlecode \allscriptstyles \thinmuskip - % \inherited\setmathspacing \mathrelationcode \mathclosecode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathrelationcode \mathpunctuationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathpunctuationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathrelationcode \mathconstructcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathrelationcode \mathellipsiscode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathrelationcode \mathfractioncode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathfractioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathrelationcode \mathradicalcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathradicalcode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathbinarycode \mathordinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathordinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathbinarycode \mathoperatorcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathoperatorcode \allunsplitstyles \pettymuskip + %% \inherited\setmathspacing \mathbinarycode \mathbinarycode \allmathstyles \zeromuskip + %% \inherited\setmathspacing \mathbinarycode \mathrelationcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathbinarycode \mathopencode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathopencode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathbinarycode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathbinarycode \mathmiddlecode \allunsplitstyles \pettymuskip + %% \inherited\setmathspacing \mathbinarycode \mathclosecode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathbinarycode \mathpunctuationcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathpunctuationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathbinarycode \mathconstructcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathbinarycode \mathellipsiscode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathbinarycode \mathfractioncode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathfractioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathbinarycode \mathradicalcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathradicalcode \allunsplitstyles \pettymuskip % - % \inherited\setmathspacing \mathopencode \mathordinarycode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathoperatorcode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathbinarycode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathrelationcode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathopencode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathmiddlecode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathclosecode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathpunctuationcode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathconstructcode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathellipsiscode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathopencode \mathfractioncode \allmathstyles \pettymuskip - % \inherited\setmathspacing \mathopencode \mathradicalcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathrelationcode \mathordinarycode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathordinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathrelationcode \mathoperatorcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathoperatorcode \allunsplitstyles \pettymuskip + %% \inherited\setmathspacing \mathrelationcode \mathbinarycode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathrelationcode \mathrelationcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathrelationcode \mathopencode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathopencode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathrelationcode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathmiddlecode \allunsplitstyles \thinmuskip + % \inherited\setmathspacing \mathrelationcode \mathclosecode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathrelationcode \mathpunctuationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathpunctuationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathrelationcode \mathconstructcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathrelationcode \mathellipsiscode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathrelationcode \mathfractioncode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathfractioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathrelationcode \mathradicalcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathradicalcode \allunsplitstyles \pettymuskip % - \inherited\setmathspacing \mathclosecode \mathordinarycode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathclosecode \mathoperatorcode \allmathstyles \thinmuskip - \inherited\setmathspacing \mathclosecode \mathbinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathclosecode \mathbinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathclosecode \mathrelationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathclosecode \mathrelationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathclosecode \mathopencode \alltextstyles \tinymuskip - \inherited\setmathspacing \mathclosecode \mathopencode \alldisplaystyles\thinmuskip - \inherited\setmathspacing \mathclosecode \mathopencode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathclosecode \mathmiddlecode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathclosecode \mathclosecode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathclosecode \mathpunctuationcode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathclosecode \mathconstructcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathclosecode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathclosecode \mathfactorialcode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathclosecode \mathellipsiscode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathclosecode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathclosecode \mathfractioncode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathclosecode \mathfractioncode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathclosecode \mathradicalcode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathordinarycode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathoperatorcode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathbinarycode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathrelationcode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathopencode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathmiddlecode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathclosecode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathpunctuationcode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathconstructcode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathellipsiscode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathopencode \mathfractioncode \allmathstyles \pettymuskip + % \inherited\setmathspacing \mathopencode \mathradicalcode \allmathstyles \zeromuskip % - \inherited\setmathspacing \mathpunctuationcode \mathordinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathordinarycode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathoperatorcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathoperatorcode \allscriptstyles \thinmuskip - % \inherited\setmathspacing \mathpunctuationcode \mathbinarycode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathpunctuationcode \mathrelationcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathrelationcode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathopencode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathopencode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathpunctuationcode \mathmiddlecode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathclosecode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathclosecode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathpunctuationcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathpunctuationcode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathconstructcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathconstructcode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathellipsiscode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathellipsiscode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathfractioncode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathfractioncode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathradicalcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathradicalcode \allscriptstyles \thinmuskip + \inherited\setmathspacing \mathclosecode \mathordinarycode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathclosecode \mathoperatorcode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathclosecode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathclosecode \mathbinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathclosecode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathclosecode \mathrelationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathclosecode \mathopencode \alltextstyles \tinymuskip + \inherited\setmathspacing \mathclosecode \mathopencode \alldisplaystyles \thinmuskip + \inherited\setmathspacing \mathclosecode \mathopencode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathclosecode \mathmiddlecode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathclosecode \mathclosecode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathclosecode \mathpunctuationcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathclosecode \mathconstructcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathclosecode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathclosecode \mathfactorialcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathclosecode \mathellipsiscode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathclosecode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathclosecode \mathfractioncode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathclosecode \mathfractioncode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathclosecode \mathradicalcode \allmathstyles \zeromuskip % - \inherited\setmathspacing \mathconstructcode \mathordinarycode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathconstructcode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathconstructcode \mathoperatorcode \allmathstyles \thinmuskip - \inherited\setmathspacing \mathconstructcode \mathbinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathconstructcode \mathbinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathconstructcode \mathrelationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathconstructcode \mathrelationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathconstructcode \mathopencode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathconstructcode \mathopencode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathconstructcode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathconstructcode \mathmiddlecode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathconstructcode \mathclosecode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathconstructcode \mathpunctuationcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathconstructcode \mathpunctuationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathconstructcode \mathconstructcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathconstructcode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathconstructcode \mathfractioncode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathconstructcode \mathfractioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathconstructcode \mathradicalcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathconstructcode \mathradicalcode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathpunctuationcode \mathordinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathordinarycode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathoperatorcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathoperatorcode \allunsplitstyles \thinmuskip + % \inherited\setmathspacing \mathpunctuationcode \mathbinarycode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathpunctuationcode \mathrelationcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathrelationcode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathopencode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathopencode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathpunctuationcode \mathmiddlecode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathclosecode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathclosecode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathpunctuationcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathpunctuationcode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathconstructcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathconstructcode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathellipsiscode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathellipsiscode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathfractioncode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathfractioncode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathradicalcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathradicalcode \allunsplitstyles \thinmuskip % - \inherited\setmathspacing \mathellipsiscode \mathordinarycode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathellipsiscode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathoperatorcode \allmathstyles \thinmuskip - \inherited\setmathspacing \mathellipsiscode \mathbinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathellipsiscode \mathbinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathrelationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathellipsiscode \mathrelationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathopencode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathellipsiscode \mathopencode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathellipsiscode \mathmiddlecode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathellipsiscode \mathclosecode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathellipsiscode \mathpunctuationcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathellipsiscode \mathpunctuationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathconstructcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathellipsiscode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathellipsiscode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathellipsiscode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathfractioncode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathellipsiscode \mathfractioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathradicalcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathellipsiscode \mathradicalcode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathordinarycode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathordinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathoperatorcode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathconstructcode \mathbinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathconstructcode \mathrelationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathopencode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathopencode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathconstructcode \mathmiddlecode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathconstructcode \mathclosecode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathconstructcode \mathpunctuationcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathpunctuationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathconstructcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathfractioncode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathfractioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathradicalcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathradicalcode \allunsplitstyles \pettymuskip % + \inherited\setmathspacing \mathellipsiscode \mathordinarycode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathordinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathoperatorcode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathellipsiscode \mathbinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathellipsiscode \mathrelationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathopencode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathopencode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathellipsiscode \mathmiddlecode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathellipsiscode \mathclosecode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathellipsiscode \mathpunctuationcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathpunctuationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathconstructcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathellipsiscode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathfractioncode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathfractioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathradicalcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathradicalcode \allunsplitstyles \pettymuskip % - \inherited\setmathspacing \mathfractioncode \mathordinarycode \allsplitstyles \tinymuskip - \inherited\setmathspacing \mathfractioncode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathoperatorcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathfractioncode \mathoperatorcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathbinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathfractioncode \mathbinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathrelationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathfractioncode \mathrelationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathopencode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathfractioncode \mathopencode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathfractioncode \mathmiddlecode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathclosecode \allmathstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathpunctuationcode \allsplitstyles \tinymuskip - \inherited\setmathspacing \mathfractioncode \mathpunctuationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathfractioncode \mathconstructcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathfractioncode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathellipsiscode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathfractioncode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathfractioncode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathfractioncode \mathfractioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathradicalcode \allsplitstyles \tinymuskip - \inherited\setmathspacing \mathfractioncode \mathradicalcode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathordinarycode \allsplitstyles \tinymuskip + \inherited\setmathspacing \mathfractioncode \mathordinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathoperatorcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathfractioncode \mathoperatorcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathfractioncode \mathbinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathfractioncode \mathrelationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathopencode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathfractioncode \mathopencode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathfractioncode \mathmiddlecode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathclosecode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathpunctuationcode \allsplitstyles \tinymuskip + \inherited\setmathspacing \mathfractioncode \mathpunctuationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathfractioncode \mathconstructcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathfractioncode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathellipsiscode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathfractioncode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathfractioncode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathfractioncode \mathfractioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathradicalcode \allsplitstyles \tinymuskip + \inherited\setmathspacing \mathfractioncode \mathradicalcode \allunsplitstyles \pettymuskip % - \inherited\setmathspacing \mathradicalcode \mathordinarycode \allsplitstyles \tinymuskip - \inherited\setmathspacing \mathradicalcode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathradicalcode \mathoperatorcode \allmathstyles \thinmuskip - \inherited\setmathspacing \mathradicalcode \mathbinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathradicalcode \mathbinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathradicalcode \mathrelationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathradicalcode \mathrelationcode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathradicalcode \mathopencode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathradicalcode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathradicalcode \mathmiddlecode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathradicalcode \mathclosecode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathradicalcode \mathpunctuationcode \allsplitstyles \pettymuskip - \inherited\setmathspacing \mathradicalcode \mathpunctuationcode \allscriptstyles \tinymuskip - \inherited\setmathspacing \mathradicalcode \mathconstructcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathradicalcode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathradicalcode \mathellipsiscode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathradicalcode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathradicalcode \mathfractioncode \allsplitstyles \tinymuskip - \inherited\setmathspacing \mathradicalcode \mathfractioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathradicalcode \mathradicalcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathradicalcode \mathradicalcode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathradicalcode \mathordinarycode \allsplitstyles \tinymuskip + \inherited\setmathspacing \mathradicalcode \mathordinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathradicalcode \mathoperatorcode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathradicalcode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathradicalcode \mathbinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathradicalcode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathradicalcode \mathrelationcode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathradicalcode \mathopencode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathradicalcode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathradicalcode \mathmiddlecode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathradicalcode \mathclosecode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathradicalcode \mathpunctuationcode \allsplitstyles \pettymuskip + \inherited\setmathspacing \mathradicalcode \mathpunctuationcode \allunsplitstyles \tinymuskip + \inherited\setmathspacing \mathradicalcode \mathconstructcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathradicalcode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathradicalcode \mathellipsiscode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathradicalcode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathradicalcode \mathfractioncode \allsplitstyles \tinymuskip + \inherited\setmathspacing \mathradicalcode \mathfractioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathradicalcode \mathradicalcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathradicalcode \mathradicalcode \allunsplitstyles \pettymuskip % - \inherited\setmathspacing \mathmiddlecode \mathordinarycode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathoperatorcode \allmathstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathbinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathmiddlecode \mathbinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathrelationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathrelationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathopencode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathopencode \allsplitstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathmiddlecode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathclosecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathclosecode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathpunctuationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathpunctuationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathconstructcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathellipsiscode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathfractioncode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathfractioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathradicalcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathradicalcode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathordinarycode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathordinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathoperatorcode \allmathstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathmiddlecode \mathbinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathrelationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathopencode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathopencode \allsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathmiddlecode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathclosecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathclosecode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathpunctuationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathpunctuationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathconstructcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathellipsiscode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathfractioncode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathfractioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathradicalcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathradicalcode \allmathstyles \pettymuskip % - \inherited\setmathspacing \mathclosecode \mathdifferentialcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathclosecode \mathdifferentialcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathordinarycode \mathdifferentialcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathordinarycode \mathdifferentialcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfactorialcode \mathordinarycode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathfactorialcode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfactorialcode \mathfactorialcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathclosecode \mathdifferentialcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathclosecode \mathdifferentialcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathordinarycode \mathdifferentialcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathordinarycode \mathdifferentialcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfactorialcode \mathordinarycode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathfactorialcode \mathordinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfactorialcode \mathfactorialcode \allmathstyles \zeromuskip % - \inherited\setmathspacing \mathopencode \mathconstructcode \allmathstyles \thinmuskip - \inherited\setmathspacing \mathconstructcode \mathclosecode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathopencode \mathconstructcode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathclosecode \allmathstyles \thinmuskip % - \inherited\setmathspacing \mathdimensioncode \mathdimensioncode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathordinarycode \mathdimensioncode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathordinarycode \mathdimensioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathdigitcode \mathdimensioncode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathdigitcode \mathdimensioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathclosecode \mathdimensioncode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathclosecode \mathdimensioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfunctioncode \mathbinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathfunctioncode \mathbinarycode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathdimensioncode \mathdimensioncode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathordinarycode \mathdimensioncode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathordinarycode \mathdimensioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathdigitcode \mathdimensioncode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathdigitcode \mathdimensioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathclosecode \mathdimensioncode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathclosecode \mathdimensioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfunctioncode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathfunctioncode \mathbinarycode \allunsplitstyles \pettymuskip % % \im{1\unit{hour} 20 \unit{minute} 56 \unit{second}} % - \inherited\setmathspacing \mathdimensioncode \mathdigitcode \allmathstyles \thickmuskip + \inherited\setmathspacing \mathdimensioncode \mathdigitcode \allmathstyles \thickmuskip + % + \inherited\setmathspacing \mathfakecode \mathallcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathallcode \mathfakecode \allmathstyles \tinymuskip % - \inherited\setmathspacing \mathfakecode \mathallcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathallcode \mathfakecode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathordinarycode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathoperatorcode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathbinarycode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathrelationcode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathopencode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathmiddlecode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathclosecode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathpunctuationcode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathconstructcode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathellipsiscode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathfractioncode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathradicalcode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathdifferentialcode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathpunctuationcode \allmathstyles \mathinterwordmuskip % - \inherited\setmathspacing \mathtextpunctuationcode \mathordinarycode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathoperatorcode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathbinarycode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathrelationcode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathopencode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathmiddlecode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathclosecode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathpunctuationcode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathconstructcode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathellipsiscode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathfractioncode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathradicalcode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathdifferentialcode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathpunctuationcode \allmathstyles \mathinterwordmuskip - - \inherited\setmathspacing \mathordinarycode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathoperatorcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathbinarycode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathrelationcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathopencode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathmiddlecode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathclosecode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathconstructcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathellipsiscode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathfractioncode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathradicalcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathdifferentialcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathordinarycode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathoperatorcode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathbinarycode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathrelationcode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathopencode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathmiddlecode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathclosecode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathconstructcode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathellipsiscode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathfractioncode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathradicalcode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathdifferentialcode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \tinymuskip \stopsetups \directsetup{math:spacing:default} @@ -1506,10 +1521,12 @@ \permanent\protected\def\math_upright {\setmathattribute\s!regular\s!tf\setmathfontstylealternate\s!tf} \permanent\protected\def\math_italic {\setmathattribute\s!regular\s!it\setmathfontstylealternate\s!it} -\permanent\protected\def\math_script {\setmathalphabet \s!script \setmathfontstylealternate\s!script\setmathvariant\s!handwriting} -\permanent\protected\def\math_calligraphic{\setmathalphabet \s!script \setmathfontstylealternate\s!script\setmathvariant\s!calligraphy} -\permanent\protected\def\math_fraktur {\setmathalphabet \s!fraktur \setmathfontstylealternate\s!fraktur} -\permanent\protected\def\math_blackboard {\setmathalphabet \s!blackboard\setmathfontstylealternate\s!blackboard} +%permanent\protected\def\math_script {\setmathalphabet \s!script \setmathfontstylealternate\s!script\setmathvariant\s!handwriting} +%permanent\protected\def\math_calligraphic{\setmathalphabet \s!script \setmathfontstylealternate\s!script\setmathvariant\s!calligraphy} +\permanent\protected\def\math_script {\setmathalphabet \s!script \setmathfontstylealternate\s!script} +\permanent\protected\def\math_calligraphic{\setmathalphabet \s!calligraphic\setmathfontstylealternate\s!calligraphic} +\permanent\protected\def\math_fraktur {\setmathalphabet \s!fraktur \setmathfontstylealternate\s!fraktur} +\permanent\protected\def\math_blackboard {\setmathalphabet \s!blackboard \setmathfontstylealternate\s!blackboard} \permanent\protected\def\mathupright {\mathgroupedcommandcs\math_upright } \permanent\protected\def\mathitalic {\mathgroupedcommandcs\math_italic } @@ -1804,14 +1821,12 @@ % using \s!font \mathstylefontid\mathstyle\fam would needs expansion and guesswork \appendtoks - \Umathruleheight\alltextstyles \strutheightfactor\fontspecifiedsize\textfont \zerocount - \Umathruledepth \alltextstyles \strutdepthfactor \fontspecifiedsize\textfont \zerocount + \Umathruleheight\allmainstyles \strutheightfactor\fontspecifiedsize\textfont \zerocount + \Umathruledepth \allmainstyles \strutdepthfactor \fontspecifiedsize\textfont \zerocount \Umathruleheight\allscriptstyles \strutheightfactor\fontspecifiedsize\scriptfont \zerocount \Umathruledepth \allscriptstyles \strutdepthfactor \fontspecifiedsize\scriptfont \zerocount \Umathruleheight\allscriptscriptstyles\strutheightfactor\fontspecifiedsize\scriptscriptfont\zerocount \Umathruledepth \allscriptscriptstyles\strutdepthfactor \fontspecifiedsize\scriptscriptfont\zerocount - \Umathruleheight\alldisplaystyles \Umathruleheight\textstyle - \Umathruledepth \alldisplaystyles \Umathruledepth \textstyle \to \everybodyfont \protected\def\math_strut @@ -2364,26 +2379,26 @@ \math_basics_synchronize_direction \to \everyswitchmathematics -% experimental (needed for an article) - -\installcorenamespace {mathbidi} - -\newcount\c_math_bidi - -\def\math_bidi_enable {\clf_setmathdirection\plusone \relax\c_math_bidi\plusone} -\def\math_bidi_disable{\clf_setmathdirection\zerocount\relax\c_math_bidi\attributeunsetvalue} - -\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 ? - \ifcsname\??mathbidi\p_bidi\endcsname\lastnamedcs\else\math_bidi_disable\fi -\to \everysetupmathematics +% experimental (needed for an article) .. this is is no longer neded -\appendtoks - \c_attr_mathbidi\ifconditional\c_math_right_to_left\c_math_bidi\else\attributeunsetvalue\fi -\to \everyswitchmathematics +% \installcorenamespace {mathbidi} +% +% \newcount\c_math_bidi +% +% \def\math_bidi_enable {\clf_setmathdirection\plusone \relax\c_math_bidi\plusone} +% \def\math_bidi_disable{\clf_setmathdirection\zerocount\relax\c_math_bidi\attributeunsetvalue} +% +% \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 ? +% \ifcsname\??mathbidi\p_bidi\endcsname\lastnamedcs\else\math_bidi_disable\fi +% \to \everysetupmathematics +% +% \appendtoks +% \c_attr_mathbidi\ifconditional\c_math_right_to_left\c_math_bidi\else\attributeunsetvalue\fi +% \to \everyswitchmathematics %D Delayed: greek. %D diff --git a/tex/context/base/mkxl/math-map.lmt b/tex/context/base/mkxl/math-map.lmt index f411505f2..d0a1410a1 100644 --- a/tex/context/base/mkxl/math-map.lmt +++ b/tex/context/base/mkxl/math-map.lmt @@ -66,7 +66,7 @@ local context = context -- todo: allocate -mathematics.styles = allocate { "regular", "sansserif", "monospaced", "fraktur", "script", "blackboard" } +mathematics.styles = allocate { "regular", "sansserif", "monospaced", "fraktur", "script", "calligraphic", "blackboard" } mathematics.alternatives = allocate { "normal", "bold", "italic", "bolditalic" } mathematics.sets = allocate { "ucletters", "lcletters", "digits", "ucgreek", "lcgreek", "symbols" } @@ -520,58 +520,95 @@ local script = { bi = script_bf, } +local calligraphic_tf = { + digits = tovector(regular_tf.digits), + ucletters = toupper(0x100020), + lcletters = tolower(0x100000), + lcgreek = tovector(regular_tf.lcgreek), + ucgreek = tovector(regular_tf.ucgreek), + symbols = tovector(regular_tf.symbols), +} + +local calligraphic_bf = { + digits = tovector(regular_bf.digits), + ucletters = toupper(0x100060), + lcletters = tolower(0x100040), + lcgreek = tovector(regular_bf.lcgreek), + ucgreek = tovector(regular_bf.ucgreek), + symbols = tovector(regular_bf.symbols), +} + +local calligraphic = { + tf = calligraphic_tf, + bf = calligraphic_bf, + it = calligraphic_tf, + bi = calligraphic_bf, +} + local alphabets = allocate { - regular = regular, - sansserif = sansserif, - monospaced = monospaced, - blackboard = blackboard, - fraktur = fraktur, - script = script, -} - -alphabets.tt = tovector(monospaced) -alphabets.ss = tovector(sansserif) -alphabets.rm = tovector(regular) -alphabets.bb = tovector(blackboard) -alphabets.fr = tovector(fraktur) -alphabets.sr = tovector(script) - -monospaced.normal = tovector(monospaced_tf) -monospaced.italic = tovector(monospaced_it) -monospaced.bold = tovector(monospaced_bf) -monospaced.bolditalic = tovector(monospaced_bi) - -sansserif.normal = tovector(sansserif_tf) -sansserif.italic = tovector(sansserif_it) -sansserif.bold = tovector(sansserif_bf) -sansserif.bolditalic = tovector(sansserif_bi) - -regular.normal = tovector(regular_tf) -regular.italic = tovector(regular_it) -regular.bold = tovector(regular_bf) -regular.bolditalic = tovector(regular_bi) - -blackboard.normal = tovector(blackboard_tf) -blackboard.italic = tovector(blackboard_tf) -blackboard.bold = tovector(blackboard_tf) -blackboard.bolditalic = tovector(blackboard_tf) - -fraktur.normal = tovector(fraktur_tf) -fraktur.italic = tovector(fraktur_bf) -fraktur.bold = tovector(fraktur_tf) -fraktur.bolditalic = tovector(fraktur_bf) - -alphabets.serif = tovector(regular) -alphabets.type = tovector(monospaced) -alphabets.teletype = tovector(monospaced) - -mathematics.alphabets = alphabets - -local mathremap = allocate { } -mathematics.mapremap = mathremap - -local boldmap = allocate { } -mathematics.boldmap = boldmap + regular = regular, + sansserif = sansserif, + monospaced = monospaced, + blackboard = blackboard, + fraktur = fraktur, + script = script, + calligraphic = calligraphic, +} + +alphabets.tt = tovector(monospaced) +alphabets.ss = tovector(sansserif) +alphabets.rm = tovector(regular) +alphabets.bb = tovector(blackboard) +alphabets.fr = tovector(fraktur) +alphabets.sr = tovector(script) +alphabets.ca = tovector(calligraphic) + +monospaced.normal = tovector(monospaced_tf) +monospaced.italic = tovector(monospaced_it) +monospaced.bold = tovector(monospaced_bf) +monospaced.bolditalic = tovector(monospaced_bi) + +sansserif.normal = tovector(sansserif_tf) +sansserif.italic = tovector(sansserif_it) +sansserif.bold = tovector(sansserif_bf) +sansserif.bolditalic = tovector(sansserif_bi) + +regular.normal = tovector(regular_tf) +regular.italic = tovector(regular_it) +regular.bold = tovector(regular_bf) +regular.bolditalic = tovector(regular_bi) + +blackboard.normal = tovector(blackboard_tf) +blackboard.italic = tovector(blackboard_tf) +blackboard.bold = tovector(blackboard_tf) +blackboard.bolditalic = tovector(blackboard_tf) + +fraktur.normal = tovector(fraktur_tf) +fraktur.italic = tovector(fraktur_bf) +fraktur.bold = tovector(fraktur_tf) +fraktur.bolditalic = tovector(fraktur_bf) + +script.normal = tovector(script_tf) +script.italic = tovector(script_bf) +script.bold = tovector(script_tf) +script.bolditalic = tovector(script_bf) + +calligraphic.normal = tovector(calligraphic_tf) +calligraphic.italic = tovector(calligraphic_bf) +calligraphic.bold = tovector(calligraphic_tf) +calligraphic.bolditalic = tovector(calligraphic_bf) + +alphabets.serif = tovector(regular) +alphabets.type = tovector(monospaced) +alphabets.teletype = tovector(monospaced) + +mathematics.alphabets = alphabets + +local mathremap = allocate { } +mathematics.mapremap = mathremap + +local boldmap = allocate { } +mathematics.boldmap = boldmap -- all math (a bit of redundancy here) (sorted for tracing) @@ -704,10 +741,11 @@ implement { actions = function(alphabet) if texgetmode() == mathmode_code then -- local r = mathremap[mathalphabet] - local r = mathremap[texgetattribute(mathalphabet)] + local a = texgetattribute(mathalphabet) + local r = mathremap[a] local style = r and r.style or "tf" local data = alphabets[alphabet][style] - texsetattribute(mathalphabet,data and data.attribute or texattribute[mathalphabet]) + texsetattribute(mathalphabet,data and data.attribute or a) end end } @@ -805,7 +843,7 @@ end -- begin of experiment -local fallback = { +local stylefallbacks = { tf = "bf", it = "bi", bf = "tf", @@ -813,12 +851,12 @@ local fallback = { } function mathematics.fallbackstyleattr(attribute) - local r = mathremap[attribute] - local alphabet = r.alphabet or "regular" - local style = r.style or "tf" - local fback = fallback[style] - if fback then - local data = alphabets[alphabet][fback] + local redirect = mathremap[attribute] + local alphabet = redirect.alphabet or "regular" + local style = redirect.style or "tf" + local fallback = stylefallbacks[style] + if fallback then + local data = alphabets[alphabet][fallback] if data then local attr = data.attribute return attribute ~= attr and attr diff --git a/tex/context/base/mkxl/math-noa.lmt b/tex/context/base/mkxl/math-noa.lmt index a754f6f39..30b7b0448 100644 --- a/tex/context/base/mkxl/math-noa.lmt +++ b/tex/context/base/mkxl/math-noa.lmt @@ -683,13 +683,14 @@ end do - local a_mathalphabet = privateattribute("mathalphabet") - local a_mathgreek = privateattribute("mathgreek") + local a_mathalphabet = privateattribute("mathalphabet") + local a_mathgreek = privateattribute("mathgreek") - local relocate = { } + local relocate = { } - local remapalphabets = mathematics.remapalphabets - local fallbackstyleattr = mathematics.fallbackstyleattr + local remapalphabets = mathematics.remapalphabets + local fallbackstyleattr = mathematics.fallbackstyleattr + local fallbackalphabetattr = mathematics.fallbackalphabetattr local function report_remap(tag,id,old,new,extra) if new then diff --git a/tex/context/base/mkxl/math-rad.mklx b/tex/context/base/mkxl/math-rad.mklx index 04d6bfbba..9dfc80d13 100644 --- a/tex/context/base/mkxl/math-rad.mklx +++ b/tex/context/base/mkxl/math-rad.mklx @@ -242,13 +242,13 @@ \scratchdimen \wd\scratchbox \scratchtopoffset \dimexpr\scratchoffset+\dp\nextbox\relax \scratchbottomoffset\dimexpr\scratchoffset+\ht\nextbox/2\relax - \hpack to \scratchdimen{\hss\box\nextbox\hskip\scratchoffset}% - \hskip-\scratchdimen + \hpack to \scratchdimen{\hss\box\nextbox\kern\scratchoffset}% + \kern-\scratchdimen \lower\dimexpr\scratchtopoffset\box\scratchbox% \ifx\currentmathradicaldegree\empty \else \setbox\scratchbox\mathstylehbox{\scriptscriptstyle\currentmathradicaldegree\hss}% \wd\scratchbox\scratchdimen - \hskip-\scratchdimen + \kern-\scratchdimen \raise\dimexpr\scratchbottomoffset\box\scratchbox \fi \endgroup} @@ -296,7 +296,7 @@ % the width of the graphic determines the width of the final result \setbox\scratchbox\hpack{\uniqueMPgraphic{\p_mp}}% todo: add code key + tag \hpack to \wd\scratchbox{\hss\box\nextbox\hss}% - \hskip-\wd\scratchbox + \kern-\wd\scratchbox \box\scratchbox \endgroup} diff --git a/tex/context/base/mkxl/math-stc.mklx b/tex/context/base/mkxl/math-stc.mklx index 2ddfa24fd..828115f83 100644 --- a/tex/context/base/mkxl/math-stc.mklx +++ b/tex/context/base/mkxl/math-stc.mklx @@ -75,6 +75,9 @@ % at the lua end and some checking: use \mathhorizontalcode or \mathextensiblecode % but in practice arrows etc are not used that often +% At some point we can consider to use the more natural \LUAMETATEX\ features but the +% problem is that we lack proper support in fonts and we also have less control. + \installcorenamespace {mathextensiblefallbacks} % currently no italic correction ... problem is that we don't know yet if we have an italic @@ -1059,6 +1062,7 @@ \definemathextensible [\v!reverse] [xrightharpoondown] ["21C1] \definemathextensible [\v!reverse] [xrightharpoonup] ["21C0] \definemathextensible [\v!reverse] [xrightoverleftarrow] ["21C4] +\definemathextensible [\v!reverse] [xleftoverrightarrow] ["21C6] \definemathextensible [\v!reverse] [xleftrightharpoons] ["21CB] \definemathextensible [\v!reverse] [xrightleftharpoons] ["21CC] \definemathextensible [\v!reverse] [xtriplerel] ["2261] @@ -1081,6 +1085,7 @@ \definemathextensible [\v!mathematics] [mrightharpoondown] ["21C1] \definemathextensible [\v!mathematics] [mrightharpoonup] ["21C0] \definemathextensible [\v!mathematics] [mrightoverleftarrow] ["21C4] +\definemathextensible [\v!mathematics] [mleftoverrightarrow] ["21C6] \definemathextensible [\v!mathematics] [mleftrightharpoons] ["21CB] \definemathextensible [\v!mathematics] [mrightleftharpoons] ["21CC] \definemathextensible [\v!mathematics] [mtriplerel] ["2261] @@ -1103,6 +1108,7 @@ \definemathextensible [\v!text] [trightharpoondown] ["21C1] \definemathextensible [\v!text] [trightharpoonup] ["21C0] \definemathextensible [\v!text] [trightoverleftarrow] ["21C4] +\definemathextensible [\v!text] [tleftoverrightarrow] ["21C6] \definemathextensible [\v!text] [tleftrightharpoons] ["21CB] \definemathextensible [\v!text] [trightleftharpoons] ["21CC] \definemathextensible [\v!text] [ttriplerel] ["2261] @@ -1184,6 +1190,7 @@ \definemathextensible [\v!chemistry] [cleftarrow] ["2190] \definemathextensible [\v!chemistry] [crightarrow] ["2192] \definemathextensible [\v!chemistry] [crightoverleftarrow] ["21C4] +\definemathextensible [\v!chemistry] [cleftoverrightarrow] ["21C6] % for the moment: @@ -1208,6 +1215,7 @@ \immutable\protected\def\rightarrowfill {\math_stackers_hacked_fill \relbar \relbar \rightarrow} \immutable\protected\def\leftarrowfill {\math_stackers_hacked_fill \leftarrow \relbar \relbar } \immutable\protected\def\rightoverleftarrowfill{\math_stackers_hacked_fill \ctxdoublearrowfillleftend\ctxdoublearrowfillmiddlepart\ctxdoublearrowfillrightend} +\immutable\protected\def\leftoverrightarrowfill{\math_stackers_hacked_fill \ctxdoublearrowfillrightend\ctxdoublearrowfillmiddlepart\ctxdoublearrowfillleftend} \immutable\protected\def\equalfill {\math_stackers_hacked_fill \Relbar \Relbar \Relbar} \immutable\protected\def\Rightarrowfill {\math_stackers_hacked_fill \Relbar \Relbar \Rightarrow} \immutable\protected\def\Leftarrowfill {\math_stackers_hacked_fill \Leftarrow \Relbar \Relbar} @@ -1247,6 +1255,7 @@ \defineextensiblefiller [rightharpoondownfill] ["21C1] \defineextensiblefiller [rightharpoonupfill] ["21C0] \defineextensiblefiller [rightoverleftarrowfill] ["21C4] +\defineextensiblefiller [leftoverrightarrowfill] ["21C6] %defineextensiblefiller [leftrightharpoonsfill] ["21CB] % yet undefined %defineextensiblefiller [rightleftharpoonsfill] ["21CC] % yet undefined \defineextensiblefiller [triplerelfill] ["2261] @@ -1303,7 +1312,7 @@ [\v!symbol] [\c!voffset=-.3\mathexheight, \c!hoffset=\zeropoint, - \c!mathclass=ord, + \c!mathclass=\s!ordinary, \c!topoffset=.4\mathemwidth, % poor man's italic correction \c!middlecommand=\mathematics] diff --git a/tex/context/base/mkxl/math-vfu.lmt b/tex/context/base/mkxl/math-vfu.lmt index c58906a10..906c9ccf6 100644 --- a/tex/context/base/mkxl/math-vfu.lmt +++ b/tex/context/base/mkxl/math-vfu.lmt @@ -631,8 +631,9 @@ local function copy_glyph(main,target,original,unicode,slot) height = olddata.height, depth = olddata.depth, italic = olddata.italic, - topaccent = olddata.topaccent, + topanchor = olddata.topanchor, kerns = olddata.kerns, + mathkerns = olddata.mathkerns, tounicode = olddata.tounicode, commands = { { "slot", slot, unicode } }, } @@ -646,7 +647,9 @@ local function copy_glyph(main,target,original,unicode,slot) height = oldnextdata.height, depth = oldnextdata.depth, italic = oldnextdata.italic, - topaccent = oldnextdata.topaccent, + topanchor = oldnextdata.topanchor, + kerns = olddata.kerns, + mathkerns = olddata.mathkerns, tounicode = olddata.tounicode, commands = { { "slot", slot, nextglyph } }, } @@ -982,7 +985,7 @@ function vfmath.define(specification,set,goodies) if skewchar then local k = kerns[skewchar] if k then - t.topaccent = width/2 + k + t.topanchor = width/2 + k end end characters[unicode] = t @@ -1131,8 +1134,6 @@ function vfmath.define(specification,set,goodies) report_virtual("loading and virtualizing font %a at size %p took %0.3f seconds",name,size,os.clock()-start) end -- - -- main.oldmath = true - -- -- We bypass the scaler so ... -- main.MathConstants = main.mathconstants diff --git a/tex/context/base/mkxl/mult-sys.mkxl b/tex/context/base/mkxl/mult-sys.mkxl index 38d2c0633..636c15363 100644 --- a/tex/context/base/mkxl/mult-sys.mkxl +++ b/tex/context/base/mkxl/mult-sys.mkxl @@ -160,6 +160,7 @@ \definesystemconstant {class} \definesystemconstant {leftclass} \definesystemconstant {rightclass} +\definesystemconstant {calligraphic} \definesystemconstant {clone} \definesystemconstant {close} \definesystemconstant {cmyk} diff --git a/tex/context/base/mkxl/node-ali.lmt b/tex/context/base/mkxl/node-ali.lmt index 9209a520b..4b52f2d4b 100644 --- a/tex/context/base/mkxl/node-ali.lmt +++ b/tex/context/base/mkxl/node-ali.lmt @@ -30,6 +30,7 @@ local getlist = nuts.getlist local setlist = nuts.setlist local setattrlist = nuts.setattrlist local setprop = nuts.setprop +local getprop = nuts.getprop local getfont = nuts.getfont local getchar = nuts.getchar local addmargins = nuts.addmargins @@ -626,16 +627,24 @@ deltas = { } do local a_mathalignmentvrule = attributes.private("mathalignmentvrule") + local a_mathalignmenthrule = attributes.private("mathalignmenthrule") - local function first_pass(head,attr,preamble) + -- these loops will be combined + + local dp = { } + local ht = { } + + local function vrule_pass(head,attr,preamble) + local i = 0 for row, id, subtype, list in nextlist, head do if id == hlist_code and subtype == row_code then + i = i + 1 + local prv, nxt = getboth(row) for cell, id, subtype, list in nextlist, list do if list then for n, id, subtype in nextrule, list do local signal = getattr(n,a_mathalignmentvrule) if signal then - local prv, nxt = getboth(row) if prv then if getid(prv) ~= rule_code or not getattr(prv,a_mathalignmentvrule) then prv = nil @@ -646,20 +655,65 @@ do nxt = nil end end - setoffsets(n,nil,nil,not prv and 0 or nil,not nxt and 0 or nil) + local top = not prv and 0 or nil + local bot = not nxt and 0 or nil + setoffsets(n,nil,nil,d and -d or top,h and -h or bot) + end + end + end + end + end + end + end + + local function hrule_pass(head,attr,preamble) + local i = 0 + for row, id, subtype, list in nextlist, head do + if id == hlist_code and subtype == row_code then + i = i + 1 + local height = 0 + local depth = 0 + local done = false + for cell, id, subtype, list in nextlist, list do + if list then + for n, id, subtype in nextglue, list do + local signal = getattr(n,a_mathalignmenthrule) + if signal then + local w, h, d = getwhd(n) + if h and d then + if h > height then + height = h + end + if d > depth then + depth = d + end + done = true + end end end end end + if done then + setheight(row,height) + setdepth(row,depth) + dp[i] = height + ht[i] = depth + end end end end function nodes.handlers.mathmatrixrules(head,where,attr,preamble) if where == "wrapup" then + dp = { } + ht = { } + local signal = getattr(attr,a_mathalignmenthrule) + if signal == 0x01 then -- matrix + hrule_pass(head,attr,preamble) + end local signal = getattr(attr,a_mathalignmentvrule) - if signal == 1 then -- matrix - first_pass(head,attr,preamble) + if signal == 0x01 then -- matrix + vrule_pass(head,attr,preamble) end end end diff --git a/tex/context/base/mkxl/node-ini.lmt b/tex/context/base/mkxl/node-ini.lmt index 53bd082af..34028fa2e 100644 --- a/tex/context/base/mkxl/node-ini.lmt +++ b/tex/context/base/mkxl/node-ini.lmt @@ -226,6 +226,8 @@ local texsetintegervalue = tex.setintegervalue for i=0,nodecodes.glyph do texsetintegervalue(nodecodes[i] .. "nodecode",i,"immutable") end +texsetintegervalue("tempnodecode",nodecodes.temp,"immutable") -- can happen in tables + for i=0,#gluecodes do texsetintegervalue(gluecodes[i] .. "subtypecode",i,"immutable") end diff --git a/tex/context/base/mkxl/pack-box.mkxl b/tex/context/base/mkxl/pack-box.mkxl index 28c1a42f0..ecd793056 100644 --- a/tex/context/base/mkxl/pack-box.mkxl +++ b/tex/context/base/mkxl/pack-box.mkxl @@ -1199,7 +1199,7 @@ \fi \global\setbox\scratchcounterone\hpack\bgroup \unhbox\scratchcounterone - \hskip-\wd\nextbox + \kern-\wd\nextbox \box\nextbox \egroup \endgroup}} diff --git a/tex/context/base/mkxl/pack-cut.mkxl b/tex/context/base/mkxl/pack-cut.mkxl index 0cd06ed43..1e23a97e3 100644 --- a/tex/context/base/mkxl/pack-cut.mkxl +++ b/tex/context/base/mkxl/pack-cut.mkxl @@ -13,6 +13,8 @@ \unprotect +% to be redone in a more modern way + %D \macros %D {makecutbox, cuthbox, cutvbox, cutvtop} %D @@ -101,9 +103,8 @@ \vss}% \hss}} -\permanent\protected\def\makecutbox#1% - {\bgroup - \d_pack_cutmarks_height\ht#1% +\permanent\protected\def\makecutbox#1% not grouped ! + {\d_pack_cutmarks_height\ht#1% \d_pack_cutmarks_depth \dp#1% \d_pack_cutmarks_width \wd#1% \setbox#1\hpack @@ -155,7 +156,7 @@ \wd#1\d_pack_cutmarks_width \ht#1\d_pack_cutmarks_height \dp#1\d_pack_cutmarks_depth - \egroup} + \box#1} \permanent\protected\def\cuthbox{\hpack\bgroup\dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\hbox} \permanent\protected\def\cutvbox{\vpack\bgroup\dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\vbox} diff --git a/tex/context/base/mkxl/pack-mrl.mkxl b/tex/context/base/mkxl/pack-mrl.mkxl index 7a04f3904..b4339b0b2 100644 --- a/tex/context/base/mkxl/pack-mrl.mkxl +++ b/tex/context/base/mkxl/pack-mrl.mkxl @@ -181,7 +181,7 @@ \s!depth \scratchdepth \relax \ifzeropt\scratchdistance\else - \hskip\scratchdistance + \kern\scratchdistance % hskip \fi} \installcorenamespace{blackruletype} @@ -648,7 +648,7 @@ {\llap {\usetextrulesstyleandcolor\c!style\c!color #1% - \hskip\leftmargindistance}} + \kern\leftmargindistance}} % hskip {\color[\directtextrulesparameter\c!rulecolor] {\vrule \s!height\scratchheight @@ -794,7 +794,7 @@ \strut #2% \hfill\directfillinrulesparameter\c!separator - \hskip\scratchdistance + \kern\scratchdistance % hskip \egroup \fi \setupwhitespace[\v!big]% diff --git a/tex/context/base/mkxl/pack-pos.mkxl b/tex/context/base/mkxl/pack-pos.mkxl index aee22081f..e2fd1c8f8 100644 --- a/tex/context/base/mkxl/pack-pos.mkxl +++ b/tex/context/base/mkxl/pack-pos.mkxl @@ -90,7 +90,7 @@ \vbox to \d_pack_positioning_y_dimension {\vskip\d_pack_positioning_y_offset \hbox to \d_pack_positioning_x_dimension - {\hskip\d_pack_positioning_x_offset + {\kern\d_pack_positioning_x_offset \box\b_pack_positioning \hfill} \vfill}% @@ -145,7 +145,7 @@ {\offinterlineskip % else we get an empty line \vskip\d_pack_positioning_y_position \hbox to \zeropoint - {\hskip\d_pack_positioning_x_position + {\kern\d_pack_positioning_x_position \box\nextbox \hss} \vss}% diff --git a/tex/context/base/mkxl/pack-rul.lmt b/tex/context/base/mkxl/pack-rul.lmt index f81a672d2..c2183c1ad 100644 --- a/tex/context/base/mkxl/pack-rul.lmt +++ b/tex/context/base/mkxl/pack-rul.lmt @@ -35,6 +35,8 @@ local equationlist_code = listcodes.equation local texsetdimen = tex.setdimen local texsetcount = tex.setcount +local texisdimen = tex.isdimen +local texiscount = tex.iscount local implement = interfaces.implement @@ -52,8 +54,6 @@ local getdirection = nuts.getdirection local setshift = nuts.setshift local setwidth = nuts.setwidth local getwidth = nuts.getwidth --- local setboxglue = nuts.setboxglue --- local getboxglue = nuts.getboxglue local setboxglue = nuts.setglue local getboxglue = nuts.getglue @@ -73,6 +73,13 @@ directives.register("framed.checkmath",function(v) checkformath = v end) -- expe -- beware: dir nodes and pseudostruts can end up on lines of their own +local c_framednoflines = texiscount("framednoflines") +local d_framedfirstheight = texisdimen("framedfirstheight") +local d_framedlastdepth = texisdimen("framedlastdepth") +local d_framedminwidth = texisdimen("framedminwidth") +local d_framedmaxwidth = texisdimen("framedmaxwidth") +local d_framedaveragewidth = texisdimen("framedaveragewidth") + local function doreshapeframedbox(n,resync) if resync then resync = drivers.converters.resyncbox @@ -148,7 +155,7 @@ local function doreshapeframedbox(n,resync) setlist(p) flushnode(p) elseif checkformath and subtype == equationlist_code then - -- display formulas use a shift + -- display formulas use a shift .. actually we never have display mode if nofnonzero == 1 then setshift(h,0) end @@ -172,12 +179,12 @@ local function doreshapeframedbox(n,resync) end end end - texsetcount("global","framednoflines",noflines) - texsetdimen("global","framedfirstheight",firstheight or 0) -- also signal - texsetdimen("global","framedlastdepth",lastdepth or 0) - texsetdimen("global","framedminwidth",minwidth) - texsetdimen("global","framedmaxwidth",maxwidth) - texsetdimen("global","framedaveragewidth",averagewidth) + texsetcount("global",c_framednoflines,noflines) + texsetdimen("global",d_framedfirstheight,firstheight or 0) -- also signal + texsetdimen("global",d_framedlastdepth,lastdepth or 0) + texsetdimen("global",d_framedminwidth,minwidth) + texsetdimen("global",d_framedmaxwidth,maxwidth) + texsetdimen("global",d_framedaveragewidth,averagewidth) end local function doanalyzeframedbox(n) @@ -206,9 +213,9 @@ local function doanalyzeframedbox(n) end end end - texsetcount("global","framednoflines",noflines) - texsetdimen("global","framedfirstheight",firstheight or 0) - texsetdimen("global","framedlastdepth",lastdepth or 0) + texsetcount("global",c_framednoflines,noflines) + texsetdimen("global",d_framedfirstheight,firstheight or 0) + texsetdimen("global",d_framedlastdepth,lastdepth or 0) end implement { name = "doreshapeframedbox", actions = doreshapeframedbox, arguments = "integer" } diff --git a/tex/context/base/mkxl/pack-rul.mkxl b/tex/context/base/mkxl/pack-rul.mkxl index 803d83bf3..b06e8f57c 100644 --- a/tex/context/base/mkxl/pack-rul.mkxl +++ b/tex/context/base/mkxl/pack-rul.mkxl @@ -18,6 +18,13 @@ %D packaging and expansion we also keep tracing reasonable. For instance, multiple %D stacked backgrounds can slow down a run if not optimized this way. +\newcount\framednoflines +\newdimen\framedfirstheight +\newdimen\framedlastdepth +\newdimen\framedminwidth +\newdimen\framedmaxwidth +\newdimen\framedaveragewidth + \registerctxluafile{pack-rul}{autosuffix,optimize} \unprotect @@ -703,7 +710,7 @@ \def\pack_framed_stroked_box_normal_closed {\hpack\bgroup \scratchdimen.5\d_framed_linewidth - \hskip\scratchdimen + \kern\scratchdimen \clf_framedoutline \dimexpr\d_framed_target_wd-\d_framed_linewidth\relax \dimexpr\d_framed_target_ht-\scratchdimen\relax @@ -2323,12 +2330,12 @@ %D It is possible to let the frame macro calculate the width of a centered box %D automatically (\type {fit}). When doing so, we need to reshape the box: -\newcount\framednoflines -\newdimen\framedfirstheight -\newdimen\framedlastdepth -\newdimen\framedminwidth -\newdimen\framedmaxwidth -\newdimen\framedaveragewidth +% \newcount\framednoflines +% \newdimen\framedfirstheight +% \newdimen\framedlastdepth +% \newdimen\framedminwidth +% \newdimen\framedmaxwidth +% \newdimen\framedaveragewidth \def\pack_framed_reshape_reset {\framednoflines \zerocount diff --git a/tex/context/base/mkxl/page-box.mklx b/tex/context/base/mkxl/page-box.mklx index 56cb73f7a..a65989222 100644 --- a/tex/context/base/mkxl/page-box.mklx +++ b/tex/context/base/mkxl/page-box.mklx @@ -79,10 +79,19 @@ % {\boxxoffset#box\dimexpr\boxxoffset#box\doifbothsides++-\backoffset\relax % \boxyoffset#box\dimexpr\boxyoffset#box-\topoffset\relax} +% \def\page_boxes_apply_offset % #box +% {\unless\ifzeropt\topoffset % we can't do an unless here +% \expandafter\page_boxes_apply_offset_indeed +% \orunless\ifzeropt\backoffset +% \expandafter\page_boxes_apply_offset_indeed +% \else +% \expandafter\gobbleoneargument +% \fi} + \def\page_boxes_apply_offset % #box - {\unless\ifzeropt\topoffset + {\unless\ifdim\topoffset=\zeropoint \expandafter\page_boxes_apply_offset_indeed - \orunless\ifzeropt\backoffset + \orunless\ifdim\backoffset=\zeropoint \expandafter\page_boxes_apply_offset_indeed \else \expandafter\gobbleoneargument @@ -100,9 +109,9 @@ \def\page_boxes_apply_replicate_indeed#box% {\setbox#box\vpack {\offinterlineskip - \dorecurse{\layoutparameter\c!ny} + \dorecurse{\layoutparameter\c!ny}% {\hpack{\dorecurse{\layoutparameter\c!nx}{\copy#box\kern\layoutparameter\c!dx}\unskip}% - \vskip\layoutparameter\c!dy} + \vskip\layoutparameter\c!dy}% \unskip}} \def\page_boxes_apply_orientate_paper#box% diff --git a/tex/context/base/mkxl/spac-ver.lmt b/tex/context/base/mkxl/spac-ver.lmt index 7884a111c..283109f03 100644 --- a/tex/context/base/mkxl/spac-ver.lmt +++ b/tex/context/base/mkxl/spac-ver.lmt @@ -56,6 +56,8 @@ local texsetcount = tex.setcount local texnest = tex.nest local texgetbox = tex.getbox +local tg = texgetdimen + local buildpage = tex.triggerbuildpage local variables = interfaces.variables @@ -69,13 +71,6 @@ local v_split = variables.split local v_min = variables.min local v_max = variables.max local v_none = variables.none -local v_line = variables.line -local v_noheight = variables.noheight -local v_nodepth = variables.nodepth -local v_line = variables.line -local v_halfline = variables.halfline -local v_line_m = "-" .. v_line -local v_halfline_m = "-" .. v_halfline local v_first = variables.first local v_last = variables.last local v_top = variables.top @@ -115,6 +110,11 @@ local a_skiporder = attributes.private('skiporder') local a_snapmethod = attributes.private('snapmethod') local a_snapvbox = attributes.private('snapvbox') +local d_bodyfontstrutheight = tex.isdimen("bodyfontstrutheight") +local d_bodyfontstrutdepth = tex.isdimen("bodyfontstrutdepth") +local d_globalbodyfontstrutheight = tex.isdimen("globalbodyfontstrutheight") +local d_globalbodyfontstrutdepth = tex.isdimen("globalbodyfontstrutdepth") + local nuts = nodes.nuts local tonut = nuts.tonut @@ -357,6 +357,13 @@ end local snap_hlist do + local v_noheight = variables.noheight + local v_nodepth = variables.nodepth + local v_line = variables.line + local v_halfline = variables.halfline + local v_line_m = "-" .. v_line + local v_halfline_m = "-" .. v_halfline + local floor = math.floor local ceil = math.ceil @@ -397,24 +404,24 @@ local snap_hlist do local snapht, snapdp if method[v_local] then -- snapping is done immediately here - snapht = texgetdimen("bodyfontstrutheight") - snapdp = texgetdimen("bodyfontstrutdepth") + snapht = texgetdimen(d_bodyfontstrutheight) + snapdp = texgetdimen(d_bodyfontstrutdepth) if t then t[#t+1] = formatters["local: snapht %p snapdp %p"](snapht,snapdp) end elseif method[v_global] then - snapht = texgetdimen("globalbodyfontstrutheight") - snapdp = texgetdimen("globalbodyfontstrutdepth") + snapht = texgetdimen(d_globalbodyfontstrutheight) + snapdp = texgetdimen(d_globalbodyfontstrutdepth) if t then t[#t+1] = formatters["global: snapht %p snapdp %p"](snapht,snapdp) end else -- maybe autolocal -- snapping might happen later in the otr - snapht = texgetdimen("globalbodyfontstrutheight") - snapdp = texgetdimen("globalbodyfontstrutdepth") - local lsnapht = texgetdimen("bodyfontstrutheight") - local lsnapdp = texgetdimen("bodyfontstrutdepth") + snapht = texgetdimen(d_globalbodyfontstrutheight) + snapdp = texgetdimen(d_globalbodyfontstrutdepth) + local lsnapht = texgetdimen(d_bodyfontstrutheight) + local lsnapdp = texgetdimen(d_bodyfontstrutdepth) if snapht ~= lsnapht and snapdp ~= lsnapdp then snapht, snapdp = lsnapht, lsnapdp end @@ -672,7 +679,7 @@ local snap_hlist do local lines = (ch+cd)/snaphtdp if t then local original = (h+d)/snaphtdp - local whatever = (ch+cd)/(texgetdimen("globalbodyfontstrutheight") + texgetdimen("globalbodyfontstrutdepth")) + local whatever = (ch+cd)/(texgetdimen(d_globalbodyfontstrutheight) + texgetdimen(d_globalbodyfontstrutdepth)) t[#t+1] = formatters["final lines : %p -> %p (%p)"](original,lines,whatever) t[#t+1] = formatters["final height: %p -> %p"](h,ch) t[#t+1] = formatters["final depth : %p -> %p"](d,cd) @@ -1699,10 +1706,10 @@ do -- if trace_vsnapping then report_snapper("global ht/dp = %p/%p, local ht/dp = %p/%p", - texgetdimen("globalbodyfontstrutheight"), - texgetdimen("globalbodyfontstrutdepth"), - texgetdimen("bodyfontstrutheight"), - texgetdimen("bodyfontstrutdepth") + texgetdimen(d_globalbodyfontstrutheight), + texgetdimen(d_globalbodyfontstrutdepth), + texgetdimen(d_bodyfontstrutheight), + texgetdimen(d_bodyfontstrutdepth) ) end if trace then diff --git a/tex/context/base/mkxl/spac-ver.mkxl b/tex/context/base/mkxl/spac-ver.mkxl index 28a1151fb..7ab80d6a9 100644 --- a/tex/context/base/mkxl/spac-ver.mkxl +++ b/tex/context/base/mkxl/spac-ver.mkxl @@ -15,6 +15,14 @@ \unprotect +\newskip \bodyfontlineheight % why a skip +\newdimen \bodyfontstrutheight +\newdimen \bodyfontstrutdepth + +\newskip \globalbodyfontlineheight % why a skip +\newdimen \globalbodyfontstrutheight +\newdimen \globalbodyfontstrutdepth + \registerctxluafile{spac-ver}{autosuffix,optimize} % todo: use usernodes ? @@ -1396,13 +1404,13 @@ \installcorenamespace{gridsnapperattributes} \installcorenamespace{gridsnappersets} -\newskip \bodyfontlineheight -\newdimen \bodyfontstrutheight -\newdimen \bodyfontstrutdepth +% \newskip \bodyfontlineheight % see top +% \newdimen \bodyfontstrutheight % see top +% \newdimen \bodyfontstrutdepth % see top -\newskip \globalbodyfontlineheight % why a skip -\newdimen \globalbodyfontstrutheight -\newdimen \globalbodyfontstrutdepth +% \newskip \globalbodyfontlineheight % see top +% \newdimen \globalbodyfontstrutheight % see top +% \newdimen \globalbodyfontstrutdepth % see top \permanent\def\snappedvboxattribute{\ifgridsnapping attr\snapvboxattribute\c_attr_snapmethod\fi} \permanent\def\setlocalgridsnapping{\ifgridsnapping \c_attr_snapvbox \c_attr_snapmethod\fi} diff --git a/tex/context/base/mkxl/strc-lst.mklx b/tex/context/base/mkxl/strc-lst.mklx index 785d566cf..c04d68fa7 100644 --- a/tex/context/base/mkxl/strc-lst.mklx +++ b/tex/context/base/mkxl/strc-lst.mklx @@ -146,7 +146,7 @@ \scratchcounter\clf_addtolist references { internal \locationcount - % block {\currentsectionblock} + % block {\currentsectionblock} % needed for publications (can be get from section) % section structures.sections.currentid() % location {\p_location} } diff --git a/tex/context/base/mkxl/strc-ref.lmt b/tex/context/base/mkxl/strc-ref.lmt index 7ad20fa34..32c2a5429 100644 --- a/tex/context/base/mkxl/strc-ref.lmt +++ b/tex/context/base/mkxl/strc-ref.lmt @@ -54,6 +54,7 @@ local implement = interfaces.implement local ctx_latelua = context.latelua +local texiscount = tex.iscount local texgetcount = tex.getcount local texsetcount = tex.setcount local texconditionals = tex.conditionals @@ -124,6 +125,11 @@ local currentreference = nil local txtcatcodes = catcodes.numbers.txtcatcodes -- or just use "txtcatcodes" +local c_realpageno = texiscount("realpageno") +local c_locationcount = texiscount("locationcount") +local c_locationorder = texiscount("locationorder") +local c_lastdestinationattribute = texiscount("lastdestinationattribute") + local context = context local ctx_pushcatcodes = context.pushcatcodes @@ -294,7 +300,7 @@ local function referredpage(n) end end -- fallback - return texgetcount("realpageno") + return texgetcount(c_realpageno) end references.referredpage = referredpage @@ -304,7 +310,7 @@ function references.registerpage(n) -- called in the backend code if n > maxreferred then maxreferred = n end - tobereferred[n] = texgetcount("realpageno") + tobereferred[n] = texgetcount(c_realpageno) end end @@ -323,14 +329,14 @@ local function setnextorder(kind,name) lastorder = (ok[name] or 0) + 1 ok[name] = lastorder end - texsetcount("global","locationorder",lastorder) + texsetcount("global",c_locationorder,lastorder) end local function setnextinternal(kind,name) setnextorder(kind,name) -- always incremented with internal - local n = texgetcount("locationcount") + 1 - texsetcount("global","locationcount",n) + local n = texgetcount(c_locationcount) + 1 + texsetcount("global",c_locationcount,n) return n end @@ -433,12 +439,12 @@ end -- function references.enhance(prefix,tag) -- local l = tobesaved[prefix][tag] -- if l then --- l.references.realpage = texgetcount("realpageno") +-- l.references.realpage = texgetcount(c_realpageno) -- end -- end local function synchronizepage(reference) -- non public helper - reference.realpage = texgetcount("realpageno") + reference.realpage = texgetcount(c_realpageno) if jobpositions.used() then reference.x, reference.y = getpos() end @@ -2040,7 +2046,7 @@ local function setinternalreference(specification) if internal then -- new destinationattributes[internal] = destination end - texsetcount("lastdestinationattribute",destination) + texsetcount(c_lastdestinationattribute,destination) return destination end @@ -2107,7 +2113,7 @@ function references.setandgetattribute(data) -- maybe do internal automatically } or unsetvalue end end - texsetcount("lastdestinationattribute",attr) + texsetcount(c_lastdestinationattribute,attr) return attr end @@ -2685,7 +2691,7 @@ function references.checkedrealpage(r) realpageofpage(r) -- just initialize end if not r then - return texgetcount("realpageno") + return texgetcount(c_realpageno) elseif r < 1 then return 1 elseif r > nofrealpages then @@ -2780,7 +2786,7 @@ end function specials.deltapage(var,actions) local p = tonumber(var.operation) if p then - p = references.checkedrealpage(p + texgetcount("realpageno")) + p = references.checkedrealpage(p + texgetcount(c_realpageno)) var.r = p actions.realpage = actions.realpage or p -- first wins end diff --git a/tex/context/base/mkxl/strc-ref.mklx b/tex/context/base/mkxl/strc-ref.mklx index 07c8c2c1b..012d9d92d 100644 --- a/tex/context/base/mkxl/strc-ref.mklx +++ b/tex/context/base/mkxl/strc-ref.mklx @@ -27,6 +27,14 @@ \writestatus{loading}{ConTeXt Structure Macros / Cross Referencing} +\newif \iflocation +\newcount\locationcount +\newcount\locationorder +\newbox \locationbox + +\newcount\lastreferenceattribute +\newcount\lastdestinationattribute + \registerctxluafile{strc-rsc}{autosuffix} \registerctxluafile{strc-ref}{autosuffix} \registerctxluafile{node-ref}{autosuffix,optimize} @@ -137,8 +145,8 @@ %D Actually there is not much difference between a text and a full reference, but %D it's the concept that counts. The low level implementation is: -\newcount\lastreferenceattribute -\newcount\lastdestinationattribute +% sett top : \newcount\lastreferenceattribute +% sett top : \newcount\lastdestinationattribute \def\strc_references_finish#prefix#reference#internal% gets expanded anyway {\normalexpanded{\clf_deferredenhancereference{#prefix}{#reference}}} @@ -803,10 +811,10 @@ %D %D We could do this in \LUA\ \unknown -\newif \iflocation -\newcount\locationcount -\newcount\locationorder -\newbox \locationbox +% seet top: \newif \iflocation +% seet top: \newcount\locationcount +% seet top: \newcount\locationorder +% seet top: \newbox \locationbox \appendtoks \locationfalse diff --git a/tex/context/base/mkxl/strc-reg.lmt b/tex/context/base/mkxl/strc-reg.lmt index a45f23bf0..85198a151 100644 --- a/tex/context/base/mkxl/strc-reg.lmt +++ b/tex/context/base/mkxl/strc-reg.lmt @@ -34,6 +34,7 @@ local processors = typesetters.processors local splitprocessor = processors.split local texgetcount = tex.getcount +local texiscount = tex.iscount local variables = interfaces.variables local v_forward = variables.forward @@ -67,6 +68,9 @@ local setmetatableindex = table.setmetatableindex local absmaxlevel = 5 -- \c_strc_registers_maxlevel +local c_realpageno = texiscount("realpageno") +local c_locationcount = texiscount("locationcount") + local h_prefixpage = helpers.prefixpage local h_prefixlastpage = helpers.prefixlastpage local h_title = helpers.title @@ -564,7 +568,7 @@ local function storeregister(rawdata) -- metadata, references, entries -- local internal = references.internal if not internal then - internal = texgetcount("locationcount") -- we assume that it has been set + internal = texgetcount(c_locationcount) -- we assume that it has been set references.internal = internal end -- @@ -606,7 +610,7 @@ local function enhanceregister(specification) local data = saved.metadata.notsaved and collected[name] or saved local entry = data.entries[n] if entry then - entry.references.realpage = texgetcount("realpageno") + entry.references.realpage = texgetcount(c_realpageno) end end @@ -621,7 +625,7 @@ local function extendregister(name,tag,rawdata) -- maybe do lastsection internal local entry = data.entries[tag] if entry then local references = entry.references - references.lastrealpage = texgetcount("realpageno") + references.lastrealpage = texgetcount(c_realpageno) references.lastsection = currentid() if rawdata then local userdata = rawdata.userdata diff --git a/tex/context/base/mkxl/strc-reg.mkxl b/tex/context/base/mkxl/strc-reg.mkxl index 22b1202db..b0f50ecfd 100644 --- a/tex/context/base/mkxl/strc-reg.mkxl +++ b/tex/context/base/mkxl/strc-reg.mkxl @@ -1068,11 +1068,14 @@ % \applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}% % \fi} +\let\currentregisterrealpage\!!zerocount % todo: more general accessor + \permanent\protected\def\withregisterpagecommand#1#2#3#4% {\ifcase#3\relax {\tt [entry\space not\space flushed]}% \else \def\currentregisterpageindex{#2}% + \def\currentregisterrealpage{#3}% \iflocation \strc_references_goto_internal{\applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}}[internal(#2)]% \else diff --git a/tex/context/base/mkxl/syst-ini.mkxl b/tex/context/base/mkxl/syst-ini.mkxl index 0c5251373..96bdde764 100644 --- a/tex/context/base/mkxl/syst-ini.mkxl +++ b/tex/context/base/mkxl/syst-ini.mkxl @@ -990,7 +990,8 @@ %D \ifzeropt \somedimen ... \else ... \fi %D \stoptyping -\aliased\let\ifzeropt\ifcase +\aliased\let\ifzeropt\ifzerodim % was \let\ifzeropt\ifcase +\aliased\let\ifzero \ifzeronum % was \let\ifzeropt\ifcase % these token list helpers might move to syst-aux.mkiv % @@ -1254,8 +1255,8 @@ %D For a while we will keep these useless numbers as for instance tikz checks for them: -\immutable\integerdef\eTeXversion 2 -\immutable\def \eTeXrevision {2} +\immutable\integerdef\eTeXversion 2 +\immutable\def \eTeXrevision {.2} % there is a funny period here % %D Just in case users use this (or some styles still have it): diff --git a/tex/context/base/mkxl/tabl-tbl.mkxl b/tex/context/base/mkxl/tabl-tbl.mkxl index 4d4037ff6..851984bea 100644 --- a/tex/context/base/mkxl/tabl-tbl.mkxl +++ b/tex/context/base/mkxl/tabl-tbl.mkxl @@ -407,11 +407,11 @@ % \protected % we can expand this one \def\tabl_tabulate_inject_pre_skip#1% {\ifdim#1>\zeropoint - \kern#1\relax % was \hskip + \kern#1\relax % hskip \orelse\ifnum\c_tabl_tabulate_column=\zerocount \ifconditional\c_tabl_tabulate_autorulespacing \ifcase\c_tabl_tabulate_has_rule_spec_first\else - \kern\s_tabl_tabulate_first\relax % was \hskip + \kern\s_tabl_tabulate_first\relax % hskip \fi \fi \fi} @@ -423,7 +423,7 @@ \orelse\ifnum\c_tabl_tabulate_columns=\c_tabl_tabulate_nofcolumns \ifconditional\c_tabl_tabulate_autorulespacing \ifcase\c_tabl_tabulate_has_rule_spec_last\else - \kern\s_tabl_tabulate_last\relax % was \hskip + \kern\s_tabl_tabulate_last\relax % hskip \fi \fi \fi} diff --git a/tex/context/base/mkxl/task-ini.lmt b/tex/context/base/mkxl/task-ini.lmt index 9c90aba02..17555d7e2 100644 --- a/tex/context/base/mkxl/task-ini.lmt +++ b/tex/context/base/mkxl/task-ini.lmt @@ -122,7 +122,7 @@ appendaction("math", "normalizers", "noads.handlers.dictionaries", appendaction("math", "normalizers", "noads.handlers.suspicious", nil, "nonut", "enabled" ) appendaction("math", "builders", "builders.kernel.mlisttohlist", nil, "nut", "enabled" ) -- mandate -appendaction("math", "builders", "typesetters.directions.processmath", nil, "nut", "disabled" ) +------------("math", "builders", "typesetters.directions.processmath", nil, "nut", "disabled" ) appendaction("math", "builders", "noads.handlers.makeup", nil, "nonut", "disabled" ) ------------("math", "builders", "noads.handlers.align", nil, "nonut", "enabled" ) diff --git a/tex/context/base/mkxl/type-set.mkxl b/tex/context/base/mkxl/type-set.mkxl index a14a99630..ae07bd914 100644 --- a/tex/context/base/mkxl/type-set.mkxl +++ b/tex/context/base/mkxl/type-set.mkxl @@ -134,6 +134,7 @@ \definefilesynonym [type-imp-coloredsheep.mkiv] [type-imp-koeielettersot.mkiv] \definefilesynonym [type-imp-koeieletters.mkiv] [type-imp-koeielettersot.mkiv] +\definefilesynonym [type-imp-xits.mkiv] [type-imp-stix.mkiv] \definefilesynonym [type-imp-stixtwo.mkiv] [type-imp-stix.mkiv] \definefilesynonym [type-imp-ibmplex.mkiv] [type-imp-plex.mkiv] |