summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-letterspace.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-02-25 22:14:10 +0000
committerKarl Berry <karl@freefriends.org>2022-02-25 22:14:10 +0000
commit75eb24771faf3783171e71e4f9e84ccdf553cc2a (patch)
treebc220b6b4acbe2809ae3a92c666b31dd5fe10cb5 /Master/texmf-dist/tex/luatex/luaotfload/luaotfload-letterspace.lua
parent7c39846d9014b0d4ae35263f0fcb7e58e0bfbba8 (diff)
luaotfload (25feb22)
git-svn-id: svn://tug.org/texlive/trunk@62175 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/luaotfload-letterspace.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luaotfload/luaotfload-letterspace.lua26
1 files changed, 22 insertions, 4 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-letterspace.lua b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-letterspace.lua
index 7963a839b9b..2e69cb92a6b 100644
--- a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-letterspace.lua
+++ b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-letterspace.lua
@@ -5,8 +5,8 @@
assert(luaotfload_module, "This is a part of luaotfload and should not be loaded independently") {
name = "luaotfload-letterspace",
- version = "3.18", --TAGVERSION
- date = "2021-05-21", --TAGDATE
+ version = "3.19", --TAGVERSION
+ date = "2022-02-24", --TAGDATE
description = "luaotfload submodule / letterspacing",
license = "GPL v2.0",
copyright = "PRAGMA ADE / ConTeXt Development Team",
@@ -70,7 +70,7 @@ local todirect = nodedirect.todirect
local tonode = nodedirect.tonode
local insert_node_before = nodedirect.insert_before
-local free_node = nodedirect.free
+local real_free_node = nodedirect.free
local copy_node = nodedirect.copy
local new_node = nodedirect.new
@@ -86,9 +86,25 @@ local chardata = fonthashes.characters
local otffeatures = fonts.constructors.newfeatures "otf"
local markdata
+-- For every attribute list cached in attribute_table, we have to make
+-- sure that it doesn't get deleted. Therefore attribute_cleanup maps
+-- from a node which has the attribute_list referenced in
+-- attribute_table to the key from attribute_table.
+-- Whenever a node which has an entry in attribute_cleanup is deleted,
+-- we delete the corresponding entry from attribute_table since we can
+-- no longer guarantee that it's references somewhere.
local attribute_table = {}
+local attribute_cleanup = {}
local attr = luatexbase.new_attribute("luaotfload.letterspace_done")
+local function free_node(n)
+ local k = attribute_cleanup[n]
+ if k then
+ attribute_cleanup[n], attribute_table[k] = nil
+ end
+ return real_free_node(n)
+end
+
local function getprevreal(n)
repeat
n = getprev(n)
@@ -445,6 +461,7 @@ kerncharacters = function (head)
setattributelist(start, new_attr_list)
else
setattribute(start, attr, 1)
+ attribute_cleanup[start] = attr_list
attribute_table[attr_list] = getattributelist(start)
end
end --[[if prev]]
@@ -500,7 +517,8 @@ local function enablefontkerning ( )
"kerncharacters() failed to return a valid new head")
end
- for k in next, attribute_table do attribute_table[k] = nil end
+ for k, v in next, attribute_cleanup do attribute_cleanup[k], attribute_table[v] = nil end
+ assert(not next(attribute_table))
return tonode (direct_hd)
end