Fully featured OT font into separate fonts

Angus R Shamal's picture

What would be the best/smart/easy way to transform an OT font that is fully featured and has several stylistic variants, into separate fonts for each feature, while still maintaining the kerning pairs etc.?

For example if an OT font has the standard latin characters + small caps + titling characters + alternates... to have the SC and Titling as standalone functional separate fonts.

What would be a good way to do do that?

Mark Simonson's picture

I've done this a few times. Basically, remove the default glyphs (e.g., a, b, c, etc.) from the font window and from the classes, then rename the glyphs that should replace them (e.g., A.smcp, B.smcp, C.smcp, etc.) with the default glyph names (e.g., a, b, c, etc.) using the "Glyph > Rename Glyphs..." command with the option "Rename Glyphs in all Classes" checked. This assumes you are using class-based kerning. (If not, I'm not sure how you could preserve the kerning. There may be a way, but I've never tried.) You'll also need to remove whatever feature code was used previously to make the substitution (e.g., smcp).

There is probably some way to automate this using Python, but I haven't spent enough time investigating the possibility. I'd like to hear about it if it has been done.

Khaled Hosny's picture

While ago I wrote a Python script that would do that using FontForge Python scripting. If you interested, you can get it from github.

Angus R Shamal's picture

Thanks Mark. Simple and logical. I imagined it will include changing glyph names in classes etc.
Which vertical Matrix values do you keep intact in font Info in order to keep all the styles consistent baring in mind some might not share the same x-hight or even cap-hight and so on?

Great Khaled. If that was for FontLab I would be a taker! :)

Mark Simonson's picture

If you click the "Rename Glyphs in all Classes" option when you use the "Rename Glyphs..." command (which I noted above), then, yes, the glyphs names will be changed in the classes as well, most importantly in the kerning classes.

If you want the vertical metrics to be the same across several font, then use the same values. Regarding vertical metrics, I recommend this document: http://kltf.de/downloads/FontMetrics-kltf.pdf

Angus R Shamal's picture

Thanks a bunch!

andrijtype's picture

Khaled Hosny,
thanks for your code, it works for me!

unfortunately, it seems not to copy lookup info like kern. without python knowledge i can't add this part into your program. can you help, please? or maybe you know easy way to learn fontforgian library? ))

Khaled Hosny's picture

The script keeps all other OpenType lookups in the font as is, so may be you want old "kern" table. Change line 117 from:
outfont.generate(outfile)
To:
outfont.generate(outfile, flags=("opentype", "old-kern"))

And see if this works (I assume you are generating the font from the script directly not creating an intermediate SFD file).

andrijtype's picture

it keeps standard kern ((
is it python's command analog for 'Copy Lookup Data' from fontforge menu?

Khaled Hosny's picture

All lookups are kept (copied to the output font, if you prefer), so if you can be more specific about the exact problem you have I'd be more able to help.

twardoch's picture

Actually, you don't really need to change the glyph names. All you need to do is to reassign the Unicode codepoints. In FontLab Studio, this can be fairly easily done with a different .nam file. You pick it and choose "Generate Unicode", then pick the different .nam file.

Best,
Adam

Mark Simonson's picture

So, a font will work okay if code point 0061 is named "A.sc" instead of "a"?

twardoch's picture

Mark,

Yes.

A.

Syndicate content Syndicate content