Zum Hauptinhalt springen
☀️ Summer Founder's Deal: FontCreator Lebenslang-Lizenz für $49 (regulär $199). Befristetes Angebot — endet am 14. Juli. Jetzt sichern →

FontCreator Tutorials

Variable Contextual Kerning – Triplets

written by Erwin Denissen, published June 26, 2026

Level: Advanced. This page assumes you're already comfortable writing GPOS lookups by hand. If kerning is new to you, start with Kerning & Autokerning a Font first.

You'll need: FontCreator (Windows and macOS), a font with regular kerning already in place, and — for the per-location values — a variable font with at least one axis. Comfort with the OpenType Designer and its Code Editor.

FontCreator preview of the word L'Amour with a spacing collision between the apostrophe and the A before contextual kerning.

the word "L'Amour" in an italic font showing a spacing collision where the apostrophe sits too close to the following A, before contextual kerning is applied.

You've probably been there: all side bearings and kerning pairs look great, but while scanning long lines of text to verify the spacing you spot something that still looks wrong. This time adjusting a single kern pair won't fix it — the problem involves three glyphs, not two. The spacing only goes wrong with a specific glyph on each side (think L'Amour).

This is a job for contextual kerning — kerning that fires only inside a particular run of glyphs. And because FontCreator's font editor supports variable feature values, the adjustment can vary per location in a variable font, so a triplet that needs +120 units in the Thin master can get +250 in the Bold master, automatically interpolated everywhere between.

Why pair kerning isn't enough here

Regular kerning is a relationship between two glyphs. In L'Amour the apostrophe (quoteright) already has a kern pair with L on its left and another with A on its right. Tuning either pair in isolation throws off every other word that uses that pair. What you actually want is: "when an apostrophe sits between an L and an A, add a little extra space." That's a three-glyph (triplet) context, which only contextual kerning can express.

Contextual kerning adds to the regular kerning rather than replacing it, so you start from your existing pairs and layer the triplet adjustment on top.

Build the triplet in the OpenType Designer

We use the OpenType Designer to add two GPOS lookups:

  • a pair adjustment lookup (PairAdjTriplet) that holds the extra spacing values, and
  • a chained context positioning lookup (TripletAdj) that applies that pair adjustment only inside the L' A context.

Because the contextual kerning adds to the regular kerning, we put it inside the existing kern feature, so users can enable the whole set of kerning (or not) with a single toggle.

FontCreator OpenType Designer with the kern feature expanded showing the PairAdj, PairAdjTriplet and TripletAdj lookups.

the OpenType Designer in FontCreator with the kern feature expanded, showing the PairAdj, PairAdjTriplet and TripletAdj lookups.

In FontCreator, open the OpenType Designer (Font menu → OpenType Designer), click the Code Editor button at the bottom, and use this complete feature code. It contains the original kerning plus 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; ```

FontCreator preview of L'Amour with corrected apostrophe-to-A spacing after the triplet contextual kerning is applied.

the word "L'Amour" after applying the triplet contextual kerning, with the apostrophe-to-A spacing now correct.

How the per-location values work (variable fonts)

The bracketed values are the heart of the variable angle. Each locationDef names a point on the font's weight (wght) axis:

  • wght=16d@ThinItalic
  • wght=72d@Italic (the default)
  • wght=170d@BoldItalic

A value like <120 0 100 0> @ThinItalic:<250 0 200 0> @BoldItalic:<120 0 100 0> then says: use one set of adjustments at the default location, a heavier set at Thin, and another at Bold. FontCreator stores these as variable GPOS values, and the renderer interpolates the kerning for every location in between — so the triplet stays correctly spaced at any weight the user picks on the slider.

This is the payoff of doing it in a variable font: the spacing problem rarely needs the same correction at every weight. Heavier weights collide harder and need more relief; the variable values let a single triplet rule track that across the whole axis.

Tip: If your font is static (no axes), drop the locationDef lines and the @Location: qualifiers and use a single value per rule — the contextual triplet still works, it just won't vary.

Note: The values shown are for the Kantumruy Pro Italic example. Derive your own by reading the collision at each master and entering the units that look right there; FontCreator handles the interpolation between them.

Heads-up on syntax: variable feature values are a relatively young corner of the OpenType toolchain, and the exact source syntax differs between tools — FontCreator's locationDef / @Location: form isn't identical to Adobe AFDKO's. Support varies by toolchain, so if you move this code between editors, check what your AFDKO or Adobe version expects. The compiled font is standard either way; it's only the authoring syntax that differs.

Troubleshooting

SymptomLikely causeFix
Triplet has no effectTripletAdj not inside the kern feature, or kerning disabled in the appKeep it in kern; enable kerning in your test app
Spacing wrong at Bold but fine at ThinA per-location value is missing for that masterAdd the @BoldItalic: qualifier with its own value
Every L'A word now over-spacedTriplet value too large, or duplicated in a plain pairReduce the triplet value; don't also bake it into the L quoteright / quoteright A pairs
Code won't compilelocationDef axis tag or value doesn't match your axisMatch wght (and the design values) to your variable font's actual axis

Frequently asked questions

What is contextual kerning? Contextual kerning adjusts spacing based on a run of glyphs rather than a single pair. It lets a font editor say "add space only when this glyph sits between these specific neighbors," which plain pair kerning can't express.

Why kern a triplet instead of a pair? Some collisions only happen in a three-glyph context (like an apostrophe between L and A). Fixing it as a pair would change the spacing of those characters everywhere; a triplet rule confines the change to that exact context.

How does contextual kerning vary per location in a variable font? FontCreator supports variable GPOS values: you supply a kerning value at each named axis location, and the renderer interpolates between them. The triplet can therefore have different spacing at Thin, Regular, and Bold, smoothly blended across the weight axis.

Should this go in its own feature or in kern? Put it in the existing kern feature. Contextual kerning adds to regular kerning, and keeping both under one feature lets users enable or disable all kerning together.

What to read next

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