summaryrefslogtreecommitdiff
path: root/tex/context/base/math-noa.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2011-06-23 20:40:17 +0300
committerMarius <mariausol@gmail.com>2011-06-23 20:40:17 +0300
commit1f49aee839e281d04be7b6cb6f959590bed1d581 (patch)
treeecca5409a1481e7f99dc407735bb76730e7aff2d /tex/context/base/math-noa.lua
parent06465c8428905be5c083c70f4e7de6a59d129139 (diff)
downloadcontext-1f49aee839e281d04be7b6cb6f959590bed1d581.tar.gz
beta 2011.06.23 19:25
Diffstat (limited to 'tex/context/base/math-noa.lua')
-rw-r--r--tex/context/base/math-noa.lua51
1 files changed, 47 insertions, 4 deletions
diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua
index 36922b60a..28965a09a 100644
--- a/tex/context/base/math-noa.lua
+++ b/tex/context/base/math-noa.lua
@@ -15,6 +15,9 @@ if not modules then modules = { } end modules ['math-noa'] = {
-- beware: names will change as we wil make noads.xxx.handler i.e. xxx
-- subnamespaces
+-- 20D6 -> 2190
+-- 20D7 -> 2192
+
local utf = unicode.utf8
local utfchar, utfbyte = utf.char, utf.byte
@@ -590,7 +593,7 @@ registerotffeature {
local getalternate = otf.getalternate
-local mathalternate = attributes.private("mathalternate")
+local a_mathalternate = attributes.private("mathalternate")
local alternate = { } -- processors.alternate = alternate
@@ -600,14 +603,14 @@ function mathematics.setalternate(fam,tag)
local mathalternates = tfmdata.shared.mathalternates
if mathalternates then
local m = mathalternates[tag]
- tex.attribute[mathalternate] = m and m.attribute or attributes.unsetvalue
+ tex.attribute[a_mathalternate] = m and m.attribute or attributes.unsetvalue
end
end
alternate[math_char] = function(pointer)
- local a = has_attribute(pointer,mathalternate)
+ local a = has_attribute(pointer,a_mathalternate)
if a and a > 0 then
- set_attribute(pointer,mathalternate,0)
+ set_attribute(pointer,a_mathalternate,0)
local tfmdata = fontdata[font_of_family(pointer.fam)] -- we can also have a famdata
local mathalternatesattributes = tfmdata.shared.mathalternatesattributes
if mathalternatesattributes then
@@ -625,6 +628,46 @@ function handlers.check(head,style,penalties)
return true
end
+-- experiment (when not present fall back to fam 0)
+
+local families = { }
+
+local a_mathfamily = attributes.private("mathfamily")
+
+families[math_char] = function(pointer)
+ if pointer.fam == 255 then
+ local a = has_attribute(pointer,a_mathfamily)
+ if a and a > 0 then
+ set_attribute(pointer,a_mathfamily,0)
+ pointer.fam = a
+ else
+ pointer.fam = 0
+ end
+ end
+end
+
+families[math_delim] = function(pointer)
+ if pointer.small_fam == 255 then
+ local a = has_attribute(pointer,a_mathfamily)
+ if a and a > 0 then
+ set_attribute(pointer,a_mathfamily,0)
+ pointer.small_fam = a
+ pointer.large_fam = a
+ else
+ pointer.small_fam = 0
+ pointer.large_fam = 0
+ end
+ end
+end
+
+families[math_textchar] = families[math_char]
+
+function handlers.families(head,style,penalties)
+ processnoads(head,families,"families")
+ return true
+end
+
+
-- the normal builder
function builders.kernel.mlist_to_hlist(head,style,penalties)