diff options
Diffstat (limited to 'tex/context/base/mkiv/font-oup.lua')
-rw-r--r-- | tex/context/base/mkiv/font-oup.lua | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua index c4945734f..cfa90c794 100644 --- a/tex/context/base/mkiv/font-oup.lua +++ b/tex/context/base/mkiv/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), "->" } |