summaryrefslogtreecommitdiff
path: root/tex/context/base/font-ctx.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/font-ctx.lua')
-rw-r--r--tex/context/base/font-ctx.lua38
1 files changed, 25 insertions, 13 deletions
diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua
index b08a6aed2..8c4992d0c 100644
--- a/tex/context/base/font-ctx.lua
+++ b/tex/context/base/font-ctx.lua
@@ -57,6 +57,16 @@ local helpers = fonts.helpers
local hashes = fonts.hashes
local currentfont = font.current
+local nuts = nodes.nuts
+local tonut = nuts.tonut
+
+local getfield = nuts.getfield
+local getattr = nuts.getattr
+local getfont = nuts.getfont
+
+local setfield = nuts.setfield
+local setattr = nuts.setattr
+
local texgetattribute = tex.getattribute
local texsetattribute = tex.setattribute
local texgetdimen = tex.getdimen
@@ -1901,24 +1911,25 @@ end
-- a fontkern plug:
-local copy_node = node.copy
-local kern = nodes.pool.register(nodes.pool.kern())
-node.set_attribute(kern,attributes.private('fontkern'),1) -- we can have several, attributes are shared
+local copy_node = nuts.copy
+local kern = nuts.pool.register(nuts.pool.kern())
+
+setattr(kern,attributes.private('fontkern'),1) -- we can have several, attributes are shared
nodes.injections.installnewkern(function(k)
local c = copy_node(kern)
- c.kern = k
+ setfield(c,"kern",k)
return c
end)
-directives.register("nodes.injections.fontkern", function(v) kern.subtype = v and 0 or 1 end)
+directives.register("nodes.injections.fontkern", function(v) setfield(kern,"subtype",v and 0 or 1) end)
-- here
local trace_analyzing = false trackers.register("otf.analyzing", function(v) trace_analyzing = v end)
-local otffeatures = fonts.constructors.newfeatures("otf")
+local otffeatures = constructors.newfeatures("otf")
local registerotffeature = otffeatures.register
local analyzers = fonts.analyzers
@@ -1926,7 +1937,7 @@ local methods = analyzers.methods
local unsetvalue = attributes.unsetvalue
-local traverse_by_id = node.traverse_id
+local traverse_by_id = nuts.traverse_id
local a_color = attributes.private('color')
local a_colormodel = attributes.private('colormodel')
@@ -1953,16 +1964,17 @@ local names = {
local function markstates(head)
if head then
- local model = head[a_colormodel] or 1
+ head = tonut(head)
+ local model = getattr(head,a_colormodel) or 1
for glyph in traverse_by_id(glyph_code,head) do
- local a = glyph[a_state]
+ local a = getattr(glyph,a_state)
if a then
local name = names[a]
if name then
local color = m_color[name]
if color then
- glyph[a_colormodel] = model
- glyph[a_color] = color
+ setattr(glyph,a_colormodel,model)
+ setattr(glyph,a_color,color)
end
end
end
@@ -2005,8 +2017,8 @@ registerotffeature { -- adapts
function methods.nocolor(head,font,attr)
for n in traverse_by_id(glyph_code,head) do
- if not font or n.font == font then
- n[a_color] = unsetvalue
+ if not font or getfont(n) == font then
+ setattr(n,a_color,unsetvalue)
end
end
return head, true