Skip to main content
5 of 7
added 19 characters in body
Symbolic
  • 151
  • 1
  • 3

I know this is old. I'm working on this right now in a WebGL implementation of wobbly text (whatever). The solution I'm working on goes like this:

  1. Get a bitmapped version of the glyph pair (or do it with vectors if you want)
  2. For each row of pixels (or arbitrary vertical unit if you go with vectors), check that both glyphs have at least one pixel present
  3. For each row that passes step 2, calculate the distance between the rightmost pixel of the first glyph and leftmost pixel of the second glyph
  4. Move the second glyph as far left as it can go while still meeting these criteria:
  • the gap in that row of pixels is greater than some minimum gap you specified
  • the total_area ÷ usable_rows (ignoring rows with no pixel in one of the glyphs) is greater than some average gap-width you specified

That way, the empty 'area' between letters should get squeezed to a pretty common average. Specify the minimum gap and the minimum area using trial and error and your own taste, and maybe allow those parameters to be adjusted by some other agent as well... like a manual kerning value.

yay :)

Edit: I've implimented this successfully now and it works really well :)

Symbolic
  • 151
  • 1
  • 3