On 12/26/2019 1:41 PM, Rik Kabel wrote:

Okay, I have progressed further but have run into something (else) I cannot understand. Consider the following example:

    \definefontfeature   [myserif] [mode=node,kern=yes,xkern=yes]
    \definefontfeature   [mysans]  [mode=node,kern=yes,xkern=no]
    \definefontfeature   [none]    [mode=node]
    \definefontfamily    [mykerns] [serif] [Baskervaldx]    [features=myserif]
    \definefontfamily    [mykerns] [sans]  [Dejavusans]     [features=mysans]
    \definefontfamily    [default] [serif] [Baskervaldx]    [features=default]
    \definefontfamily    [default] [sans]  [Dejavusans]     [features=default]
    \definefontfamily    [nokerns] [serif] [Baskervaldx]    [features=none]
    \definefontfamily    [nokerns] [sans]  [Dejavusans]     [features=none]
    \definefontfamily    [legends] [mono]  [Dejavusansmono] [features=default]

    \startluacode
       fonts.handlers.otf.addfeature {
           name = "kern",
           type = "kern",
           data = {
               ["x"] = { ["x"] = -300 },
               [" "] = { ["A"] = 1000 }
           }
       }
       fonts.handlers.otf.addfeature {
           name = "xkern",
           type = "kern",
           data = {
               ["x"] = { ["x"] = 500 },
               [" "] = { ["J"] = 500 }
           }
       }
    \stopluacode

    \startbuffer[Sample]
       g, Jaxxb AJon
    \stopbuffer

    \define[2]\Test{
       {\switchtobodyfont[#1]#2\getbuffer[Sample]}}

    \setupbodyfont[legends]

    \starttext
    \starttabulate[|l|l|l|]
    \NC test     \NC  Serif                \NC  Sans                 \NC \NR
    \NC nokerns  \NC  \Test{nokerns}{\tf}  \NC  \Test{nokerns}{\ss}  \NC \NR
    \NC default  \NC  \Test{default}{\tf}  \NC  \Test{default}{\ss}  \NC \NR
    \NC mykerns  \NC  \Test{mykerns}{\tf}  \NC  \Test{mykerns}{\ss}  \NC \NR
    \stoptabulate
    \stoptext

It shows, as far as I see, that the kern feature type supports " ", but only when it is named kern. When it is named xkern, as here, it does not support spaces, but does support other characters.
Indeed it's currently bound to 'kern' (mostly for convenience and a little for performance) but it's not that hard to make it a bit more flexible (but not today).

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 via email to