cmap2enc(1) convert glyph indices in a TrueType-flavored OpenType font to


All input files are searched using kpsewhich or findtexmf when these commands are available; otherwise only the current working directory is searched.
The font file can be any OpenType font, though cmap2enc is probably only useful for the TrueType-flavored variant (PostScript-flavored ones always contain glyph names in the `CFF' table).
The encoding files read and written by cmap2enc are in standard dvips format. The name of the output encoding file is "<encoding>-<suffix>-<font>.enc",


is the name of the input encoding file (without the extension `.enc');
names the OpenType features you specified:

for tabular lining figures (when neither the `onum' nor the `pnum' features have been chosen)
for proportional width lining figures (when you've specified `pnum', but not `onum')
for tabular oldstyle figures (when you've specified `onum', but not `pnum')
for proportional width oldstyle figures (when both `onum' and `pnum' have been chosen)
for small caps (`smcp' feature)
for swash (`swsh' feature)
for a titling font (`titl' feature)
for superior figures and (some) letters (`sups' feature)
for ornaments (`ornm' feature)

When several features have been specified, the suffix is a combination of the appropriate items; e.g., when you specify -f onum,pnum,swsh (for a swash font with proportional oldstyle figures) the suffix is "osf-swash".

is the name of the input font file, without the `.ttf' or `.otf' extension.

The output mtx file is in standard fontinst format. The name of this file is "reset<font>-<encoding>-<suffix>.mtx",

where font, encoding and suffix have the same meaning as above.

The option -x can be used to name a file containing extra substitutions that complement or override the ones specified by the selected features. It consists of one substitution per line; each is either of the form "<from>;<to>", where from and to are both glyph indices (specified as four hexadecimal digits), or of the form "<glyph name>;<glyph index>", where glyph name is any glyph name and glyph index the glyph index (again, four hex digits) that is to be mapped to the specified glyph name. The examples/ subdirectory in the fontools distribution contains some examples of user-defined substitution files.


Most OpenType fonts contain several tables in the `cmap' table, for different platforms and different encodings. cmap2enc only reads the first table that implements Unicode, that is, the first table with either platformID = 0 and encodingID = 3 or 4 or platformID = 3 and encodingID = 1 or 10. At least one of those will probably always be present, and (afaik) it doesn't matter which of these is used.

The fact that only tableFormat = 4 is supported might be more of a restriction, though I haven't yet found any font that used a different tableFormat.

OpenType fonts implement features using so-called `Lookup Tables'. cmap2enc supports only features from the `GSUB' table that have LookupType = 1 (single substitution).

Some features are implemented as a combination of lookups from both the `GSUB' and the `GPOS' tables; these features are (currently?) not supported. An example of this are the `sinf' (Scientific Inferiors) and 'subs' (Subscripts) features of Linotype Palatino; these are implemented by first replacing the standard numerals with smaller ones and then adjusting their position.

Some of the font's features may yield surprising results. E.g., Linotype Palatino doesn't have small-caps forms of dotlessi, germandbls and the standard f-ligatures, so it will give you the lowercase forms of these glyphs even when the `smcp' feature is specified. (The examples/palatinox subdirectory contains a file unsetSCaps.mtx that deletes these lowercase forms; fontinst's newlatin.mtx file will then create fake small-caps forms of these glyphs.)
If the user-defined substitution file substitutes glyph1 with glyph2, cmap2enc will also substitute glyph2 with glyph2; this may seem silly, but it means that any selected feature that would substitute glyph2 with glyph3 gets overridden.
The glyph names are independent of the features selected, e.g., when using features like `smcp' or `onum', glyph names still come out as `a' and `zero' rather than `Asmall' and `zerooldstyle'. When installing the font with fontinst, you should therefore always use t1.etx rather than t1c.etx or t1j.etx.