ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* modify kern between two glyphs
@ 2022-04-05 11:02 mf via ntg-context
  2022-04-05 11:15 ` Thomas A. Schmitz via ntg-context
  0 siblings, 1 reply; 6+ messages in thread
From: mf via ntg-context @ 2022-04-05 11:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: mf

Hello list,

I need to modify the kern between two glyphs.

This is a MWE where the problem is solved manually:

------------------------------------------
\mainlanguage[it]
\starttext

Default: «Questo è successo nel ’48».

Desired: «Questo è successo nel ’\kern-.1em 48».

\stoptext
------------------------------------------

Is it possible to solve it globally and only for a single font?

Thanks,
Massi
___________________________________________________________________________________
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] 6+ messages in thread

* Re: modify kern between two glyphs
  2022-04-05 11:02 modify kern between two glyphs mf via ntg-context
@ 2022-04-05 11:15 ` Thomas A. Schmitz via ntg-context
  2022-04-05 11:45   ` mf via ntg-context
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas A. Schmitz via ntg-context @ 2022-04-05 11:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Thomas A. Schmitz



> On 5. Apr 2022, at 13:02, mf via ntg-context <ntg-context@ntg.nl> wrote:
> 
> Is it possible to solve it globally and only for a single font?
> 
> Thanks,
> Massi

Have you looked at chapter 5.4 “Goodies” of fonts-mkiv.pdf? That should get you started.

Thomas
___________________________________________________________________________________
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] 6+ messages in thread

* Re: modify kern between two glyphs
  2022-04-05 11:15 ` Thomas A. Schmitz via ntg-context
@ 2022-04-05 11:45   ` mf via ntg-context
  2022-04-05 11:54     ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 6+ messages in thread
From: mf via ntg-context @ 2022-04-05 11:45 UTC (permalink / raw)
  To: Thomas A. Schmitz via ntg-context; +Cc: mf

Il 05/04/22 13:15, Thomas A. Schmitz via ntg-context ha scritto:
> 
> 
>> On 5. Apr 2022, at 13:02, mf via ntg-context <ntg-context@ntg.nl> wrote:
>>
>> Is it possible to solve it globally and only for a single font?
>>
>> Thanks,
>> Massi
> 
> Have you looked at chapter 5.4 “Goodies” of fonts-mkiv.pdf? That should get you started.
> 
Thanks Thomas,
there seems to be nothing for that in the "Goodies" chapter.

I'd already found \setextrafontkerns at "8.12 Extra font kerns" of the 
same manual.
It's defined in typo-fkr.lua, but I can't understand what parameters to 
pass and whether it's the right macro. It looks like it's not.

I'm expecting there's a lua font table with glyph pairs kerning to update.

Massi
___________________________________________________________________________________
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] 6+ messages in thread

* Re: modify kern between two glyphs
  2022-04-05 11:45   ` mf via ntg-context
@ 2022-04-05 11:54     ` Hans Hagen via ntg-context
  2022-04-05 12:34       ` mf via ntg-context
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen via ntg-context @ 2022-04-05 11:54 UTC (permalink / raw)
  To: mf via ntg-context; +Cc: Hans Hagen

On 4/5/2022 1:45 PM, mf via ntg-context wrote:

> It's defined in typo-fkr.lua, but I can't understand what parameters to 
> pass and whether it's the right macro. It looks like it's not.
look at the extension examples in the test suite: you can define a kern 
pair positioning feature than you enable for just that font

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] 6+ messages in thread

* Re: modify kern between two glyphs
  2022-04-05 11:54     ` Hans Hagen via ntg-context
@ 2022-04-05 12:34       ` mf via ntg-context
  2022-04-05 13:29         ` mf via ntg-context
  0 siblings, 1 reply; 6+ messages in thread
From: mf via ntg-context @ 2022-04-05 12:34 UTC (permalink / raw)
  To: Hans Hagen via ntg-context; +Cc: mf

Il 05/04/22 13:54, Hans Hagen via ntg-context ha scritto:
> On 4/5/2022 1:45 PM, mf via ntg-context wrote:
> 
>> It's defined in typo-fkr.lua, but I can't understand what parameters 
>> to pass and whether it's the right macro. It looks like it's not.
> look at the extension examples in the test suite: you can define a kern 
> pair positioning feature than you enable for just that font
> 

Thanks Hans, here's the working MWE:

-------------------------------------------------------
\mainlanguage[it]

% from http://www.pragma-ade.com/context/latest/cont-tst.zip
% file doc/context/tests/mkiv/fonts/extensions-001.tex
\startluacode
     fonts.handlers.otf.addfeature {
         name = "ktest",
         type = "kern",
         data = {
             [ '’' ] = { [ '4' ] = -100 },
         }
     }
\stopluacode
\definefontfeature[ktest][ktest=yes]

\starttext

Default: «Questo è successo nel ’48».

Desired: «Questo è successo nel ’\kern-.1em 48».

Solved: \feature[+][ktest]«Questo è successo nel ’48».

\stoptext
------------------------------------------------------

Massi
___________________________________________________________________________________
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] 6+ messages in thread

* Re: modify kern between two glyphs
  2022-04-05 12:34       ` mf via ntg-context
@ 2022-04-05 13:29         ` mf via ntg-context
  0 siblings, 0 replies; 6+ messages in thread
From: mf via ntg-context @ 2022-04-05 13:29 UTC (permalink / raw)
  To: ntg-context; +Cc: mf

There's a problem with oldstyle glyphs, because they have different 
codes inside a font.

I used fontforge to find the "four.oldstyle" glyph, whose code is 0xf734.
But then I discovered that the 'four.oldstyle' key works the same in the 
lua table.

This is the updated MWE, suitable for oldstyle glyphs too.

--------------------------------------------------
\mainlanguage[it]

% modified from http://www.pragma-ade.com/context/latest/cont-tst.zip
% file: doc/context/tests/mkiv/fonts/extensions-001.tex

\startluacode
     fonts.handlers.otf.addfeature {
         name = "ktest",
         type = "kern",
         data = {
             [ '’' ] = {
               [ '4' ] = -100,
               [ 0xf734 ] = -150, -- four.oldstyle code
               -- [ 'four.oldstyle' ] = -150, -- this is the same as the 
previous line
             },
         }
     }
\stopluacode
\definefontfeature[ktest][ktest=yes]
\definefontfeature[onum][onum=yes]

\starttext
Default: «Questo è successo nel ’48».

Desired: «Questo è successo nel ’\kern-.1em 48».

Solved: \feature[+][ktest]«Questo è successo nel ’48».

Onum: \feature[+][onum]«Questo è successo nel ’48».

\stoptext
--------------------------------------------------

Massi
___________________________________________________________________________________
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] 6+ messages in thread

end of thread, other threads:[~2022-04-05 13:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 11:02 modify kern between two glyphs mf via ntg-context
2022-04-05 11:15 ` Thomas A. Schmitz via ntg-context
2022-04-05 11:45   ` mf via ntg-context
2022-04-05 11:54     ` Hans Hagen via ntg-context
2022-04-05 12:34       ` mf via ntg-context
2022-04-05 13:29         ` mf via ntg-context

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