Skip to content

Commit

Permalink
Partial fix for #127
Browse files Browse the repository at this point in the history
This works for fonts which classify marks in the GDEF table.
  • Loading branch information
zauguin committed Dec 23, 2019
1 parent 9a8f2f3 commit 6705174
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/luaotfload-letterspace.lua
Expand Up @@ -82,6 +82,7 @@ local fonthashes = fonts.hashes
local identifiers = fonthashes.identifiers
local chardata = fonthashes.characters
local otffeatures = fonts.constructors.newfeatures "otf"
local markdata

local function getprevreal(n)
repeat
Expand Down Expand Up @@ -144,6 +145,21 @@ if not chardata then
fonthashes.characters = chardata
end
if not markdata then
markdata = setmetatable({}, {__index = function(t, k)
if k == true then
return t[currentfont()]
else
local tfmdata = font.getfont(k) or font.fonts[k]
if tfmdata then
local marks = tfmdata.resources.marks or {}
t[k] = marks
return marks
end
end
end})
end
---=================================================================---
--- character kerning functionality
---=================================================================---
Expand Down Expand Up @@ -334,7 +350,7 @@ kerncharacters = function (head)
local kern = 0
local kerns = prevchardata.kerns
if kerns then kern = kerns[lastchar] or kern end
krn = kern + krn -- here
krn = kern + (markdata[lastfont][lastchar] and 0 or krn) -- here
insert_node_before(head,start,kern_injector(fillup,krn))
end
end
Expand Down Expand Up @@ -409,7 +425,7 @@ kerncharacters = function (head)
if kerns then kern = kerns[lastchar] or kern end
end
end
krn = kern + krn -- here
krn = kern + (markdata[lastfont][lastchar] and 0 or krn) -- here
end
setfield(disc, "replace", kern_injector(false, krn))
end --[[if replace and prv and nxt]]
Expand Down

0 comments on commit 6705174

Please sign in to comment.