Today, I want to demonstrate how the AFDKO mergeFonts tool can be used to quickly and easily build a CID-keyed font that includes 64K glyphs, meaning CIDs 0 through 65534. This is the maximum number of glyphs that a CIDFont resource can contain. This font, of course, will use the special-purpose Adobe-Identity-0 ROS, and although its is a CID-keyed font, it will include only one FDArray element.
We can build such a CID-keyed font by using the following three components:
- A name-keyed Type 1 font that includes at least the .notdef glyph (this will serve as the glyph for CID+0) and another glyph that will be used for CIDs 1 through 65534
- A cidfontinfo file
- A mergeFonts mapping file that maps the glyphs in the name-keyed Type 1 font to CIDs 0 through 65534
The name-keyed font includes the following two glyphs: .notdef and P_zero_one (“P01”). As a side note, the extract-names.pl tool, which is a simple wrapper for the AFDKO tx tool, can be used to list the glyphs in a name-keyed font, and is used as follows, with sample output given after the command line (it skips the .notdef glyph in its output):
% extract-names.pl font.pfa
The cidfontinfo file is below (and can be copied to a file with the same name):
FullName (Unicode P01)
FamilyName (Unicode P01)
XUID [1 11 9273868]
AdobeCopyright (Copyright 2012 Adobe Systems Incorporated. All Rights Reserved.)
The mergeFonts mapping file contains 65,536 lines, the first of which indicates that it is a mergeFonts mapping file, followed by the name of the FDArray element. The second and subsequent lines map glyph names to CIDs. Below is an excerpt:
<65,524 lines omitted>
The mergeFonts command line, which is used to build the CIDFont resource is as follows:
% mergeFonts -cid cidfontinfo cidfont.ps map.txt font.pfa
That’s it! The result is a CIDFont resource named cidfont.ps that contains 65,535 CIDs (CIDs 0 through 65534). Because there is a name- to CID-keyed conversion, the “-cid” option and a cidfontinfo file is required when using the mergeFonts tool.
The next CJK Type Blog article, which will follow in a day or two, will demonstrate how the same CID-keyed font can be built, but with 256 FDArray elements, which is the maximum for a CIDFont resource. Again, the mergeFonts tool will be used.