Skip to main content
GameDev.net gamedev.net
🔒 Locked

Font Kerning Libs?

Started by TrickTrackMicky Oct 17, 2012 at 8:45 PM 3 replies 1.9k views
Original Post
TrickTrackMicky
TrickTrackMicky
Hello,

Sorry if this is the wrong place as this is my first post.

I need help with some understanding with kerning font values. I completely understand how font kerning works but I'm used to importing kerning values for a specific font through a file. Now what I plan on doing is writing a bitmap font creator ( I know they exist, it's just a side project). I'm planning on having similar functionality to what angel code does if anyone is familiar with that. What I'm thinking is there has to be some sort of lib. out there that contains kerning values for standard fonts and all their sizes. I refuse to believe that people just hard code these values into some ridiculously long file or multiple files.

If that isn't the cases then how to programs such as... well any program that you can type in handle the kerning of multiple fonts and their sizes? Do they really just have multiple files for each specific case and load them in once the specific is set?

Any enlightenment to this would be greatly appreciated.
SiCrane
SiCrane
Kerning information is generally embedded in the font itself. The TrueType font format has an optional kerning table as part of the spec for pairs of glyphs and OpenType has a more complicated, but more robust, kerning information table.
TrickTrackMicky
TrickTrackMicky
Interesting, I was unaware that the values were directly embedded into the font itself. Kind of silly to think otherwise. I imagine it's just as easy as reading in the specific tables of the font itself. OTF as you said is more complicated so that would obviously be handled slightly differently.

Thanks for the assistance SiCrane, I have a clear understanding of how I need to go about it.
Hodgman
Hodgman
If for some reason you can't use the original values -- e.g. if your bitmap glyphs have been modified form the original TTF data, such as adding outlines, etc -- you can brute-force discover them by placing each possible pair of glyphs side by side, and then iteratively moving them 1 pixel closer together until a non-transparent pixel overlaps.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.