diff options
author | Karl Berry <karl@freefriends.org> | 2018-03-20 22:10:59 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-03-20 22:10:59 +0000 |
commit | 65d009a0596b194597f47531523addd3e64ed005 (patch) | |
tree | e13bd9beecf63e26491a66aa7a8fa702482f0067 /Master/texmf-dist/tex/context/base/mkiv/math-ext.lua | |
parent | d1a186333ced7b341e26877907343f08211199f7 (diff) |
context [current] (20mar18)
git-svn-id: svn://tug.org/texlive/trunk@47050 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/math-ext.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/math-ext.lua | 130 |
1 files changed, 26 insertions, 104 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/math-ext.lua b/Master/texmf-dist/tex/context/base/mkiv/math-ext.lua index b00d6cde273..a4b8657136c 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/math-ext.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/math-ext.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['math-ext'] = { license = "see context related readme files" } +local rawget = rawget + local trace_virtual = false trackers.register("math.virtual", function(v) trace_virtual = v end) local basename = file.basename @@ -18,33 +20,40 @@ local report_math = logs.reporter("mathematics") mathematics.extras = mathematics.extras or { } local extras = mathematics.extras -characters.math = characters.math or { } -local mathdata = characters.math +local mathplus = { } local chardata = characters.data +local mathpairs = characters.mathpairs + +-- todo: store them and skip storage if already stored +-- todo: make a char-ctx.lua (or is this already side effect of save in format) -function extras.add(unicode,t) -- todo: if already stored ... - local min, max = mathematics.extrabase, mathematics.privatebase - 1 - -- if mathdata[unicode] or chardata[unicode] then - -- report_math("extra %U overloads existing character",unicode) - -- end +local function addextra(unicode) + local min = mathematics.extrabase + local max = mathematics.privatebase - 1 if unicode >= min and unicode <= max then - mathdata[unicode], chardata[unicode] = t, t + if chardata[unicode] then + mathplus[unicode] = true + else + report_math("extra %U is not a registered code point",unicode) + end else report_math("extra %U should be in range %U - %U",unicode,min,max) end end +extras.add = addextra + 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] + for unicode in table.sortedhash(mathplus) do + local extradesc = chardata[unicode] local nextinsize = extradesc.nextinsize if nextinsize then - local first = 1 - local charused = unicode + local extrachar = characters[unicode] + local first = 1 + local charused = unicode if not extrachar then for i=1,#nextinsize do local slot = nextinsize[i] @@ -104,94 +113,7 @@ end utilities.sequencers.appendaction(mathactions,"system","mathematics.extras.copy") --- 0xFE302 -- 0xFE320 for accents (gone with new lm/gyre) --- --- extras.add(0xFE302, { --- category="mn", --- description="WIDE MATHEMATICAL HAT", --- direction="nsm", --- linebreak="cm", --- mathclass="topaccent", --- mathname="widehat", --- mathstretch="h", --- unicodeslot=0xFE302, --- nextinsize={ 0x00302, 0x0005E }, --- } ) --- --- extras.add(0xFE303, { --- category="mn", --- cjkwd="a", --- description="WIDE MATHEMATICAL TILDE", --- direction="nsm", --- linebreak="cm", --- mathclass="topaccent", --- mathname="widetilde", --- mathstretch="h", --- unicodeslot=0xFE303, --- nextinsize={ 0x00303, 0x0007E }, --- } ) - --- 0xFE321 -- 0xFE340 for missing characters - -extras.add(0xFE321, { - category="sm", - description="MATHEMATICAL SHORT BAR", - -- direction="on", - -- linebreak="nu", - mathclass="relation", - mathname="mapstochar", - unicodeslot=0xFE321, -} ) - -extras.add(0xFE322, { - category="sm", - description="MATHEMATICAL LEFT HOOK", - mathclass="relation", - mathname="lhook", - unicodeslot=0xFE322, -} ) - -extras.add(0xFE323, { - category="sm", - description="MATHEMATICAL RIGHT HOOK", - mathclass="relation", - mathname="rhook", - unicodeslot=0xFE323, -} ) - -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", ---~ linebreak="al", ---~ mathclass="doubleaccent", ---~ mathname="doubleparent", ---~ unicodeslot=0xFE304, ---~ accents={ 0x023DC, 0x023DD }, ---~ } ) - ---~ extras.add(0xFE305, { ---~ category="sm", ---~ description="TOP AND BOTTOM BRACES", ---~ direction="on", ---~ linebreak="al", ---~ mathclass="doubleaccent", ---~ mathname="doublebrace", ---~ unicodeslot=0xFE305, ---~ accents={ 0x023DE, 0x023DF }, ---~ } ) - ---~ \Umathchardef\braceld="0 "1 "FF07A ---~ \Umathchardef\bracerd="0 "1 "FF07B ---~ \Umathchardef\bracelu="0 "1 "FF07C ---~ \Umathchardef\braceru="0 "1 "FF07D +extras.add(0xFE321) +extras.add(0xFE322) +extras.add(0xFE323) +extras.add(0xFE324) |