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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to