modify kern between two glyphs
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
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
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
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
On 4/5/2022 1:45 PM, mf via ntg-context wrote: 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 -----------------------------------------------------------------
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
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
participants (3)
-
Hans Hagen
-
mf
-
Thomas A. Schmitz