ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Adjust kern for one character
@ 2019-12-22 21:19 Rik Kabel
  2019-12-22 21:28 ` Henri Menke
  2019-12-22 22:40 ` mf
  0 siblings, 2 replies; 12+ messages in thread
From: Rik Kabel @ 2019-12-22 21:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

List,

Is there a way in ConTeXt to adjust the left-side kern for one 
character? The cap J in the font I am using is being set too close to 
the preceding characters and I would rather not insert a thinspace 
before each. (Inserting a thinspace is sufficient, but finer control is 
welcome.)

-- 
Rik

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Adjust kern for one character
  2019-12-22 21:19 Adjust kern for one character Rik Kabel
@ 2019-12-22 21:28 ` Henri Menke
  2019-12-23  9:13   ` Mojca Miklavec
  2019-12-22 22:40 ` mf
  1 sibling, 1 reply; 12+ messages in thread
From: Henri Menke @ 2019-12-22 21:28 UTC (permalink / raw)
  To: ntg-context

On 12/23/19 10:19 AM, Rik Kabel wrote:
> List,
> 
> Is there a way in ConTeXt to adjust the left-side kern for one 
> character?

No, kerns always come in pairs.

> The cap J in the font I am using is being set too close to
> the preceding characters and I would rather not insert a thinspace 
> before each. (Inserting a thinspace is sufficient, but finer control
> is welcome.)
> 
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Adjust kern for one character
  2019-12-22 21:19 Adjust kern for one character Rik Kabel
  2019-12-22 21:28 ` Henri Menke
@ 2019-12-22 22:40 ` mf
  2019-12-23  1:30   ` Rik Kabel
  1 sibling, 1 reply; 12+ messages in thread
From: mf @ 2019-12-22 22:40 UTC (permalink / raw)
  To: ntg-context

