As I detailed in the February 24, 2012 CJK Type Blog post, the “first one wins” principle is useful when employing the AFDKO mergeFonts tool for replacing one or more glyphs in CIDFont resources. This comes at the expense of changing the FDArray indexes, at least for the example that was used. I noted that this is not a particularly important issue, but I felt that some clarification was necessary, thus the topic of today’s CJK Type Blog post.
What matters is the assignment of CIDs to FDArray elements (by name) and their associated hinting parameters and other attributes, and these are unchanged even if the FDArray index changes. When the “first one wins” principle is invoked, it means that two or more CIDFont resources include a glyph for the same CID, and the one that is used in the resulting CIDFont resource is the one that is first encountered, as specified by the order of the merge fonts on the command line. However, there are very useful command-line options that allow one to exclude (or include) CIDs so that the FDArray indexes can be preserved, if that is important to you.
In the previous post, I specified the following two steps for injecting the corrected glyphs into the original CIDFont resource:
% tx -t1 KozGoPr6N-Medium.otf cidfont.orig
% mergeFonts cidfont.ps cidfont-26+1200.ps cidfont.orig
There are two very useful command-line options available to the mergeFonts tool, “-g” and “-gx,” which are inverses of each another. The first one is used to specify glyphs to be included from the first merge font, and the second one is used to specifiy glyphs to be excluded from the first merge font. In the second command line above, “cidfont-26+1200.ps” represents the first merge font.
If we were to simply transpose the two merge fonts in the second command line, it would result in the corrected glyphs in “cidfont-26+1200.ps” being ignored, due to the “first one wins” principle. However, if we were to add the “-gx 26,1200” command-line option and argument, the “first one wins” principle no longer applies, at least for CIDs 26 and 1200. (CID+0 would be ignored, but that’s okay, because every CIDFont resource must include this particular glyph.) Thus, the following altered form of the second command line would preserve the FDArray indexes of the original font:
% mergeFonts -gx 26,1200 cidfont.ps cidfont.orig cidfont-26+1200.ps
In other words, CID+26 would be assigned to FDArray index 12, and CID+1200 would be assigned to FDArray index 11, which are the FDArray index assignments of these CIDs in the original CIDFont resource (“cidfont.orig”).
Lastly, I would like to go on record to state that the technique described in this post is better than that described in the previous post, in terms of the merge fonts order and invoking the “-gx” option.