Thank you for the prompt solution! The enhancers.patches solution does not work with ConTeXt from TeXlive 2017. I suspect that the font name matching on "^ebgaramond.*" is incorrect, because the patch function is never called (MWE and log attached). If I wanted to do this in ConTeXt I'd use the feature approach but unfortunately the unicode-math package for LaTeX gives no option to set mode=base to have features applied in math mode :/ Cheers, Henri On 02/27/2018 09:34 PM, Hans Hagen wrote:
On 2/26/2018 11:54 PM, Henri Menke wrote:
Dear list,
The EB Garamond font is lacking the ϵ glyph but it contains ε. So naturally you want to remap ϵ to ε. It cannot be done using font features because the the slot 0x03B5 (ϵ) is just missing, so substitution will not kick in. I tried adapting the mechanism to add uppercase greek to Latin Modern Math from lm- math.lfg. Unfortunately, my code is not working. What am I doing wrong?
Cheers, Henri
---
\startluacode local patches = fonts.handlers.otf.enhancers.patches
local function patch(data,filename) local uni_to_ind = data.map.map if not uni_to_ind[0x3F5] then patches.report("add ε for ϵ") uni_to_ind[0x3F5] = uni_to_ind[0x3B5] end end
patches.register("after","missing glyphs","^ebgaramond*", patch) \stopluacode
\setupbodyfont[ebgaramond]
\starttext
ε % = 03B5 ϵ % = 03F5
\stoptext if you want to use the patch mechanism:
\startluacode local function patch(data,filename) data.descriptions[utf.byte("ϵ")] = data.descriptions[utf.byte("ε")] end
fonts.handlers.otf.enhancers.patches.register("after","missing glyphs","^ebgaramond*", patch) \stopluacode
\setupbodyfont[ebgaramond]
\starttext
ϵ ε
\stoptext
or when you want to buse features:
\startluacode fonts.handlers.otf.addfeature { name = "ccmp", -- or "ebhack" type = "substitution", nocheck = true, data = { ["ϵ"] = "ε", } } \stopluacode
% \definefontfeature[default][default][ebhack=yes]
\setupbodyfont[ebgaramond]
\starttext
ϵ ε
\stoptext
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------