summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/node-nut.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-05-25 13:21:58 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-05-25 13:21:58 +0200
commit82aed3e7e8af29f359ebef4f93684d20e98107e6 (patch)
tree2b92c44d14566481aad5635f479b1b106d4e2347 /tex/context/base/mkiv/node-nut.lua
parentaceba29d651766f5621b9812d4c40e28029bc4ea (diff)
downloadcontext-82aed3e7e8af29f359ebef4f93684d20e98107e6.tar.gz
2017-05-25 12:56:00
Diffstat (limited to 'tex/context/base/mkiv/node-nut.lua')
-rw-r--r--tex/context/base/mkiv/node-nut.lua54
1 files changed, 50 insertions, 4 deletions
diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua
index b23709ff0..cbaeb8977 100644
--- a/tex/context/base/mkiv/node-nut.lua
+++ b/tex/context/base/mkiv/node-nut.lua
@@ -205,7 +205,9 @@ end
if LUATEXVERSION < 1.005 then
local getfield = direct.getfield
- function direct.getsup(n) return getfield(n,"sup") end
+ function direct.getnucleus(n) return getfield(n,"nucleus") end
+ function direct.getsub (n) return getfield(n,"sub") end
+ function direct.getsup (n) return getfield(n,"sup") end
end
-- if LUATEXVERSION < 1.004 then
@@ -856,8 +858,52 @@ end
-- here:
-nodes.set_synctex_line = node.set_synctex_line
-nodes.set_synctex_tag = node.set_synctex_tag
-
nuts.get_synctex_fields = direct.get_synctex_fields
nuts.set_synctex_fields = direct.set_synctex_fields
+
+-- for now
+
+nodes.uses_font = nodes.uses_font
+nuts.uses_font = direct.uses_font
+
+if not nuts.uses_font then
+
+ local glyph_code = nodecodes.glyph
+ local getdisc = nuts.getdisc
+ local getfont = nuts.getfont
+ local traverse_id = nuts.traverse_id
+ local tonut = nodes.tonut
+
+ function nuts.uses_font(n,font)
+ local pre, post, replace = getdisc(n)
+ if pre then
+ -- traverse_char
+ for n in traverse_id(glyph_code,pre) do
+ if getfont(n) == font then
+ return true
+ end
+ end
+ end
+ if post then
+ for n in traverse_id(glyph_code,post) do
+ if getfont(n) == font then
+ return true
+ end
+ end
+ end
+ if replace then
+ for n in traverse_id(glyph_code,replace) do
+ if getfont(n) == font then
+ return true
+ end
+ end
+ end
+ return false
+ end
+
+ function nodes.uses_font(n,font)
+ return nuts.uses_font(tonut(n),font)
+ end
+
+end
+