summaryrefslogtreecommitdiff
path: root/src/fontloader/misc/fontloader-font-oup.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2017-01-29 21:01:24 +0100
committerGitHub <noreply@github.com>2017-01-29 21:01:24 +0100
commitc6a32f887d4084f0c3bde51fda4a737b51d1eb06 (patch)
treea01850c3a3562d496bda1675c4f7da6453524597 /src/fontloader/misc/fontloader-font-oup.lua
parent98656f9d5ca25aaea2e977b79e09c9bb661f4cef (diff)
parent616b9077567fd670341696cb6ff2bfc71cf691a9 (diff)
downloadluaotfload-c6a32f887d4084f0c3bde51fda4a737b51d1eb06.tar.gz
Merge pull request #395 from phi-gamma/master
v2.8
Diffstat (limited to 'src/fontloader/misc/fontloader-font-oup.lua')
-rw-r--r--src/fontloader/misc/fontloader-font-oup.lua35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/fontloader/misc/fontloader-font-oup.lua b/src/fontloader/misc/fontloader-font-oup.lua
index c494573..cfa90c7 100644
--- a/src/fontloader/misc/fontloader-font-oup.lua
+++ b/src/fontloader/misc/fontloader-font-oup.lua
@@ -29,7 +29,12 @@ local f_index = formatters["I%05X"]
local f_character_y = formatters["%C"]
local f_character_n = formatters["[ %C ]"]
-local doduplicates = true -- can become an option (pseudo feature)
+local check_duplicates = true -- can become an option (pseudo feature) / aways needed anyway
+local check_soft_hyphen = false -- can become an option (pseudo feature) / needed for tagging
+
+directives.register("otf.checksofthyphen",function(v)
+ check_soft_hyphen = v
+end)
local function replaced(list,index,replacement)
if type(list) == "number" then
@@ -106,7 +111,7 @@ local function unifyresources(fontdata,indices)
--
local done = { } -- we need to deal with shared !
--
- local duplicates = doduplicates and resources.duplicates
+ local duplicates = check_duplicates and resources.duplicates
if duplicates and not next(duplicates) then
duplicates = false
end
@@ -359,12 +364,34 @@ local function unifyresources(fontdata,indices)
end
local function copyduplicates(fontdata)
- if doduplicates then
+ if check_duplicates then
local descriptions = fontdata.descriptions
local resources = fontdata.resources
local duplicates = resources.duplicates
+ if check_soft_hyphen then
+ -- ebgaramond has a zero width empty soft hyphen
+ local ds = descriptions[0xAD]
+ if not ds or ds.width == 0 then
+ if ds then
+ descriptions[0xAD] = nil
+ report("patching soft hyphen")
+ else
+ report("adding soft hyphen")
+ end
+ if not duplicates then
+ duplicates = { }
+ resources.duplicates = duplicates
+ end
+ local dh = duplicates[0x2D]
+ if dh then
+ dh[#dh+1] = { [0xAD] = true }
+ else
+ duplicates[0x2D] = { [0xAD] = true }
+ end
+ end
+ end
if duplicates then
- for u, d in next, duplicates do
+ for u, d in next, duplicates do
local du = descriptions[u]
if du then
local t = { f_character_y(u), "@", f_index(du.index), "->" }