summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2016-01-08 07:15:41 +0100
committerPhilipp Gesang <phg@phi-gamma.net>2016-01-08 07:15:41 +0100
commit8481fc2a3da5571d3817fe7797f9191543e7dcc8 (patch)
tree3451e5f71f5e5df273fa532bfe227dabdad268f9
parent9320186751b6c6a1113f41331716d3b68d73af7a (diff)
downloadluaotfload-8481fc2a3da5571d3817fe7797f9191543e7dcc8.tar.gz
[letterspace] fix wrong construction of node list after spacing ligatures
-rw-r--r--src/luaotfload-letterspace.lua47
1 files changed, 28 insertions, 19 deletions
diff --git a/src/luaotfload-letterspace.lua b/src/luaotfload-letterspace.lua
index 0d6b8e8..e4776c3 100644
--- a/src/luaotfload-letterspace.lua
+++ b/src/luaotfload-letterspace.lua
@@ -40,6 +40,16 @@ local setnext = nodedirect.setnext or field_setter "next"
local getprev = nodedirect.getprev or field_getter "prev"
local setprev = nodedirect.setprev or field_setter "prev"
+--- since r5336
+local getboth = nodedirect.getboth or function (n)
+ return getprev (n), getnext (n)
+end
+
+local setlink = nodedirect.setlink or function (a, b)
+ setnext (a, b)
+ setprev (b, a)
+end
+
local getdisc = nodedirect.getdisc or field_getter "disc"
local setdisc = nodedirect.setdisc or field_setter "disc"
@@ -325,27 +335,26 @@ kerncharacters = function (head)
if c then
if keepligature and keepligature(start) then
-- keep 'm
+ c = nil
else
- --- c = kerncharacters (c) --> taken care of after replacing
- local s = start
- local p = getprev(s)
- local n = getnext(s)
- local tail = find_node_tail(c)
- if p then
- setnext(p, c)
- p = getprev(c)
- else
- head = c
- end
- if n then
- tail = getprev(n)
+ while c do
+ local s = start
+ local p, n = getboth (s)
+ if p then
+ setlink (p, c)
+ else
+ head = c
+ end
+ if n then
+ local tail = find_node_tail(c)
+ setlink (tail, n)
+ end
+ start = c
+ setfield(s, "components", nil)
+ free_node(s)
+ done = true
+ c = getfield (start, "components")
end
- setnext(tail, n)
- start = c
- setfield(s, "components", nil)
- -- we now leak nodes !
- -- free_node(s)
- done = true
end
end -- kern ligature