summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/typo-dig.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/typo-dig.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/typo-dig.lua20
1 files changed, 13 insertions, 7 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/typo-dig.lua b/Master/texmf-dist/tex/context/base/mkiv/typo-dig.lua
index 175fc0cc7ef..61e96c6b6a2 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/typo-dig.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/typo-dig.lua
@@ -20,12 +20,15 @@ local report_digits = logs.reporter("typesetting","digits")
local nodes, node = nodes, node
local nuts = nodes.nuts
+local tonut = nuts.tonut
+local tonode = nuts.tonode
local getnext = nuts.getnext
local getprev = nuts.getprev
+local getfont = nuts.getfont
+local getchar = nuts.getchar
local getid = nuts.getid
local getwidth = nuts.getwidth
-local isglyph = nuts.isglyph
local takeattr = nuts.takeattr
local setlink = nuts.setlink
@@ -96,7 +99,8 @@ function nodes.aligned(head,start,stop,width,how)
end
actions[1] = function(head,start,attr)
- local char, font = isglyph(start)
+ local font = getfont(start)
+ local char = getchar(start)
local unic = chardata[font][char].unicode or char
if charbase[unic].category == "nd" then -- ignore unic tables
local oldwidth = getwidth(start)
@@ -107,21 +111,23 @@ actions[1] = function(head,start,attr)
attr%100,div(attr,100),char,unic,newwidth-oldwidth)
end
head, start = nodes.aligned(head,start,start,newwidth,"middle")
- return head, start
+ return head, start, true
end
end
- return head, start
+ return head, start, false
end
function digits.handler(head)
- local current = head
+ head = tonut(head)
+ local done, current, ok = false, head, false
while current do
if getid(current) == glyph_code then
local attr = takeattr(current,a_digits)
if attr and attr > 0 then
local action = actions[attr%100] -- map back to low number
if action then
- head, current = action(head,current,attr)
+ head, current, ok = action(head,current,attr)
+ done = done and ok
elseif trace_digits then
report_digits("unknown digit trigger %a",attr)
end
@@ -131,7 +137,7 @@ function digits.handler(head)
current = getnext(current)
end
end
- return head
+ return tonode(head), done
end
local m, enabled = 0, false -- a trick to make neighbouring ranges work