[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: No need to cache here (5577126)
Marcel Fabian Krüger
tex at 2krueger.de
Fri Apr 3 11:36:12 CEST 2020
Repository : https://github.com/latex3/luaotfload
On branch : dev
Link : https://github.com/latex3/luaotfload/commit/5577126da18d4c4cd8926c197f4cea255340a7dc
>---------------------------------------------------------------
commit 5577126da18d4c4cd8926c197f4cea255340a7dc
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date: Fri Apr 3 10:24:21 2020 +0200
No need to cache here
Also avoids leaking some nodes. We have to create new copies anyway.
>---------------------------------------------------------------
5577126da18d4c4cd8926c197f4cea255340a7dc
src/luaotfload-notdef.lua | 14 ++++----------
testfiles-harf/fallback.tlg | 2 +-
testfiles-harf/multiscript-auto.tlg | 2 +-
3 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/src/luaotfload-notdef.lua b/src/luaotfload-notdef.lua
index 5c724cf..2775f1f 100644
--- a/src/luaotfload-notdef.lua
+++ b/src/luaotfload-notdef.lua
@@ -164,13 +164,6 @@ otfregister {
}
}
-local cached_kern = setmetatable({}, {__index = function(t, i)
- local n = nodenew(kern_id)
- setkern(n, i)
- setattributelist(n, nil)
- t[i] = n
- return n
-end})
local font_invisible_replacement = setmetatable({}, {__index = function(t, fid)
local fontdata = font.getfont(fid)
local replacement = fontdata.shared.features.invisible
@@ -181,7 +174,7 @@ local font_invisible_replacement = setmetatable({}, {__index = function(t, fid)
replacement = tonumber(replacement) or 32
local char = fontdata.characters[replacement]
if char then
- t[fid] = {replacement, cached_kern[-char.width]}
+ t[fid] = {replacement, -char.width}
return t[fid]
else
t[fid] = false
@@ -209,9 +202,10 @@ local function ignorablehandler(head, fid, ...) -- FIXME: The arguments are prob
if replacement then
setchar(n, replacement)
if font_kern then
- local k = nodecopy(font_kern)
+ local k = nodenew(kern_id)
+ setkern(k, font_kern)
setattributelist(k, getattributelist(n))
- head = insert_after(head, n, nodecopy(font_kern))
+ head = insert_after(head, n, k)
end
else
local after
diff --git a/testfiles-harf/fallback.tlg b/testfiles-harf/fallback.tlg
index 1cac6e6..20dbd6d 100644
--- a/testfiles-harf/fallback.tlg
+++ b/testfiles-harf/fallback.tlg
@@ -71,4 +71,4 @@ Completed box being shipped out [1]
...\glue 0.0 plus 1.0fil
...\TU/lmr/m/n/10 "1" 0031 +0:+0^^I[lmroman10-regular]:+tlig;
...\glue 0.0 plus 1.0fil
-2 hlist, 1 rule, 1 dir, 5 kern, 1 glyph, 2 attribute, 48 glue_spec, 2 attribute_list (fallback.aux)
+2 hlist, 1 rule, 1 dir, 3 kern, 1 glyph, 2 attribute, 48 glue_spec, 2 attribute_list (fallback.aux)
diff --git a/testfiles-harf/multiscript-auto.tlg b/testfiles-harf/multiscript-auto.tlg
index 8f42d3d..3f281a9 100644
--- a/testfiles-harf/multiscript-auto.tlg
+++ b/testfiles-harf/multiscript-auto.tlg
@@ -97,4 +97,4 @@ Completed box being shipped out [1]
...\glue 0.0 plus 1.0fil
...\TU/lmr/m/n/10 "1" 0031 +0:+0
...\glue 0.0 plus 1.0fil
-2 hlist, 1 rule, 1 dir, 4 kern, 1 glyph, 2 attribute, 48 glue_spec, 2 attribute_list (multiscript-auto.aux)
+2 hlist, 1 rule, 1 dir, 3 kern, 1 glyph, 2 attribute, 48 glue_spec, 2 attribute_list (multiscript-auto.aux)
More information about the latex3-commits
mailing list.