From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@xs4all.nl>
Subject: Re: Contextual removal of some ligatures using fonts.handlers.otf.addfeature (LuaTeX 1.13.2)
Date: Sat, 25 Dec 2021 12:35:37 +0100 [thread overview]
Message-ID: <1bf08fb8-032c-a345-c962-43d640d2f19b@xs4all.nl> (raw)
In-Reply-To: <3AD2C1F1-EAAA-48F6-94FE-45493BD0CF6A@scorecrow.com>
On 12/25/2021 12:04 AM, Bruce Horrocks via ntg-context wrote:
>
>
>> 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 }
> }
> }
> }
> }
A better an dmore reliable approach is this:
\startluacode
local demo = {
name = "demo",
options = {
{
patterns = {
fio = "f|io",
},
words = [[ fioot fiots ]],
},
},
}
table.save("oeps-fixes.llg",demo)
\stopluacode
\setuplanguage[en][goodies={oeps-fixes.llg}]
\setupbodyfont[ebgaramond]
\starttext
fiets fiots fiats fioot
\stoptext
because you want to block certain ligatures but keep kerning etc (see
older posts for more extensive examples)
Hans
-----------------------------------------------------------------
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
___________________________________________________________________________________
next prev parent reply other threads:[~2021-12-25 11:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-24 18:34 Thomas Savary via ntg-context
2021-12-24 23:04 ` Bruce Horrocks via ntg-context
2021-12-25 11:00 ` Hans Hagen via ntg-context
2021-12-25 11:35 ` Hans Hagen via ntg-context [this message]
2021-12-25 22:52 ` Thomas Savary via ntg-context
2021-12-26 12:52 ` Hans Hagen via ntg-context
2021-12-27 20:27 ` Thomas Savary via ntg-context
2021-12-27 23:01 ` (No subject header) Hans Hagen via ntg-context
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1bf08fb8-032c-a345-c962-43d640d2f19b@xs4all.nl \
--to=ntg-context@ntg.nl \
--cc=j.hagen@xs4all.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).