Copying kerning classes in FontLab

Number3Pencils's picture

I'm having trouble figuring out a thing in FontLab. I'm trying to copy all the kerning data from one of my fonts to another one, but it's not working right. I go into the class kerning panel and click "Copy classes from a font", but it only copies the classes, not the actual kerning numbers. So when I test the kerning, none of the letters kern at all.

But with some of my fonts it does work. Particularly, it works with the ones where the letters are all in the right order in the font window, which is to say they're alphabetical. In the ones where it doesn't work, the letters are all jumbled around once you get out of Latin-1 (sample: ŔĂĹĆČĘĚĎĐŃŇŐŘŮŰŢ). Actually the weird part is that on one of the two fonts where it worked, the letters are jumbled, although in that font I remember they've been ordered before; I don't know when it changed.

How can I get the letters in the right order, and more importantly, how can I get the kerning to copy from one font to the other? Is it something to do with encoding? Because I really don't understand that well.


blank's picture

Kerning Copy/Paste and import options are buggy; the more pairs you have the worse it gets. IIRC Karsten Lucke has written some scripts for doing this stuff correctly, it might be worthwhile to ask him about them.

But I highly recommend that you just license Metrics Machine and not kern in Fontlab at all.

Number3Pencils's picture

MetricsMachine looks great, but I don't have that kind of money! I'll see if I can get a hold of Karsten, I suppose. But any other suggestions, I'd still love to hear them.

pvanderlaan's picture

How about saving the kerning classes to an flc file, saving the kerning pairs to an afm file and importing them in the other font again?


Mark Simonson's picture

There's the kern table, which is what you're editing in the Metrics Window, and is for pre-OpenType fonts (mainly), and then there's the kern feature, which is a separate thing for OpenType fonts. You can generate the kern feature from the kern table using Kerning Assistance -> Update [kern] Feature. You can go the other direction with the "Expand" button, but this is not the best way to do what you want to do.

Here's what to do: With the first font, open the Metrics Window, click the "Save Metrics" button (second from the left at the top). This will create an .afm file, which is a text file containing metrics and kerning info. Now switch to the other font, open the Metrics Window, and click on the "Open Metrics" button (top left) and choose the .afm file you just created. A warning message will appear, reminding you to make sure you know what you're doing. (It's a good idea to save the font before doing this.) If you click "Continue", it will ask you which data you want to import from the .afm file. Choose "Do nothing", "Completely replace kerning data in current font", and "Do nothing" from the three popups. The second font will now contain a kern table identical to the first font.

You will probably also want to import the kerning classes from the other font in the Classes panel.

Number3Pencils's picture

Brilliant! Thanks so much, you just saved me five hundred bucks.

twardoch's picture

Another method:

In the source font, save the OpenType Layout features into a .fea text file (using the OpenType panel popup menu).

In the target font:
1. Open the OpenType Layout features from that .fea text file (using the OpenType panel popup menu).
2. Compile the OpenType Layout features (using the Compile button on the OpenType panel).
3. Open the Preview panel, OpenType Features tab, and click on the "Import kerning from [kern] feature" button.

Alternatively (if you have the same classes set up in both fonts), in the source font you can just generate a "kern" feature, then copy-paste the "kern" feature definition from the source font's OpenType panel into the target font's, then compile the features in the target font and use the "Import kerning from [kern] feature" button on the OpenType Features tab of the Preview panel.


Ray Larabie's picture

BTW: never "Copy classes from a font". If glyphs are missing in the target font, they get wiped from the class table with no warning. Always save classes and load them in the target font. That way you are given to option to ignore missing glyphs or generate them.

Number3Pencils's picture

I'll definitely keep that in mind. Thanks for that.

Syndicate content Syndicate content