Il 22/12/19 22:19, Rik Kabel ha scritto:
> List,
> 
> Is there a way in ConTeXt to adjust the left-side kern for one 
> character? The cap J in the font I am using is being set too close to 
> the preceding characters and I would rather not insert a thinspace 
> before each. (Inserting a thinspace is sufficient, but finer control is 
> welcome.)
> 
\definecharacterspacing[distantJ]
\setupcharacterspacing[distantJ]["004A][left=.15,alternative=1] % 004A 
is the unicode hex index of letter J
\starttext
   normal: AJB\par
   \setcharacterspacing[distantJ] more space on the left: AJB\par
   \resetcharacterspacing normal again: AJB\par
\stoptext
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Adjust kern for one character
  2019-12-22 22:40 ` mf
@ 2019-12-23  1:30   ` Rik Kabel
  2019-12-23  2:33     ` Henri Menke
  0 siblings, 1 reply; 12+ messages in thread
From: Rik Kabel @ 2019-12-23  1:30 UTC (permalink / raw)
  To: ntg-context


On 12/22/2019 17:40, mf wrote:
> Il 22/12/19 22:19, Rik Kabel ha scritto:
>> List,
>>
>> Is there a way in ConTeXt to adjust the left-side kern for one 
>> character? The cap J in the font I am using is being set too close to 
>> the preceding characters and I would rather not insert a thinspace 
>> before each. (Inserting a thinspace is sufficient, but finer control 
>> is welcome.)
>>
> \definecharacterspacing[distantJ]
> \setupcharacterspacing[distantJ]["004A][left=.15,alternative=1] % 004A 
> is the unicode hex index of letter J
> \starttext
>   normal: AJB\par
>   \setcharacterspacing[distantJ] more space on the left: AJB\par
>   \resetcharacterspacing normal again: AJB\par
> \stoptext
>
Thank you for that, Massi.

Unfortunately, that is too blunt an instrument in this case -- in 
addition to the body font where the problem exists, it works on the 
heading and titling font, which does not share the problem.

As Henri's answer hints, I was a bit unclear in my request. It is a kern 
between a word space and the cap J that is the issue. Perhaps a font 
feature file is the place to do such a thing.

-- 
Rik

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Adjust kern for one character
  2019-12-23  1:30   ` Rik Kabel
@ 2019-12-23  2:33     ` Henri Menke
  2019-12-23  2:34       ` Henri Menke
  0 siblings, 1 reply; 12+ messages in thread
From: Henri Menke @ 2019-12-23  2:33 UTC (permalink / raw)
  To: ntg-context

On 12/23/19 2:30 PM, Rik Kabel wrote:
> 
> On 12/22/2019 17:40, mf wrote:
>> Il 22/12/19 22:19, Rik Kabel ha scritto:
>>> List,
>>>
>>> Is there a way in ConTeXt to adjust the left-side kern for one
>>> character? The cap J in the font I am using is being set too close to
>>> the preceding characters and I would rather not insert a thinspace
>>> before each. (Inserting a thinspace is sufficient, but finer control
>>> is welcome.)
>>>
>> \definecharacterspacing[distantJ]
>> \setupcharacterspacing[distantJ]["004A][left=.15,alternative=1] % 004A
>> is the unicode hex index of letter J
>> \starttext
>>    normal: AJB\par
>>    \setcharacterspacing[distantJ] more space on the left: AJB\par
>>    \resetcharacterspacing normal again: AJB\par
>> \stoptext
>>
> Thank you for that, Massi.
> 
> Unfortunately, that is too blunt an instrument in this case -- in
> addition to the body font where the problem exists, it works on the
> heading and titling font, which does not share the problem.
> 
> As Henri's answer hints, I was a bit unclear in my request. It is a kern
> between a word space and the cap J that is the issue. Perhaps a font
> feature file is the place to do such a thing.

\startluacode
fonts.handlers.otf.addfeature {
     name = "kern",
     type = "kern",
     data = {
         [" "] = {
             ["J"] = 1000 % exaggerated value
         }
     }
}
\stopluacode

\setupbodyfont[modern] % have to reload the font

\starttext

No Jokes!

\stoptext
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Adjust kern for one character
  2019-12-23  2:33     ` Henri Menke
@ 2019-12-23  2:34       ` Henri Menke
  2019-12-23 23:45         ` Rik Kabel
  0 siblings, 1 reply; 12+ messages in thread
From: Henri Menke @ 2019-12-23  2:34 UTC (permalink / raw)
  To: ntg-context



On 12/23/19 3:33 PM, Henri Menke wrote:
> On 12/23/19 2:30 PM, Rik Kabel wrote:
>>
>> On 12/22/2019 17:40, mf wrote:
>>> Il 22/12/19 22:19, Rik Kabel ha scritto:
>>>> List,
>>>>
>>>> Is there a way in ConTeXt to adjust the left-side kern for one
>>>> character? The cap J in the font I am using is being set too close to
>>>> the preceding characters and I would rather not insert a thinspace
>>>> before each. (Inserting a thinspace is sufficient, but finer control
>>>> is welcome.)
>>>>
>>> \definecharacterspacing[distantJ]
>>> \setupcharacterspacing[distantJ]["004A][left=.15,alternative=1] % 004A
>>> is the unicode hex index of letter J
>>> \starttext
>>>     normal: AJB\par
>>>     \setcharacterspacing[distantJ] more space on the left: AJB\par
>>>     \resetcharacterspacing normal again: AJB\par
>>> \stoptext
>>>
>> Thank you for that, Massi.
>>
>> Unfortunately, that is too blunt an instrument in this case -- in
>> addition to the body font where the problem exists, it works on the
>> heading and titling font, which does not share the problem.
>>
>> As Henri's answer hints, I was a bit unclear in my request. It is a kern
>> between a word space and the cap J that is the issue. Perhaps a font
>> feature file is the place to do such a thing.
> 
> \startluacode
> fonts.handlers.otf.addfeature {
>       name = "kern",
>       type = "kern",
>       data = {
>           [" "] = {
>               ["J"] = 1000 % exaggerated value

Should of course be a Lua comment

             ["J"] = 1000 -- exaggerated value

>           }
>       }
> }
> \stopluacode
> 
> \setupbodyfont[modern] % have to reload the font
> 
> \starttext
> 
> No Jokes!
> 
> \stoptext
> 
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Adjust kern for one character
  2019-12-22 21:28 ` Henri Menke
@ 2019-12-23  9:13   ` Mojca Miklavec
  2019-12-23  9:31     ` Hans Hagen
  0 siblings, 1 reply; 12+ messages in thread
From: Mojca Miklavec @ 2019-12-23  9:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, 22 Dec 2019 at 22:28, Henri Menke wrote:
> On 12/23/19 10:19 AM, Rik Kabel wrote:
> > List,
> >
> > Is there a way in ConTeXt to adjust the left-side kern for one
> > character?
>
> No, kerns always come in pairs.

Bounding boxes come per-character, though ;)
I'm not familiar with details, but I would guess that it might be
possible to change the bounding box of a character on the fly.

Mojca
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Adjust kern for one character
  2019-12-23  9:13   ` Mojca Miklavec
@ 2019-12-23  9:31     ` Hans Hagen
  0 siblings, 0 replies; 12+ messages in thread
From: Hans Hagen @ 2019-12-23  9:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Mojca Miklavec

On 12/23/2019 10:13 AM, Mojca Miklavec wrote:
> On Sun, 22 Dec 2019 at 22:28, Henri Menke wrote:
>> On 12/23/19 10:19 AM, Rik Kabel wrote:
>>> List,
>>>
>>> Is there a way in ConTeXt to adjust the left-side kern for one
>>> character?
>>
>> No, kerns always come in pairs.
> 
> Bounding boxes come per-character, though ;)
> I'm not familiar with details, but I would guess that it might be
> possible to change the bounding box of a character on the fly.
you can tweak the width when you load, boundingboxes can only be used 
for height and depth guessing (fonts provide width information)

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Adjust kern for one character
  2019-12-23  2:34       ` Henri Menke
@ 2019-12-23 23:45         ` Rik Kabel
  2019-12-26 12:41           ` Rik Kabel
  0 siblings, 1 reply; 12+ messages in thread
From: Rik Kabel @ 2019-12-23 23:45 UTC (permalink / raw)
  To: ntg-context


On 12/22/2019 21:34, Henri Menke wrote:
>
>
> On 12/23/19 3:33 PM, Henri Menke wrote:
>> On 12/23/19 2:30 PM, Rik Kabel wrote:
>>>
>>> On 12/22/2019 17:40, mf wrote:
>>>> Il 22/12/19 22:19, Rik Kabel ha scritto:
>>>>> List,
>>>>>
>>>>> Is there a way in ConTeXt to adjust the left-side kern for one
>>>>> character? The cap J in the font I am using is being set too close to
>>>>> the preceding characters and I would rather not insert a thinspace
>>>>> before each. (Inserting a thinspace is sufficient, but finer control
>>>>> is welcome.)
>>>>>
>>>> \definecharacterspacing[distantJ]
>>>> \setupcharacterspacing[distantJ]["004A][left=.15,alternative=1] % 004A
>>>> is the unicode hex index of letter J
>>>> \starttext
>>>>     normal: AJB\par
>>>>     \setcharacterspacing[distantJ] more space on the left: AJB\par
>>>>     \resetcharacterspacing normal again: AJB\par
>>>> \stoptext
>>>>
>>> Thank you for that, Massi.
>>>
>>> Unfortunately, that is too blunt an instrument in this case -- in
>>> addition to the body font where the problem exists, it works on the
>>> heading and titling font, which does not share the problem.
>>>
>>> As Henri's answer hints, I was a bit unclear in my request. It is a 
>>> kern
>>> between a word space and the cap J that is the issue. Perhaps a font
>>> feature file is the place to do such a thing.
>>
>> \startluacode
>> fonts.handlers.otf.addfeature {
>>       name = "kern",
>>       type = "kern",
>>       data = {
>>           [" "] = {
>>               ["J"] = 1000 % exaggerated value
>
> Should of course be a Lua comment
>
>             ["J"] = 1000 -- exaggerated value
>
>>           }
>>       }
>> }
>> \stopluacode
>>
>> \setupbodyfont[modern] % have to reload the font
>>
>> \starttext
>>
>> No Jokes!
>>
>> \stoptext
>>
Henri,

This looks very promising. It works, mostly. That is, all fonts that use 
default fontfeatures pick up the change. So, for example, the companion 
sansserif for my body font also gets it even though that is not what I want.

I can remove kerning from the default fontfeatures and add it back just 
for the problematic font, but that means no kerning for the sans font.

Is there a way to apply this to one font only (serif upright, bold, 
italic, ...) or even a single face (upright), perhaps by giving it a 
unique name? I have tried a few variations but had no success. The 
fonts-mkiv manual has very little on this, and the cld manual nothing.

-- 
Rik

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Adjust kern for one character
  2019-12-23 23:45         ` Rik Kabel
