Hi Bruce and Hans !
Thank you very much for your answers, that helped me a lot.
In fact, though I would love to switch to ConTeXt one day, I am still using LuaLaTeX — I am a slow learner and I know it will take me months to be able to achieve what I need for my job with ConTeXt and can do with LuaLaTeX and the Memoir class for the time being (despite sometimes being irritated by LaTeX limitations or oddities).
I need the EB Garamond variable font for future jobs, but this font, provided by Google Fonts, is such a mess : kerning problems, unusable OpenType features that have to be rewritten from scratch, shifts in glyphs table… For sure, the original font by Georg Duffner was much better, but I need the variable version. Lots of fixing necessary, but thanks to fonts.handlers.otf.addfeature I have almost succeeded to make it a usable Garamond.
Of course, it would be best to help Google improving this font, but I don’t have time yet.
The actual problem was with the italic ligatures "a_s", "e_s", "é_s", "i_s" and "u_s", that should occur only at the end of words and not everywhere. Instead of removing the unwanted ligatures, I chose another way as soon as I understood how to fully use “current” to describe not only a single glyph, but a string if necessary — for instance, current={ { "a", "e", "eacute", "i", "u"}, {"s"} }
Thanks for this wonderful tool !
Thomas Savary
1 le Grand-Plessis
F-85340 L’Île-d’Olonne
Tél. 06 22 82 61 34
https://compo85.fr/
Le samedi 25 décembre 2021, 00:04:51 CET Bruce Horrocks a écrit :
> > On 24 Dec 2021, at 18:34, Thomas Savary via ntg-context
> > <ntg-context@ntg.nl> wrote:
> >
> > Hello, dear list !
> >
> > In order to fix a few bugs in some OpenType features included in EB
> > Garamond font provided by Google Fonts, I am trying to remove some
> > ligatures (erroneous in some contexts) with
> > fonts.handlers.otf.addfeature.
> >
> > I must be missing something, because I can't get it to work.
> >
> > Here is a minimal —non working—example :-)
> > (The attempted removal (“f_i” → “fi” only before “o”) is of course
> > irrelevant. I chose it just for the sole purpose of this test, to
> > provide a simple example. What I am trying to achieve is more
> > complex, with other ligatures.)
> >
> > fonts.handlers.otf.addfeature{
> >
> > name = "unfio",
> > type = "chainsubstitution",
> > lookups = {
> >
> > { type = "multiple",
> > data = { [ "f_i" ] = { "f", "i" } }
> > }
> >
> > }
> > rules = {
> >
> > { after = { { "o" } },
> > current = { { "f_i" } },
> > lookups = { 1 } }
> >
> > }
> >
> > }
> >
> > }
> >
> > Could someone please explain to me what I did wrong ?
>
> Firstly, you have an extra } in the example above.
>
> Secondly, rules need to come inside a data section. Thus (untested):
>
> fonts.handlers.otf.addfeature{
> name = "unfio",
> type = "chainsubstitution",
> lookups = {
> {
> type = "substitution",
> data = {
> [ "f_i" ] = { "f", "i" }
> }
> }
> },
> data = {
> rules = {
> {
> after = { { "o" } },
> current = { { "f_i" } },
> lookups = { 1 }
> }
> }
> }
> }
>
> Regards,
> —
> Bruce Horrocks
> Hampshire, UK
Thomas Savary
1 le Grand-Plessis
F-85340 L’Île-d’Olonne
Tél. 06 22 82 61 34
https://compo85.fr/
Le samedi 25 décembre 2021, 00:04:51 CET Bruce Horrocks a écrit :
> > On 24 Dec 2021, at 18:34, Thomas Savary via ntg-context
> > <ntg-context@ntg.nl> wrote:
> >
> > Hello, dear list !
> >
> > In order to fix a few bugs in some OpenType features included in EB
> > Garamond font provided by Google Fonts, I am trying to remove some
> > ligatures (erroneous in some contexts) with
> > fonts.handlers.otf.addfeature.
> >
> > I must be missing something, because I can't get it to work.
> >
> > Here is a minimal —non working—example :-)
> > (The attempted removal (“f_i” → “fi” only before “o”) is of course
> > irrelevant. I chose it just for the sole purpose of this test, to
> > provide a simple example. What I am trying to achieve is more
> > complex, with other ligatures.)
> >
> > fonts.handlers.otf.addfeature{
> >
> > name = "unfio",
> > type = "chainsubstitution",
> > lookups = {
> >
> > { type = "multiple",
> > data = { [ "f_i" ] = { "f", "i" } }
> > }
> >
> > }
> > rules = {
> >
> > { after = { { "o" } },
> > current = { { "f_i" } },
> > lookups = { 1 } }
> >
> > }
> >
> > }
> >
> > }
> >
> > Could someone please explain to me what I did wrong ?
>
> Firstly, you have an extra } in the example above.
>
> Secondly, rules need to come inside a data section. Thus (untested):
>
> fonts.handlers.otf.addfeature{
> name = "unfio",
> type = "chainsubstitution",
> lookups = {
> {
> type = "substitution",
> data = {
> [ "f_i" ] = { "f", "i" }
> }
> }
> },
> data = {
> rules = {
> {
> after = { { "o" } },
> current = { { "f_i" } },
> lookups = { 1 }
> }
> }
> }
> }
>
> Regards,
> —
> Bruce Horrocks
> Hampshire, UK