ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: disabling specific ligatures
Date: Wed, 22 Mar 2017 12:04:49 +0100	[thread overview]
Message-ID: <c1a473ec-fc20-57a9-6f79-f7ae0443a961@wxs.nl> (raw)
In-Reply-To: <freemail.20170321174422.98825.1@fmxmldata05.freemail.hu>

On 3/21/2017 5:44 PM, Csikos Bela wrote:
> Dear context users:
>
> Is it possible to disable a specific ligature in a whole document in mkiv?
> I would like to disable fi ligature.
> Does it make a difference if I use a true type font installed on my
> system?

normally that is done by setting a language feature in the font

you can also cook up a new feature, like

     fonts.handlers.otf.addfeature {
         name    = "nofiligature1",
         type    = "chainsubstitution",
         nocheck = true,
         prepend = true,
         lookups = {
             {
                 type = "multiple",
                 data = {
                     ["f"] = { "f", 0x200C },
                  -- ["i"] = { "i" },
                 },
             },
         },
         data = {
             rules = {
                 {
                  -- current = { { "f" }, { "i" } },
                  -- lookups = { 1, 1 },
                     current = { { "f" } },
                     after   = { { "i" } },
                     lookups = { 1 },
                 },
             },
         }
     }

     fonts.handlers.otf.addfeature {
         name    = "nofiligature2",
         type    = "chainsubstitution",
         nocheck = true,
         append  = true,
         lookups = {
             {
                 type = "ligature",
                 data = {
                     ["f"] = { "f", 0x200C },
                 },
             },
          -- {
          --     type = "substitution",
          --     data = {
          --         ["i"] = "i"
          --     },
          -- },
         },
         data = {
             rules = {
                 {
                  -- current = { { "f" }, { 0x200C }, { "i" } },
                  -- lookups = { 1, 2 },
                     current = { { "f" }, { 0x200C } },
                     after   = { { "i" } },
                     lookups = { 1 },
                 },
             },
         }
     }

Here the two step approach is needed to make sure you get proper kerning 
(given that a font has it, e.g pagella has between fe but not between 
ffe so ...).

Anyway, I've added a helper to the upcoming so that it's a bit easier:

\blockligatures[fi,ff]
\blockligatures[fl]

\definefontfeature
   [default]
   [default]
   [blockligatures=yes]

\setupbodyfont[pagella]

The only thing you need to keep in mind is that the \blockligature 
commands have to come before fonts get defined (has to do with shared 
resources and optimizations and such) and of course that you need to
enable the feature.

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
___________________________________________________________________________________

  reply	other threads:[~2017-03-22 11:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21 16:44 Csikos Bela
2017-03-22 11:04 ` Hans Hagen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-09-18  0:02 Disabling " Aditya Mahajan
2011-09-18  0:50 ` Khaled Hosny
2011-09-18  1:13   ` Aditya Mahajan
2011-09-18  7:44     ` Wolfgang Schuster
2011-09-19 14:30       ` Aditya Mahajan

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=c1a473ec-fc20-57a9-6f79-f7ae0443a961@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.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).