The AFDKO ‘tx’ Tool

Among the many excellent and powerful tools included in AFDKO (Adobe Font Development Kit for OpenType) is one with a two-letter name: tx. Although it has the shortest name, it is arguably one of the most powerful AFDKO tools.

The tx tool is best thought of as a multi-purpose font-file–manipulation tool. For those who don’t leverage this tool in the font development activities, I strongly encourage you to explore its capabilities, which is best done by perusing its built-in help and through experimentation.

Executing this tool using the “-u” or “-h” command-line options provides basic help and usage information, but specifying the “-h” command-line option after a command-line option that invokes a particular mode, such as “-t1″ or “-cff,” additional mode-specific documentation is displayed. For example, consider the following command line:

% tx -t1 -h

The subr-check.pl and fdarray-check.pl tools that were introduced in the February 3, 2012 and February 29, 2012 CJK Type Blog articles, respectively, are driven by the tx tool.

If no mode is specified, the text-dump mode is assumed, which can be explicitly specified with the “-dump” command-line option. This mode is useful to view high-level font information, private dictionary information, glyph names, and even human-readable charstrings. What information is presented depends on the level that is specified, which can range from “-0″ through “-6″ (“-1″ is the default if no level is specified). For example, I can display the human-readable charstring for CID+1200 by using the following command line:

% tx -6 -g 1200 KozGoPr6N-Bold.otf
tx: --- KozGoPr6N-Bold.otf
## glyph[tag] {cid,iFD,LanguageGroup,path}
glyph[1200] {1200,11,1,
  1000 width
  324 455 hstem
  36 966 vstem
  36 324 move
  966 324 line
  966 455 line
  36 455 line
  endchar}

The “-pdf” command-line option invokes PDF mode, which is most useful for producing a glyph synopsis in the form of a PDF file. If the “-g” command-line option is not specified, all of the glyphs in the specified font file are included in the glyph synopsis. The “-g” command-line option can be used to specify specific glyphs or glyph ranges, such as the following, which produces a glyph synopsis that includes all of the kanji glyphs in the Adobe-Japan1-6 ROS KozGoPr6N-Heavy.otf OpenType/CFF font:

% tx -pdf -g 656,1125-7477,7633-7886,7961-8004,8266,8267,8284,8285,8359-8717,13320-15443,16779-20316,21071-23057 KozGoPr6N-Heavy.otf glyphs.pdf

The “-afm” command-line option invokes AFM mode, and produces an AFM file.

The “-t1″ command-line option deserves some explanation, because it supports both name- and CID-keyed fonts. It is possible to convert a CID-keyed font into a name-keyed font by additionally specifying the “-decid” command-line option. If the specified glyphs span more than one FDArray element, the “-usefd” command-line option, along with an FDArray index as its argument, must also be specified. The resulting Type 1 name-keyed font includes glyphs that are named according to their CID, specifically “cid” followed by one to five decimal digits, such as “cid1200″ for CID+1200.

The tx tool can operate on a wide variety of font files, such as Type 1 fonts, CIDFont resources, CFFs, OpenType/CFF fonts (it references only the ‘CFF‘ table), and even TrueType fonts.

I could go on and on…

If you are an avid AFDKO user, and even if you are not, and have not yet explored the capabilities of the tx tool, I suggest that you take the opportunity to do so. You are likely to find a capability that can save you a lot of time and effort. What I have described above is merely the tip of the proverbial iceberg.

Comments are closed.