Kern Optimization Theory - Calling all Developers!

Diner's picture

I've often completed all the spacing and kerning on a typeface and when I get all done realize there are far too many kern pairs for a specific character in the font.

That conclusion leads me to believe that I have poorly spaced the right sidebearing of the character and I often wish for some tool I could use to merge spacing and kerning data to yield the least amount of kerns.

I call this concept "Flatten Kerning" similar to flattening an image in Photoshop. However I do not have the technical ability to create such an application but feel it could be very simple if I knew how to implement something that would work with a .met file from FOG.

Here's my real life example to illustratrate the need for this tool:

Let's say I've exported the spacing and kerning file from FOG and this is all the data it tells me about my 'o' character.

o a -65 kern
o b -25 kern
o c -5 kern
o d -45 kern
o e -5 kern
o f -10 kern
o g -5 kern
o h -10 kern
o i -5 kern
o j -50 kern
o k -5 kern
o l -5 kern
o m -5 kern
o n -5 kern
o o -10 kern
o p -25 kern
o q -5 kern
o r -25 kern
o s -15 kern
o t -25 kern
o u -5 kern
o v -65 kern
o w -60 kern
o x -45 kern
o y -15 kern
o z -35 kern

As you can see due to not getting the spacing right, I have a kern pair for almost every lowercase instance.

If I look at my right sidebearing, it's 10 which tells me if I take it to 5 I can kill off 10 kern pairs from the font as well as reduce the kerning for the remaining pairs for my 'o'

o a -60 kern
o b -20 kern
o d -40 kern
o f -5 kern
o h -5 kern
o j -45 kern
o o -5 kern
o p -20 kern
o r -20 kern
o s -10 kern
o t -20 kern
o v -60 kern
o w -55 kern
o x -40 kern
o y -10 kern
o z -30 kern

I could do this process manually but I think it could be automated with some sort of program.

Some problems come to mind . . .

First, the metrics file only contains the width of the character which means it'd be difficult to determine the sidebearings of the character.

Second, what to make of left sidebearings since the case may be such that the left sidebearing could be causing the creation of a ton of kerning pairs when all it needs to be is fixed.

I am excited to hear your thoughts and comments about this and please don't tell me FL already does this, I'm looking for a solution that will work for FOG.

Stuart :D

Mark Simonson's picture

Maybe you're already doing this, but I think the thing to do is get into the habit of getting the spacing to work without kerning first and after it's just right, then tackle the problem pairs with kerning.

As to whether what you suggest is possible, it does seem like the sort of thing RoboFOG can do (although I don't use it).

alan's picture

Mark is right, RoboFog can probably be scripted to do this (or FontLab?), but I wouldn't know how either. Even after spending a lot of time spacing, there's inevitably something wrong that reveals itself when you look at the AFM. It's always a back-and-forth situation for me.

For what it's worth, I created a FileMaker database that imports an AFM file, and allows you to do all kinds of operations on specific kinds of kerning pairs. You could say "take all kern pairs where 'o' is the first letter and reduce them by 10. Also take all the pairs where 'v' is the second character, and change the 'v' to a 'w'. Then do a global adjust of -5% on the whole tamale." That sort of thing.

Let me know if you are interested in having it (you have to have FileMaker to run it, I'm sorry to say).

Alan

eolson's picture

Stuart -

As much as I'm interested in your proposal for merging the kerning, I'm not sure it's really the issue. The issue is over kerning. Many of the pairs you've listed in your message are not pairs that would traditionally need kerning (of course there are exceptions, especially with an irregular design). I would look at the spacing before altering the kerning in some way. Many times if the spacing isn't solid, the kerning pairs will snowball.

Diner's picture

I agree with you, and in fact, I threw away all of the kerning and start over with spacing and dramatically killed off most of the kerning.

As per Alan suggestion, it's nice to know there are other font designers who have the same thoughts about this.

Syndicate content Syndicate content