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:
- Get a bitmapped version of the glyph pair (or do it with vectors if you want)
- For each row of pixels (or arbitrary vertical unit if you go with vectors), check that both glyphs have at least one pixel present
- 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
- 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 :)