diff options
author | Karl Berry <karl@freefriends.org> | 2021-05-21 21:05:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-05-21 21:05:05 +0000 |
commit | 18c4b51ca1b98fb507d18afb9dbf02c3f0dd4baf (patch) | |
tree | 40df74fcad10980ff11a5c7a5dd2227af9ff7e2d /Master/texmf-dist/tex/luatex/luaotfload/luaotfload-letterspace.lua | |
parent | b1faafa7a3280da5554864dc3b75351f780b7c74 (diff) |
luaotfload (21may21)
git-svn-id: svn://tug.org/texlive/trunk@59293 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.lua | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-letterspace.lua b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-letterspace.lua index bbdaa729e2a..7963a839b9b 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.17", --TAGVERSION - date = "2021-01-08", --TAGDATE + version = "3.18", --TAGVERSION + date = "2021-05-21", --TAGDATE description = "luaotfload submodule / letterspacing", license = "GPL v2.0", copyright = "PRAGMA ADE / ConTeXt Development Team", @@ -59,6 +59,12 @@ local setkern = nodedirect.setkern local getglue = nodedirect.getglue local setglue = nodedirect.setglue +local hasattribute = nodedirect.has_attribute +local setattribute = nodedirect.set_attribute + +local getattributelist = nodedirect.getattributelist +local setattributelist = nodedirect.setattributelist + local find_node_tail = nodedirect.tail local todirect = nodedirect.todirect local tonode = nodedirect.tonode @@ -80,6 +86,9 @@ local chardata = fonthashes.characters local otffeatures = fonts.constructors.newfeatures "otf" local markdata +local attribute_table = {} +local attr = luatexbase.new_attribute("luaotfload.letterspace_done") + local function getprevreal(n) repeat n = getprev(n) @@ -243,6 +252,10 @@ kerncharacters = function (head) local id = getid(start) if id == glyph_code then --- 1) look up kern factor (slow, but cached rudimentarily) + if hasattribute(start, attr, 1) then -- We already kerned this node + firstkern = false -- TODO: I'm not sure about this one yet + goto nextnode + end local fontid = getfont(start) local krn, fillup = unpack(kernamounts[fontid]) if not krn or krn == 0 then @@ -426,6 +439,14 @@ kerncharacters = function (head) setfield(disc, "replace", kern_injector(false, krn)) end --[[if replace and prv and nxt]] end --[[if not pid]] + local attr_list = getattributelist(start) + local new_attr_list = attribute_table[attr_list] + if new_attr_list then + setattributelist(start, new_attr_list) + else + setattribute(start, attr, 1) + attribute_table[attr_list] = getattributelist(start) + end end --[[if prev]] end --[[if id == glyph_code]] @@ -478,6 +499,9 @@ local function enablefontkerning ( ) logreport ("both", 0, "letterspace", "kerncharacters() failed to return a valid new head") end + + for k in next, attribute_table do attribute_table[k] = nil end + return tonode (direct_hd) end |