summaryrefslogtreecommitdiff
path: root/tex/context/base/math-ini.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2012-01-25 14:20:15 +0200
committerMarius <mariausol@gmail.com>2012-01-25 14:20:15 +0200
commitbc7656c9cd089ccd081d6af10602bfd82d1b277a (patch)
tree26c55fc22a23fabb93076966583b6199769e4134 /tex/context/base/math-ini.lua
parent730c0337f4323fe717a290181cf4ffcde52153b5 (diff)
downloadcontext-bc7656c9cd089ccd081d6af10602bfd82d1b277a.tar.gz
beta 2012.01.25 13:09
Diffstat (limited to 'tex/context/base/math-ini.lua')
-rw-r--r--tex/context/base/math-ini.lua25
1 files changed, 21 insertions, 4 deletions
diff --git a/tex/context/base/math-ini.lua b/tex/context/base/math-ini.lua
index cb1a72926..663f6bb1e 100644
--- a/tex/context/base/math-ini.lua
+++ b/tex/context/base/math-ini.lua
@@ -8,12 +8,16 @@ if not modules then modules = { } end modules ['math-ext'] = {
-- if needed we can use the info here to set up xetex definition files
-- the "8000 hackery influences direct characters (utf) as indirect \char's
+--
+-- isn't characters.data loaded already ... shortcut it here
local format, utfchar, utfbyte = string.format, utf.char, utf.byte
local setmathcode, setdelcode = tex.setmathcode, tex.setdelcode
local texattribute = tex.attribute
local floor = math.floor
+local context = context
+
local contextsprint = context.sprint
local contextfprint = context.fprint -- a bit inefficient
@@ -316,28 +320,41 @@ end
-- needed for mathml analysis
-function mathematics.utfmathclass(chr, default)
+local function utfmathclass(chr, default)
local cd = characters.data[utfbyte(chr)]
return (cd and cd.mathclass) or default or "unknown"
end
-function mathematics.utfmathstretch(chr, default) -- "h", "v", "b", ""
+local function utfmathstretch(chr, default) -- "h", "v", "b", ""
local cd = characters.data[utfbyte(chr)]
return (cd and cd.mathstretch) or default or ""
end
-function mathematics.utfmathcommand(chr, default)
+local function utfmathcommand(chr, default)
local cd = characters.data[utfbyte(chr)]
local cmd = cd and cd.mathname
return cmd or default or ""
end
-function mathematics.utfmathfiller(chr, default)
+local function utfmathfiller(chr, default)
local cd = characters.data[utfbyte(chr)]
local cmd = cd and (cd.mathfiller or cd.mathname)
return cmd or default or ""
end
+mathematics.utfmathclass = utfmathclass
+mathematics.utfmathstretch = utfmathstretch
+mathematics.utfmathcommand = utfmathcommand
+mathematics.utfmathfiller = utfmathfiller
+
+-- interfaced
+
+function commands.utfmathclass (chr) context(utfmathclass (chr)) end
+function commands.utfmathstretch(chr) context(utfmathstretch(chr)) end
+function commands.utfmathcommand(chr) context(utfmathcommand(chr)) end
+function commands.utfmathfiller (chr) context(utfmathfiller (chr)) end
+
+
-- helpers
function mathematics.big(tfmdata,unicode,n)