Proof of Concept: Contextual Kerning UI for Glyphs 3
yanone
Posts: 130
All present-day font editors lack the option to define contextual kerning using a UI. I made a bunch of scriptlets that together form a tool to implement contextual kerning for Glyphs 3, hijacking the normal kerning user interface after a contextual kerning "mode" was activated.
It saves the contextual kerning values in Glyphs’ "Numbers" (named data points that can have different values per master) that can be referenced in feature code as variables ("Tokens"). This also works in glyphsLib.
The tool is usable, but I wish that font editors would one day implement such functionality natively, so I labelled it "Proof of Concept". If you run into any trouble using this, please let me know.
https://github.com/yanone/Yanone-GlyphsApp-Scripts/tree/main/Contextual Kerning
It saves the contextual kerning values in Glyphs’ "Numbers" (named data points that can have different values per master) that can be referenced in feature code as variables ("Tokens"). This also works in glyphsLib.
The tool is usable, but I wish that font editors would one day implement such functionality natively, so I labelled it "Proof of Concept". If you run into any trouble using this, please let me know.
https://github.com/yanone/Yanone-GlyphsApp-Scripts/tree/main/Contextual Kerning
9
Comments
-
brilliant idea! And thank your example on github (
pos L' space T -40
) I discovered that 'space' in most programs nowadays don't break contextual chain, like a years ago!
1 -
thanks to this thread I started trying contextual kerning and solved the problem of WWW.A WWW.H in my font. I can confirm that it works in Scribus, Firefox, Chrome, Inkscape (with small bug). Small thing and make me a day
3 -
Looking into contextual kerning recently has made me wonder how commonly used it is. How often do you all take advantage of the feature? Obviously milage will vary from font to font, but there are definitely instances where normal kerning just doesn’t seem to cut it. And if you do use it, are there common combinations of troublesome characters you end up targeting?0
-
Comma and especially period is one top use case for me
Take a letter such as TVWY (and maybe P), followed by a period or comma, and then another letter from TVWY.
WITHOUT the second letter, I might kern the period or comma tighter against the first letter. But WITH that second letter, I want to not have the letters collide and have the period or comma centered between them.0 -
Er, isn’t kerning fundamentally already contextual?
If one substitutes a different glyph for better fit, that is what I call (after John Hudson) dynamic ligaturing.
I’ve used it occasionally in serifed typefaces, e.g. for the f combinations with following b, h, k and l.0 -
Er, isn’t kerning fundamentally contextual?Contextual, in this case, implies that the value of a kern adjustment between two glyphs varies depending on some other factor, such as the presence of a third glyph.
I use contextual spacing adjustments* a lot in fonts for various Indic scripts, but seldom in Latin. The classic Latin use case—which mirrors one of the things that happens in Indic scripts—would be applying a positive kern adjustment between two glyphs when one of them takes a dynamically positioned combining mark glyph. So, for example if one has a fairly tight Tr kern pair, one might contextually loosen it if the r takes a combining mark above.
* Not all of these are pair positioning adjustments as typical of kerning; some are contextual adjustments affecting the spacing or position of a single glyph.1 -
Contextual, in this case,
So, not to be confused with Optical Kerning.
Kerning is already optical and contextual, why not have a more specific terminology, less likely to confuse simple folk like me?
0 -
No, pair kerning is not contextual; nothing outside the kern pair affects it.
This sense of “contextual” is in tune with both the general dictionary definition of “context,” and is also native to the OpenType specification itself. The OpenType spec has used it this way since version 1.0 nearly 30 years ago, so now is a bit late to object to it.
1 -
I suppose Nick is thinking of kerning in terms of local context, i.e. of kerning as an adjustment to the general spacing of glyphs when next to specific other glyphs. That’s a reasonable sort of common usage, but it isn’t an adequate technical usage because the technologies that apply that adjustment do not express the adjustment in terms of context, whereas in those technologies contextual has a precise meaning.1
-
Yes indeed. That is why I would have preferred a technical meaning that was worded differently than the common meaning. Still, thanks for explaining, I will try to wrap my head around it!
0 -
Tofu Type Foundry said:Looking into contextual kerning recently has made me wonder how commonly used it is. How often do you all take advantage of the feature?
The downside of that is that any kerning you do on accented characters then has to be contextual. Generally only a few pairs/triples are necessary and I'm happy enough writing the rules by hand, but I can see why an interface to contextual kerning would help people.
OTOH, many of the problems can also be solved in a slightly different way with contextual anchor positioning (move the dot across a bit) or contextual substitution (use a flatter accent), and Glyphs supports both of these things well enough already. Whether these alternatives suitably maintain your text colour will depend on your design.1 -
I recall that Apple's GX fonts could handle kerning triplets (for cases like the ones @Thomas Phinney mentions), although I don't remember the details. And I've never made any GX fonts.0
-
I found this discussion on contextual kerning quite engaging. Back in October 2022, I gave a talk at the ATypI Tech Talks Conference where I discussed a technique I referred to as "Variable Contextual Kerning – Triplets." Following that, I published a tutorial that explores this topic using FontCreator.
It's exciting to see innovative approaches, as contextual kerning can indeed enhance the typographic quality of fonts, and having tools that simplify this process is beneficial for the community.
Since FontCreator is now available for Mac users as well, I thought it might be helpful to share this resource. The tutorial provides step-by-step guidance on adding contextual kerning through the OpenType Designer feature in FontCreator.
The variable feature code used is 100% compatible with the upcoming official Adobe OpenType Feature File Specification Additions for Variable Values, currently under review and expected to become official in the first half of 2025.
Hope this adds to the conversation.2
Categories
- All Categories
- 43 Introductions
- 3.7K Typeface Design
- 803 Font Technology
- 1K Technique and Theory
- 622 Type Business
- 444 Type Design Critiques
- 542 Type Design Software
- 30 Punchcutting
- 136 Lettering and Calligraphy
- 83 Technique and Theory
- 53 Lettering Critiques
- 485 Typography
- 303 History of Typography
- 114 Education
- 68 Resources
- 499 Announcements
- 80 Events
- 105 Job Postings
- 148 Type Releases
- 165 Miscellaneous News
- 270 About TypeDrawers
- 53 TypeDrawers Announcements
- 116 Suggestions and Bug Reports