diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/math-ext.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/math-ext.lua | 105 |
1 files changed, 58 insertions, 47 deletions
diff --git a/Master/texmf-dist/tex/context/base/math-ext.lua b/Master/texmf-dist/tex/context/base/math-ext.lua index 673103677e0..da00c7a9ea8 100644 --- a/Master/texmf-dist/tex/context/base/math-ext.lua +++ b/Master/texmf-dist/tex/context/base/math-ext.lua @@ -8,72 +8,73 @@ if not modules then modules = { } end modules ['math-ext'] = { local trace_virtual = false trackers.register("math.virtual", function(v) trace_virtual = v end) -mathematics = mathematics or { } -characters = characters or { } +local mathematics = mathematics +local characters = characters + +local report_math = logs.reporter("mathematics") mathematics.extras = mathematics.extras or { } -characters.math = characters.math or { } +local extras = mathematics.extras -local chardata = characters.data -local mathdata = characters.math +characters.math = characters.math or { } +local mathdata = characters.math +local chardata = characters.data -function mathematics.extras.add(unicode,t) +function extras.add(unicode,t) local min, max = mathematics.extrabase, mathematics.privatebase - 1 if unicode >= min and unicode <= max then mathdata[unicode], chardata[unicode] = t, t else - logs.report("math extra","extra U+%04X should be in range U+%04X - U+%04X",unicode,min,max) + report_math("extra U+%05X should be in range U+%05X - U+%05X",unicode,min,max) end end -function mathematics.extras.copy(tfmdata) - local math_parameters = tfmdata.math_parameters - local MathConstants = tfmdata.MathConstants - if (math_parameters and next(math_parameters)) or (MathConstants and next(MathConstants)) then - local characters = tfmdata.characters - for unicode, extradesc in next, mathdata do - -- always, because in an intermediate step we can have a non math font - local extrachar = characters[unicode] - local nextinsize = extradesc.nextinsize - if nextinsize then - for i=1,#nextinsize do - local nextslot = nextinsize[i] - local nextbase = characters[nextslot] - if nextbase then - local nextnext = nextbase and nextbase.next - if nextnext then - local nextchar = characters[nextnext] - if nextchar then - if trace_virtual then - logs.report("math extra","extra U+%04X in %s at %s maps on U+%04X (class: %s, name: %s)",unicode,file.basename(tfmdata.fullname),tfmdata.size,nextslot,extradesc.mathclass or "?",extradesc.mathname or "?") - end - characters[unicode] = nextchar - break +function extras.copy(target,original) + local characters = target.characters + local properties = target.properties + local parameters = target.parameters + for unicode, extradesc in next, mathdata do + -- always, because in an intermediate step we can have a non math font + local extrachar = characters[unicode] + local nextinsize = extradesc.nextinsize + if nextinsize then + for i=1,#nextinsize do + local nextslot = nextinsize[i] + local nextbase = characters[nextslot] + if nextbase then + local nextnext = nextbase and nextbase.next + if nextnext then + local nextchar = characters[nextnext] + if nextchar then + if trace_virtual then + report_math("extra U+%05X in %s at %s maps on U+%05X (class: %s, name: %s)",unicode, + file.basename(properties.fullname),parameters.size,nextslot,extradesc.mathclass or "?",extradesc.mathname or "?") end - end - end - end - if not characters[unicode] then - for i=1,#nextinsize do - local nextbase = characters[nextinsize[i]] - if nextbase then characters[unicode] = nextchar break end end end end + if not characters[unicode] then -- can be set in previous loop + for i=1,#nextinsize do + local nextslot = nextinsize[i] + local nextbase = characters[nextslot] + if nextbase then + characters[unicode] = nextbase -- still ok? + break + end + end + end end - else - -- let's not waste time on non-math end end -table.insert(fonts.tfm.mathactions,mathematics.extras.copy) +utilities.sequencers.appendaction(mathactions,"system","mathematics.extras.copy") -- 0xFE302 -- 0xFE320 for accents -mathematics.extras.add(0xFE302, { +extras.add(0xFE302, { category="mn", description="WIDE MATHEMATICAL HAT", direction="nsm", @@ -85,7 +86,7 @@ mathematics.extras.add(0xFE302, { nextinsize={ 0x00302, 0x0005E }, } ) -mathematics.extras.add(0xFE303, { +extras.add(0xFE303, { category="mn", cjkwd="a", description="WIDE MATHEMATICAL TILDE", @@ -100,7 +101,7 @@ mathematics.extras.add(0xFE303, { -- 0xFE321 -- 0xFE340 for missing characters -mathematics.extras.add(0xFE321, { +extras.add(0xFE321, { category="sm", description="MATHEMATICAL SHORT BAR", -- direction="on", @@ -110,7 +111,7 @@ mathematics.extras.add(0xFE321, { unicodeslot=0xFE321, } ) -mathematics.extras.add(0xFE322, { +extras.add(0xFE322, { category="sm", description="MATHEMATICAL LEFT HOOK", mathclass="relation", @@ -118,7 +119,7 @@ mathematics.extras.add(0xFE322, { unicodeslot=0xFE322, } ) -mathematics.extras.add(0xFE323, { +extras.add(0xFE323, { category="sm", description="MATHEMATICAL RIGHT HOOK", mathclass="relation", @@ -126,7 +127,17 @@ mathematics.extras.add(0xFE323, { unicodeslot=0xFE323, } ) ---~ mathematics.extras.add(0xFE304, { +extras.add(0xFE324, { + category="sm", + description="MATHEMATICAL SHORT BAR MIRRORED", +-- direction="on", +-- linebreak="nu", + mathclass="relation", + mathname="mapsfromchar", + unicodeslot=0xFE324, +} ) + +--~ extras.add(0xFE304, { --~ category="sm", --~ description="TOP AND BOTTOM PARENTHESES", --~ direction="on", @@ -137,7 +148,7 @@ mathematics.extras.add(0xFE323, { --~ accents={ 0x023DC, 0x023DD }, --~ } ) ---~ mathematics.extras.add(0xFE305, { +--~ extras.add(0xFE305, { --~ category="sm", --~ description="TOP AND BOTTOM BRACES", --~ direction="on", |