Import Kerning from AFM

Primary tabs

4 posts / 0 new
Last post
Ken Krugh's picture
Joined: 10 Apr 2007 - 9:05am
Import Kerning from AFM

Using FontLab 5, Windows.
I'm creating an OTF font from a few Type1 fonts. One of the type one fonts is a small cap font. To get the kerning pairs from the old Type1 font into my new font I thought I could pull the Type1 into FontLab and export the AFM file. Then open the AFM in a text editor and change all the lowercase characters to my small cap glyphs.

For instance:
KPX A c -18
KPX A Csmall -18
where Csmall is the name of my small cap c. But it isn't working and I can't see why!

From the AFM file I'm also deleting all the kern pairs I won't need, like:
KPX A T -74
as it's already in there from having procesed the "regular" text.

When all my substitutions are made in the AFM file I change the StartKernPairs line to reflect the number of pairs I now have.

However, when I try to import the modified AFM into FontLab it doesn't import any kern pairs, even if I tell it to completely replace them. I'm able to import kerning from other AFM files but I don't see any difference in structure between the ones that import and the one that won't. What am I missing?

Thanks for any insight

Karsten Luecke's picture
Joined: 6 Aug 2005 - 8:41am

It appears that you need to change glyph names in the character metrics section too, i.e. in the list between keywords StartCharMetrics and EndCharMetrics.

Charles Ellertson's picture
Joined: 3 Nov 2004 - 11:00am

Hi Ken,

It doesn't matter if the "number of kern pairs" line is corrrect.

Try this: In your existing OpenType font, which does have the small caps, but does not have the small cap kerning, export an AFM.

Now, working in a text editor, from the Type 1 font AFM you've pared down so that all KPX pairs contain at least one small cap, copy only the KPX portion, and paste that at the bottom (doesn't really matter, just easier) of the KPX portion of the AFM you exported from the OT version. (A lot of words trying to be clear. It is really very simple. You could export a AFM from the OT version and type in new KPX pairs. Just cut & paste instead.)

Save the AFM file and reimport into the FontLab OTF file.

You'll see immediately in the dialog box the number of new pairs FL found, and added. If it's "zero" added you have a problem, most likely a disagreement of glyph *names*

As Karsten says, the glyphs in the kerning (KPX) portion must be matched in the character metrics portion. For me anyway, the above copy & paste technique offers the least chance for error with the greatest chance to figure out what went wrong.

Jens Kutílek's picture
Joined: 12 Sep 2007 - 7:55am

My FL workflow for this kind of thing usually is:

  • Put the normal font into the mask of the small cap font
  • Step through all the glyphs and mark those that are different from the mask
  • Add .sc to the glyph names of all marked glyphs
  • Export AFM (now contains the correct .sc glyph names automatically)
  • Copy the .sc glyphs from the small cap font to normal font (or use Merge Fonts function)
  • Import AFM into the merged font, choosing option "add kerning to existing" or whatever it's called