IdentifiantMot de passe
Mot de passe oublié ?Je m'inscris ! (gratuit)

Man page 1 : cmap2enc

CMAP2ENC 1 "fontools" "2007-02-08" "fontools"

Page d'accueil du man

Cette page de documentation est issue d'une conversion automatique de
Les traductions proviennent des sites Debian, Linux Kernel et du projet Perkamon.
N'hésitez pas à laisser vos suggestions, avis ou commentaires : 12 commentaires Donner une note à l´article (5).

Article lu   fois.

Liens sociaux

Viadeo Twitter Facebook Share on Google+   


cmap2enc - convert glyph indices in a TrueType-flavored OpenType font to Adobe glyph names


cmap2enc [options] fontfile encoding


Many TrueType-flavored OpenType fonts contain no glyph names. When creating an afm file with ttf2afm, this causes all glyphs to be named something like « index0x01E7 », which makes the afm file almost useless for use with fontinst or afm2tfm.

cmap2enc uses the font's `cmap' table to map glyph indices to Unicode values, and Adobe's glyphlist.txt file to map these to glyph names.

cmap2enc creates a new encoding file (for downloading with the font file) and a mtx file (for use with fontinst). The encoding file contains the same glyphs as the original one, but has all glyph names replaced with the corresponding glyph indices; the mtx file maps these glyph indices back to the original glyph names (it consists of many commands of the form « \renameGlyph{index0x01E7}{Euro} », plus a definition of that « \renameGlyph » command).

Some of the glyph substitution features of OpenType fonts are supported; e.g. when the `smcp' (Small Caps) feature is specified, the glyph names of the lowercase glyphs will be mapped to the glyph indices of the small capitals.

A list of features supported by the font can be generated using the -p option, see below.


NOTE: the examples/ subdirectory in the fontools distribution contains several complete examples of the use of cmap2enc and other tools from the fontools collection.

- 2 To display all scripts, languages and features supported by Linotype Palatino:
cmap2enc -p pala.ttf

- 2 To install Linotype Palatino in T1 encoding, with oldstyle figures:

1. 3 Generate an encoding file t1-tosf-pala.enc and a metrics file resetpala-t1-osf.mtx:
cmap2enc -f onum pala.ttf t1.enc

2. 3 Create an afm file for the font; this is done best using font2afm (also in the fontools collection):
font2afm pala.ttf

3. 3 Reencode the afm file using the t1-tosf-pala.enc encoding to create a `raw' font rlplrj9d, with either afm2afm (also in the fontools collection) or fontinst (but be warned that fontinst might take a long time, and can even crash if the afm is really big):
afm2afm -e t1-tosf-pala.enc -o rlplrj9d.afm pala.afm

4. 3 Create a `value-added' vpl file from this raw font by adding ligatures, faking missing glyphs etc. with fontinst:
\installfont{lplrj9d}{rlplrj9d,resetpala-t1-tosf,newlatin} {t1}{T1}{lplj}{m}{n}{}


cmap2enc supports the following command-line options:

-p 4 Print some info about the font, plus a list of all scripts, languages and features contained in this font's GSUB table; then exit. (When using this option, the encoding need not be specified.)

-f feature[,feature]* 4 Use the specified features when matching glyph indices to glyph names. Multiple features can be specified as a comma-separated list, without spaces between the items.

-x extra 4 Use the user-specified substitutions from extra (see below).

-l language 4 Select the specified language. The default is `DFLT' (surprise!).

-s script 4 Select the specified script. The default is `latn'.


All input files are searched using kpsewhich or findtexmf when these commands are available; otherwise only the current working directory is searched.

fontfile 4 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).

encoding 4 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 »,

encoding 10 is the name of the input encoding file (without the extension `.enc');

suffix 10 names the OpenType features you specified:

tlf 10 for tabular lining figures (when neither the `onum' nor the `pnum' features have been chosen)

lf 10 for proportional width lining figures (when you've specified `pnum', but not `onum')

tosf 10 for tabular oldstyle figures (when you've specified `onum', but not `pnum')

osf 10 for proportional width oldstyle figures (when both `onum' and `pnum' have been chosen)

sc 10 for small caps (`smcp' feature)

swash 10 for swash (`swsh' feature)

titling 10 for a titling font (`titl' feature)

sup 10 for superior figures and (some) letters (`sups' feature)

orn 10 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 ».

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

mtx 4 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.

extra 4 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.


- 2 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.

- 2 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.

- 2 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.)

- 2 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.

- 2 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.


The other programs in the fontools bundle: afm2afm, autoinst, font2afm, ot2kpx, pfm2kpx, showglyphs.

A good free (as in beer) Perl-implementation for Windows (and Linux) is ActivePerl, available from


Marc Penninga <>

If you're sending a bug report, please give as much information as possible. Also be sure to mention the name fontools somewhere in the subject line, or risk being caught by my spam filter.


Copyright (c) 2005, 2006 Marc Penninga.


This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation.

A copy of the GNU General Public License is included with the fontools collection; see the file GPLv2.txt.


This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.


2006-01-17 12 Changed the names of the generated output files; extended the documentation.

2005-08-01 12 Removed some warning messages that didn't convey any useful information; added contents of glyphlist.txt to the program itself and removed the file from the fontools collection; expanded the example in the documentation

2005-04-29 12 Improved the documentation

2005-03-21 12 Fixed somed bugs; added `titl' feature

2005-03-15 12 Input files searched using kpsewhich or findtexmf

2005-03-08 12 Input files searched via kpsewhich (where available)

2005-02-18 12 Rewrote some of the code, fixed a few bugs

2005-01-10 12 First version

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+   

Licence Creative Commons
Le contenu de cet article est rédigé par et est mis à disposition selon les termes de la Licence Creative Commons Attribution 3.0 non transposé.
Les logos, en-tête, pied de page, css, et look & feel de l'article sont Copyright © 2013