Kerning tools
These tools help you audit kerning with a geometry-based collision guard, and optionally apply conservative “bumper” fixes as glyph–glyph exceptions.
review_kerning_bumpermeasures outline gaps and returns findings + suggestions (no mutation).apply_kerning_bumperapplies the same suggestions as kerning exceptions (requires a confirmation gate).
The intent is typographer-first:
- Deterministic geometry measurements (objective).
- Human/LLM judgement for “best” kerning values (aesthetic).
- Safe defaults and explicit confirmation for mutation.
When to use it
Use these tools after spacing and kerning groups have had a first pass. They are best for:
- detecting outline collisions or near-misses,
- generating a conservative list of pairs that need more space,
- applying approved glyph-glyph exception fixes,
- opening proof tabs for the worst offenders.
Do not treat the bumper tools as an optical kerning engine. They are a safety guardrail.
What the tools change (and what they don’t)
Changes (only when applied)
- Adds/updates glyph–glyph kerning exceptions for a master.
Does not change
- Outlines (paths)
- Components
- Anchors
- Sidebearings / widths
- Kerning classes (group kerning)
- Any files on disk (no auto-save)
Core idea (plain language)
For a given pair of glyphs in a master:
- Place the right glyph after the left glyph using
leftWidth + kerningValue. - Across the glyphs’ vertical overlap range, cast horizontal scanlines at multiple
yvalues. - At each scanline, find:
- the rightmost intersection of the left glyph (its right edge at that y),
- the leftmost intersection of the right glyph (its left edge at that y).
- Compute the gap between outlines at that y.
- Keep the minimum gap across all scanlines (the “worst” place), and also report minima per vertical band.
If the minimum gap is below your configured min_gap, the tool proposes a bumper:
- the minimal kerning loosening (increase) needed to reach the gap constraint.
Pair selection (what gets analyzed)
By default, the tools analyze a prioritized pair list:
- Top‑N pairs from the bundled Andre Fuchs “relevant pairs” dataset (MIT snapshot, local/offline).
- Plus representative pairs from your existing explicit kerning in the master (optional).
Controls:
relevant_limit: how many “top pairs” are considered.include_existing: include representative pairs from existing kerning.pair_limit: hard cap on measured glyph pairs (performance guard).glyph_names: focus filter (keep only pairs where left or right is in the list).
Scan strategy (BubbleKern-style)
The measurement uses a scan strategy similar in spirit to scan-height approaches:
scan_mode
two_pass(default): quick scan at a few normalized heights, then refine with a dense scan only when near the threshold.heights_only: only the quick scan heights (fastest; can miss tiny collisions).dense_only: dense scan for every pair (slowest; most thorough).
scan_heights
Normalized heights within the overlap band, default:
[0.05, 0.15, 0.35, 0.65, 0.75]
dense_step
Dense scan step in font units (e.g. 10.0 units).
bands
Number of equal vertical bands used for bandMinGaps reporting.
Bumper behavior (safety)
min_gap
The minimum allowed outline gap in font units.
extra_gap (apply tool only)
Adds extra cushion above min_gap when applying.
max_delta (apply tool only)
Clamps how much the tool will loosen kerning per pair (in units), to prevent wild swings.
“Only loosen”
The tools only propose/apply loosening (increasing kerning values). They never tighten.
Limitations and caveats (important)
- This is a collision guard, not an “optical” kerning engine.
- Class–class kerning is represented by a single representative glyph pair for measurement; other members can still collide.
- Scanline intersection measurements depend on what
layer.intersectionsBetweenPointsreturns; very complex shapes or special layers may yield fewer usable samples. - Fonts with unusual metrics conventions (very negative sidebearings, extreme overshoots) can yield legitimate collisions even with positive kerning.
Related reference
Prompt templates
Reusable kerning prompts live in the kerning workflow and the command set prompt pack. Keep this page focused on bumper measurement behavior, pair selection, and limits.
Inspirations
This implementation is designed as a clean-room, geometry-first tool, inspired by:
- BubbleKern scan-height ideas (conceptual scan strategy).
- mekkablue Glyphs scripts (audit mindset: GapFinder/KernCrasher/Auto Bumper concepts).
- FontForge’s auto-kerning ideas (minimum separation / collision avoidance).
- “Learning to Kern” (research literature; not used as code/data).