Elektrine lite

← Feed

@gdc@typo.social

Post #894404

2026-01-04 21:31 UTC

Working on a new autokerning script. It's based on a simple idea: fit glyphs as close to each other as possible based on the actual vector shape, so they're just about touching, but don't collide. Then add tracking. But, depending on the desired effect, this can create too much overlap in combinations like "C-" where the dash would go completely inside the C shape. This is fixed by add a big bounding box that's some percentage of the original shape, and acts as a minimum bounding box size. This works quite nicely, so that combinations like AT, LY, etc. are not overkerned. Here's debug images showing how the collision is actually detected. I parse the SVG path and create a binary tree of bounding boxes based on it. Then just do simple rectangle collision checks.

Replies (4)

  • @lowtech@tldr.nettime.org 2026-01-04 22:01

    @gdc Why a new system? Don't vector fonts typically already have anti-collision data embedded within them? I think I recall that each glyph's definition has a high, middle and low zone, defined as a distance left and right from a central spine. The spines, as well as the zones, have a minimum gap, so combinations like L7 don't get rendered as almost a box. (I may be remembering this inaccurately…)

    Open ##1484390

  • @Okay@typo.social 2026-01-04 23:14

    @gdc this is essentially how bubble kern works fwiw

    Open ##1484395

  • @behdad@typo.social 2026-01-04 23:27

    @gdc I do something essentially similar in https://github.com/behdad/halfkern

    Open ##1484397

  • @timahrens@typo.social 2026-01-05 15:57

    @gdc This sounds like HH, OO and VV would end up having the same _minimum_ distance?

    Open ##1484399