@ 2019-12-26 12:41           ` Rik Kabel
  2019-12-26 13:40             ` Hans Hagen
  0 siblings, 1 reply; 12+ messages in thread
From: Rik Kabel @ 2019-12-26 12:41 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 4912 bytes --]


On 12/23/2019 18:45, Rik Kabel wrote:
>
> On 12/22/2019 21:34, Henri Menke wrote:
>>
>>
>> On 12/23/19 3:33 PM, Henri Menke wrote:
>>> On 12/23/19 2:30 PM, Rik Kabel wrote:
>>>>
>>>> On 12/22/2019 17:40, mf wrote:
>>>>> Il 22/12/19 22:19, Rik Kabel ha scritto:
>>>>>> List,
>>>>>>
>>>>>> Is there a way in ConTeXt to adjust the left-side kern for one
>>>>>> character? The cap J in the font I am using is being set too 
>>>>>> close to
>>>>>> the preceding characters and I would rather not insert a thinspace
>>>>>> before each. (Inserting a thinspace is sufficient, but finer control
>>>>>> is welcome.)
>>>>>>
>>>>> \definecharacterspacing[distantJ]
>>>>> \setupcharacterspacing[distantJ]["004A][left=.15,alternative=1] % 
>>>>> 004A
>>>>> is the unicode hex index of letter J
>>>>> \starttext
>>>>>     normal: AJB\par
>>>>>     \setcharacterspacing[distantJ] more space on the left: AJB\par
>>>>>     \resetcharacterspacing normal again: AJB\par
>>>>> \stoptext
>>>>>
>>>> Thank you for that, Massi.
>>>>
>>>> Unfortunately, that is too blunt an instrument in this case -- in
>>>> addition to the body font where the problem exists, it works on the
>>>> heading and titling font, which does not share the problem.
>>>>
>>>> As Henri's answer hints, I was a bit unclear in my request. It is a 
>>>> kern
>>>> between a word space and the cap J that is the issue. Perhaps a font
>>>> feature file is the place to do such a thing.
>>>
>>> \startluacode
>>> fonts.handlers.otf.addfeature {
>>>       name = "kern",
>>>       type = "kern",
>>>       data = {
>>>           [" "] = {
>>>               ["J"] = 1000 % exaggerated value
>>
>> Should of course be a Lua comment
>>
>>             ["J"] = 1000 -- exaggerated value
>>
>>>           }
>>>       }
>>> }
>>> \stopluacode
>>>
>>> \setupbodyfont[modern] % have to reload the font
>>>
>>> \starttext
>>>
>>> No Jokes!
>>>
>>> \stoptext
>>>
> Henri,
>
> This looks very promising. It works, mostly. That is, all fonts that 
> use default fontfeatures pick up the change. So, for example, the 
> companion sansserif for my body font also gets it even though that is 
> not what I want.
>
> I can remove kerning from the default fontfeatures and add it back 
> just for the problematic font, but that means no kerning for the sans 
> font.
>
> Is there a way to apply this to one font only (serif upright, bold, 
> italic, ...) or even a single face (upright), perhaps by giving it a 
> unique name? I have tried a few variations but had no success. The 
> fonts-mkiv manual has very little on this, and the cld manual nothing.
>
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.

If I can get support for a separate feature name, I can easily apply 
this corrective kern to the single problematic font.

I also tried a goodie file, but it, too, did not support the " ".

-- 
Rik


[-- Attachment #1.2: Type: text/html, Size: 6440 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Adjust kern for one character
  2019-12-26 12:41           ` Rik Kabel
@ 2019-12-26 13:40             ` Hans Hagen
  2019-12-26 14:34               ` Rik Kabel
  0 siblings, 1 reply; 12+ messages in thread
From: Hans Hagen @ 2019-12-26 13:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Rik Kabel

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Adjust kern for one character
  2019-12-26 13:40             ` Hans Hagen
@ 2019-12-26 14:34               ` Rik Kabel
  0 siblings, 0 replies; 12+ messages in thread
From: Rik Kabel @ 2019-12-26 14:34 UTC (permalink / raw)
  To: Hans Hagen, mailing list for ConTeXt users


On 12/26/2019 08:40, Hans Hagen wrote:
> 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
>
Thank you for the confirmation. I look forward to the update.

-- 
Rik

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-12-26 14:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-22 21:19 Adjust kern for one character Rik Kabel
2019-12-22 21:28 ` Henri Menke
2019-12-23  9:13   ` Mojca Miklavec
2019-12-23  9:31     ` Hans Hagen
2019-12-22 22:40 ` mf
2019-12-23  1:30   ` Rik Kabel
2019-12-23  2:33     ` Henri Menke
2019-12-23  2:34       ` Henri Menke
2019-12-23 23:45         ` Rik Kabel
2019-12-26 12:41           ` Rik Kabel
2019-12-26 13:40             ` Hans Hagen
2019-12-26 14:34               ` Rik Kabel

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).