Fully featured OT font into separate fonts

Primary tabs

13 posts / 0 new
Last post
Angus R Shamal's picture
Offline
Joined: 7 Aug 2010 - 1:25pm
Fully featured OT font into separate fonts
0

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
Offline
Joined: 3 Dec 2001 - 11:00am
0

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
Offline
Joined: 29 Aug 2007 - 4:57am
0

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
Offline
Joined: 7 Aug 2010 - 1:25pm
0

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
Offline
Joined: 3 Dec 2001 - 11:00am
0

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
Offline
Joined: 7 Aug 2010 - 1:25pm
0

Thanks a bunch!

Andrij Shevchenko's picture
Joined: 2 Jun 2005 - 1:04pm
0

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
Offline
Joined: 29 Aug 2007 - 4:57am
0

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).

Andrij Shevchenko's picture
Joined: 2 Jun 2005 - 1:04pm
0

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

Khaled Hosny's picture
Offline
Joined: 29 Aug 2007 - 4:57am
0

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.

Adam Twardoch's picture
Offline
Joined: 3 Dec 2002 - 7:36pm
0

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
Offline
Joined: 3 Dec 2001 - 11:00am
0

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

Adam Twardoch's picture
Offline
Joined: 3 Dec 2002 - 7:36pm
0

Mark,

Yes.

A.