summaryrefslogtreecommitdiff
path: root/tex/context/base/font-otn.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/font-otn.lua')
-rw-r--r--tex/context/base/font-otn.lua35
1 files changed, 26 insertions, 9 deletions
diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua
index 0d11d3a8b..babf8b0d5 100644
--- a/tex/context/base/font-otn.lua
+++ b/tex/context/base/font-otn.lua
@@ -165,6 +165,7 @@ local copy_node = node.copy
local find_node_tail = node.tail or node.slide
local set_attribute = node.set_attribute
local has_attribute = node.has_attribute
+local flush_node_list = node.flush_list
local setmetatableindex = table.setmetatableindex
@@ -318,21 +319,35 @@ end
local function toligature(kind,lookupname,start,stop,char,markflag,discfound) -- brr head
if start == stop then
start.char = char
+ return start
elseif discfound then
-- print("start->stop",nodes.tosequence(start,stop))
+ local components = start.components
+ if components then
+ flush_node_list(components)
+ start.components = nil
+ end
local lignode = copy_node(start)
- lignode.font, lignode.char, lignode.subtype = start.font, char, ligature_code
- local next, prev = stop.next, start.prev
+ lignode.font = start.font
+ lignode.char = char
+ lignode.subtype = ligature_code
+ local next = stop.next
+ local prev = start.prev
stop.next = nil
- lignode = node.do_ligature_n(start, stop, lignode)
+ start.prev = nil
+ lignode.components = start
+ -- print("lignode",nodes.tosequence(lignode))
+ -- print("components",nodes.tosequence(lignode.components))
prev.next = lignode
if next then
next.prev = lignode
end
- lignode.next, lignode.prev = next, prev
- start = lignode
+ lignode.next = next
+ lignode.prev = prev
-- print("start->end",nodes.tosequence(start))
- else -- start is the ligature
+ return lignode
+ else
+ -- start is the ligature
local deletemarks = markflag ~= "mark"
local n = copy_node(start)
local current
@@ -342,8 +357,11 @@ local function toligature(kind,lookupname,start,stop,char,markflag,discfound) --
if snext then
snext.prev = current
end
- start.prev, stop.next = nil, nil
- current.char, current.subtype, current.components = char, ligature_code, start
+ start.prev = nil
+ stop.next = nil
+ current.char = char
+ current.subtype = ligature_code
+ current.components = start
local head = current
if deletemarks then
if trace_marks then
@@ -383,7 +401,6 @@ local function toligature(kind,lookupname,start,stop,char,markflag,discfound) --
end
return head
end
- return start
end
function handlers.gsub_single(start,kind,lookupname,replacement)