Zum Hauptinhalt springen

FontCreator Tutorials

Variable Contextual Kerning – Triplets

Written by Erwin Denissen. This article was originally published November 21, 2022. Updated October 30, 2024.

I am sure you’ve been there, all side-bearings and kerning pairs look great, but while further looking at long lists of text to verify all kerning is looking great, you spot some more issues.

This time adjusting a single kern pair won’t do as the problem relates to more than a pair of characters. It just doesn’t look right with specific surrounding characters (L’Amour). There are several solutions to overcome collisions or incorrect spacing between a range of characters. One of them is contextual kerning. Regular kerning remains, so we go from there to add additional spacing.

We use the OpenType Designer to add both a pair adjustment (PairAdjTriplet) and a chained context positioning (TripletAdj) lookup.

Since the contextual kerning adds to the regular kerning, we add it to the existing kern feature, so people can decide to enable the whole set of kerning or not.

This is the complete feature code, containing the original kerning as well as the newly added contextual kerning:

locationDef wght=16d @ThinItalic;
locationDef wght=72d @Italic; # Default
locationDef wght=170d @BoldItalic;


languagesystem latn dflt; # Latin default

lookup PairAdjTriplet { # GPOS lookup type PairAdjustment
pos quoteright A (<120 0 100 0> @ThinItalic:<250 0 200 0> @BoldItalic:<120 0 100 0>);
} PairAdjTriplet;

feature kern { # Kerning
lookup PairAdj { # GPOS lookup type PairAdjustment
pos L quoteright (-260 @ThinItalic:-220);
pos quoteright A (-90 @ThinItalic:-130 @BoldItalic:-40);

} PairAdj;
lookup TripletAdj { # GPOS lookup type ChainedContextPositioning
pos L quoteright' lookup PairAdjTriplet A';
} TripletAdj;
} kern;

And here is the end result:

Credits: the font used in this tutorial is Kantumruy Pro Italic – variable font by Tep Sovichet – https://github.com/sovichet/kantumruy-pro

Note: The used variable feature code is currently (October, 2024) under review and should become official in the first half of 2025.

Updated October 30, 2024 - replaced unofficial OpenType feature code with the official Adobe OpenType Feature File Specification Additions for Variable Values.