Skip to content

kern table

Contains legacy kerning pair adjustments for horizontal glyph positioning. For most modern fonts, kerning is handled via the GPOS table instead. Font Flux supports reading and writing all kern formats and can convert between them — see Creating Kerning.

Scope

  • Format family: Shared SFNT
  • Table tag in JSON: kern

Specs

Supported formats

Font Flux fully parses and writes all common kern subtable formats:

VariantFormatDescriptionNotes
OpenType0Ordered pair listMost common legacy format
OpenType2Class-based n×m arrayCompact for many pairs
Apple0Ordered pair listSame structure as OT format 0
Apple1State table (contextual kerning)Best-effort extraction to pairs
Apple2Class-based n×m arraySame structure as OT format 2
Apple3Compact class-based (uint8)Compact; max 256 classes

Unknown subtable formats are preserved as _raw bytes for lossless round-tripping.

JSON Skeleton

OpenType variant

json
{
	"tables": {
		"kern": {
			"formatVariant": "opentype",
			"version": 0,
			"subtables": [
				{
					"version": 0,
					"format": 0,
					"coverage": 1,
					"nPairs": 2,
					"searchRange": 6,
					"entrySelector": 1,
					"rangeShift": 6,
					"pairs": [
						{ "left": 1, "right": 3, "value": -80 },
						{ "left": 2, "right": 4, "value": -50 }
					]
				}
			]
		}
	}
}

Apple variant

json
{
	"tables": {
		"kern": {
			"formatVariant": "apple",
			"version": 65536,
			"subtables": [
				{
					"coverage": 0,
					"format": 3,
					"tupleIndex": 0,
					"glyphCount": 5,
					"kernValueCount": 2,
					"leftClassCount": 2,
					"rightClassCount": 2,
					"flags": 0,
					"kernValues": [0, -50],
					"leftClasses": [0, 1, 0, 0, 0],
					"rightClasses": [0, 0, 1, 0, 0],
					"kernIndices": [0, 0, 0, 1]
				}
			]
		}
	}
}

Top-level Fields

  • formatVariant"opentype" or "apple", determined by table version
  • version0 for OpenType, 0x00010000 (65536) for Apple
  • subtables — Array of subtable objects; each has a format field

Simplified kerning

In the simplified representation, all kern formats are extracted into the top-level kerning[] array using glyph names. You don't normally need to work with the raw kern table directly.

js
fontData.kerning = [
	{ left: 'A', right: 'V', value: -80 },
	{ left: 'T', right: 'o', value: -40 },
];

See Creating Kerning for the full guide on authoring and format conversion.

Notes

  • Preserve _checksum for stable round-tripping.
  • Unknown subtable formats are preserved as _raw bytes.
  • When both kern and GPOS contain kerning, the simplified representation merges both — GPOS values win on conflicts.
  • Validate with .validate() after edits.