GlyphOrderAndAliasDB

Dan Gayle's picture

I'm working on some of this AFDKO stuff again, and I have a few questions as to how production goes along.

1) How do you typically create the GlyphOrderAndAliasDB file? Specifically, let's say that you're using Fontlab in names mode. What I've been doing is using the "print all glyphs" macro, then cleaning the text up by removing the line numbers. There has GOT to be an easier way to get a complete glyph list to create the DB, since I know something like the 3000+ glyph Arno Pro wasn't hashed out by hand the hard way.

What program or command line program is the best solution? And what programming tools are useful in creating the basic file components used the creation of an opentype font via the AFDKO procedures laid out by Miguel Sousa at TypoTechnica?

2) Just for practice, I'm trying to merge two ttf files together into one otf. One file is the standard U&lc and the other is the expert set with small caps. I'm looking at the mergeFonts tutorial, and it shows that I need to create a mapping file using, guess what, a glyph names list.

Assuming I correctly map the names of the expert set, i.e., s to s.smcp, I should then be able to merge both fonts together into a single .otf file. That final otf file won't contain class metrics or features, but having all of the glyphs together in one file is a start. Am I correct in how I've interpreted the instructions?

Thanks for all of the help!

Miguel Sousa's picture

> How do you typically create the GlyphOrderAndAliasDB file?

What I usually do is to start with an existing GlyphOrderAndAliasDB file and add/remove entries as necessary. (For instance, the one used for Arno Pro was derived from the one used for Garamond Premier Pro, which in turn had been derived from something before). You can, for example, start with the sample file available in the FDK (FDK/Tools/SharedData/GlyphOrderAndAliasDB), or the one present in the ExampleRomanFonts.zip file.
What we do at Adobe is a mix of using data from existing files, and running our own scripts on the file AGD.txt (FDK/Tools/SharedData/AGD.txt).

Alternatively, you can write your own, which sounds like what you're trying to do. Writing a GlyphOrderAndAliasDB file might require some hand work the first time, but the good thing is that once you have it you can use the same file for other projects (as is, or with minor changes).

If you're using Fontlab, what you can do is to switch to "Index mode", rearrange the order of the glyphs, and then run this little Python program,
for g in fl.font.glyphs:
   print g.name

You can then use the outputted list for building your own GlyphOrderAndAliasDB. For that, you will eventually need a good text editor and a spreadsheet program.
In case your final font does not require any glyph name changes --which means you're using final glyph names in the development process--, you can replace the second line of the code above by,
   print "%s\t%s" % (g.name, g.name)
which will output two columns of glyph names.

MakeOTF knows how to map standard glyph names --AGL glyph names and uniXXXX-style glyph names-- to Unicode values, so normally you won't need to have a third column in the GlyphOrderAndAliasDB file.

Another thing I normally do is to extract the second column of the GlyphOrderAndAliasDB file, and use that data to create a FontLab encoding file (.enc). Then, in "Names mode", I use Glyph > Sort Glyphs > By Encoding, and upon switching to "Index mode" I get all the glyphs neatly ordered.

Keep in mind that it's not mandatory for the GlyphOrderAndAliasDB file to have all the glyphs present in the source font. The data on that file is mainly used for controlling the glyph order on the final font, and to rename glyphs from production name to final (standard) name. If a glyph is in the source font but not in the GlyphOrderAndAliasDB file, it will simply be put at the end on the final font, and its glyph name will remain the same. (NOTE: It's *highly* un-recommend, but MakeOTF will build your font even if the only entry in the GlyphOrderAndAliasDB file is the '.notdef')

Additionally, you can use the same GlyphOrderAndAliasDB file for your upright and italic fonts, even if their glyph set is not exactly the same. This allows you to maintain the same overall glyph order within all the fonts in the family. For example, in Arno Pro the italics have a bunch of swash glyphs which aren't present in the uprights. Nonetheless, the same GlyphOrderAndAliasDB file was used for both; MakeOTF simply skipped the entries that didn't apply.

Miguel Sousa's picture

> Just for practice, I’m trying to merge two ttf files together into one otf.

I'm not sure mergeFonts works with TT or OT fonts. I believe it expects a name-keyed or CID-keyed Type 1 font, and it outputs those same formats. So, if you want to use mergeFonts to merge a "basic" font and an "expert" font into a single font, you need to convert the source fonts into Type 1 and then run this command,
mergeFonts output.pfa basicfont.pfa glyphlist expertfont.pfa

which will create the merged font (output.pfa). The glyphlist file is a simple text file containing entries for renaming the glyphs coming from the expertfont.pfa file. Its content can be something like,
mergeFonts
a.sc   Asmall
b.sc   Bsmall
c.sc   Csmall

mergeFonts was created mainly for usage in CJK font development. The raw CID-keyed fonts used as source for the final OTF fonts are normally assembled by merging a few dozen Type 1 fonts, using mergeFonts.

twardoch's picture

Ps. And of course, one can use tx to convert .ttf or .otf into .pfa.

A.

Dan Gayle's picture

Is there a list of commands for tx? I've looked all over the place, and I can't find it. There are hints to using parts of it spread throughout the Adobe documentation, but no solid documentation on tx itself.

solfeggio's picture

Dan, try this: tx -h (for help) and tx -u (for usage).

Regards,
Ernie

k.l.'s picture

Try
tx -u
and/or
tx -h
for usage and help (-u and -h work with most AFDKO scripts).

Dan Gayle's picture

Thanks guys. I tried help tx, man -h tx, etc, but didn't know about those commands. If I tx -u > txusage.txt, that should give me a txt document that I can print off, right?

solfeggio's picture

If I tx -u > txusage.txt, that should give me a txt document that I can print off, right?

Yes. That redirect should do it nicely.

Regards,
Ernie

Miguel Sousa's picture

It seems that you can use .otf fonts as input for mergeFonts after all. The output will be a font in CFF format, which you can then convert to Type 1 using tx.
Therefore, you can do,
mergeFonts output.cff basicfont.otf glyphlist expertfont.otf
and then,
tx -t1 output.cff > output.pfa

twardoch's picture

Of course, OpenType Layout features, including kerning, are an entirely separate matter. You'd need to do some processing to merge both fonts' original kerning tables into a new "kern" feature. There does not seem to be an off-the-shelf commandline solution for that, you'd need to write a Python or shell script yourself.

A.

Dan Gayle's picture

Aye Papi! No mas! No mas!

After all of the conversion work that is taking place around the font industry, you think that someone would have streamlined the process.

Miguel Sousa's picture

This past week I gave a workshop on using the AFDKO at the KABK and one student brought to my attention (thanks Ross!) that the FDK contains a FontLab named "Do Glyph Alias & Ordering". I honestly don't recall ever using it -- which explains why I didn't mention it earlier --, so I'm not sure what it does. That said, I encourage you to look at it, and report back with any suggestions you might have or bugs you may find. Thanks!

fanatic font addict's picture

I've been on Typophile less than twenty-four hours and am not a professional font designer. However I felt obliged to point out the following. I notice there are repeated references in this forum to FontLab. However, no one seems to be familiar at all with a product called FontCreator. FontCreator is vastly superior to anything put out by Fontlab. I advise you to go to cnet.com and download a 30 day trial copy and see for yourself. (And I most certainly do not work for the company.)

Dan Gayle's picture

Vastly superior to anything?

You're going to have to back that statement up with facts, because the "professional font designers" just might have something to say about that.

But do it in another thread, so that this discussion can remain on the creation of the non-Fontlab AFDKO GlyphOrderAndAliasDB file.

Syndicate content Syndicate content