summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/math-noa.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-02-09 01:00:38 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2018-02-09 01:00:38 +0100
commitf4c9d2d305f1214a144fcb23a66964761583234a (patch)
treee296f0ac0541d75729af1272346f30506405a6a4 /tex/context/base/mkiv/math-noa.lua
parent1687077b0a63417ad4dce58f6c869a6e115d9b72 (diff)
downloadcontext-f4c9d2d305f1214a144fcb23a66964761583234a.tar.gz
2018-02-09 00:12:00
Diffstat (limited to 'tex/context/base/mkiv/math-noa.lua')
-rw-r--r--tex/context/base/mkiv/math-noa.lua28
1 files changed, 19 insertions, 9 deletions
diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua
index f20712b31..a00c94a52 100644
--- a/tex/context/base/mkiv/math-noa.lua
+++ b/tex/context/base/mkiv/math-noa.lua
@@ -1175,6 +1175,7 @@ do
alternates = alternates,
registered = registered,
presets = { },
+ resets = { },
hashes = setmetatableindex("table")
}
resources.mathalternates = mathalternates
@@ -1239,7 +1240,7 @@ do
local fontdata = fonts.hashes.identifiers
local fontresources = fonts.hashes.resources
- local function getalternate(fam,tag)
+ local function getalternate(fam,tag,current)
local resources = fontresources[font_of_family(fam)]
local attribute = unsetvalue
if resources then
@@ -1247,25 +1248,37 @@ do
if mathalternates then
local presets = mathalternates.presets
if presets then
+ local resets = mathalternates.resets
attribute = presets[tag]
if not attribute then
attribute = 0
local alternates = mathalternates.alternates
for s in gmatch(tag,"[^, ]+") do
- local a = alternates[s] -- or known[s]
- if a then
- attribute = attribute + a
+ if s == v_reset then
+ resets[tag] = true
+ current = unsetvalue
+ else
+ local a = alternates[s] -- or known[s]
+ if a then
+ attribute = bor(attribute,a)
+ end
end
end
if attribute == 0 then
attribute = unsetvalue
end
presets[tag] = attribute
+ elseif resets[tag] then
+ current = unsetvalue
end
end
end
end
- return attribute
+ if attribute > 0 and current and current > 0 then
+ return bor(current,attribute)
+ else
+ return attribute
+ end
end
local function presetalternate(fam,tag)
@@ -1280,10 +1293,7 @@ do
local function setalternate(fam,tag)
local a = texgetattribute(a_mathalternate)
- local v = getalternate(fam,tag)
- if a and a > 0 then
- v = a + v
- end
+ local v = getalternate(fam,tag,a)
texsetattribute(a_mathalternate,v)
end