Building a CID-keyed font with 64K glyphs

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:

  1. 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
  2. A cidfontinfo file
  3. 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
P_zero_one

The cidfontinfo file is below (and can be copied to a file with the same name):

FontName        (UnicodeP01)
FullName        (Unicode P01)
FamilyName      (Unicode P01)
Weight          (Regular)
version         (1.000)
Registry        (Adobe)
Ordering        (Identity)
Supplement      0
XUID            [1 11 9273868]
AdobeCopyright  (Copyright 2012 Adobe Systems Incorporated. All Rights Reserved.)
Trademark       ()
FSType          8
isFixedPitch    true
Serif           false
IsBoldStyle     false
IsItalicStyle   false

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:

mergeFonts UnicodeP01-0
0      .notdef
1      P_zero_one
2      P_zero_one
3      P_zero_one
4      P_zero_one
5      P_zero_one
<65,524 lines omitted>
65530  P_zero_one
65531  P_zero_one
65532  P_zero_one
65533  P_zero_one
65534  P_zero_one

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.

Comments are closed.