summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/typo-rub.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/typo-rub.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/typo-rub.lua42
1 files changed, 24 insertions, 18 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/typo-rub.lua b/Master/texmf-dist/tex/context/base/mkiv/typo-rub.lua
index da63d7b64e9..8c41a561176 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/typo-rub.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/typo-rub.lua
@@ -33,6 +33,8 @@ local v_auto = variables.auto
local nuts = nodes.nuts
+local tonut = nodes.tonut
+local tonode = nodes.tonode
local getid = nuts.getid
local getsubtype = nuts.getsubtype
local getattr = nuts.getattr
@@ -51,9 +53,7 @@ local setwidth = nuts.setwidth
local hpack = nuts.hpack
local insert_after = nuts.insert_after
local takebox = nuts.takebox
-
-local nexthlist = nuts.traversers.hlist
-local nextvlist = nuts.traversers.vlist
+local traverse_id = nuts.traverse_id
local nodecodes = nodes.nodecodes
local glyph_code = nodecodes.glyph
@@ -63,11 +63,14 @@ local glue_code = nodecodes.glue
local penalty_code = nodecodes.penalty
local hlist_code = nodecodes.hlist
local vlist_code = nodecodes.vlist
+local whatsit_code = nodecodes.whatsit
local localpar_code = nodecodes.localpar
-local dir_code = nodecodes.dir
+
+local whatsitcodes = nodes.whatsitcodes
+----- late_luacode = whatsitcodes.latelua
local kerncodes = nodes.kerncodes
-local fontkern_code = kerncodes.font
+local font_code = kerncodes.font
local nodepool = nuts.pool
local new_kern = nodepool.kern
@@ -191,6 +194,7 @@ do
end
function rubies.check(head)
+ local head = tonut(head)
local current = head
local start = nil
local stop = nil
@@ -204,7 +208,7 @@ function rubies.check(head)
setprev(start)
setnext(stop)
local h = hpack(start)
- if start == head then
+ if prev == head then
head = h
else
setlink(prev,h)
@@ -243,21 +247,20 @@ function rubies.check(head)
start = current
stop = current
end
- -- go on
- elseif id == kern_code and getsubtype(current,fontkern_code) then
+ elseif id == kern_code and getsubtype(current,font_code) then
-- go on
elseif found and id == disc_code then
-- go on (todo: look into disc)
elseif found then
- flush("flush 3")
+ flush("flush 4")
found = nil
end
current = nx
end
if found then
- flush("flush 4")
+ flush("flush 5")
end
- return head, true -- no need for true
+ return tonode(head), true
end
local attach
@@ -306,11 +309,11 @@ local function whatever(current)
local c = getprev(current)
while c do
local id = getid(c)
- if id == glue_code or id == penalty_code or id == kern_code then
+ if id == glue_code or id == penalty_code or id == kern_code or (id == whatsit_code and getsubtype(current,localpar_code)) then
-- go on
elseif id == hlist_code and getwidth(c) == 0 then
-- go on
- elseif id == whatsit_code or id == localpar_code or id == dir_code then
+ elseif id == whatsit_code or id == localpar_code then
-- go on
else
l = false
@@ -368,17 +371,20 @@ local function whatever(current)
end
end
-attach = function(head) -- traverse_list
- for current in nexthlist, head do
+attach = function(head)
+ for current in traverse_id(hlist_code,head) do
whatever(current)
end
- for current in nextvlist, head do
+ for current in traverse_id(vlist_code,head) do
whatever(current)
end
- return head
+ return head, true
end
-rubies.attach = attach
+function rubies.attach(head)
+ local h, d = attach(tonut(head))
+ return tonode(h), d
+end
-- for now there is no need to be compact