[pdftex] new version of ttf2afm
The Thanh Han
hanthethanh at myrealbox.com
Wed Jan 26 04:59:33 CET 2005
Hi,
thank you for those who replied to my asking for comments on use of
ttf2afm.
I uploaded a new beta version of ttf2afm (djgpp & linux binaries only)
to http://pdftex.sarovar.org/djgpp/ttf2afm.zip
I also wrote a short document on how to use ttf2afm (appended below)
My primary goal of this revision is to make pdftex able to use glyphs
from truetype font via their unicode indices. I also attemped to fix a
few minor issues of ttf2afm to make the afm output a little bit better.
Comments/feature request/bug reports are much welcome.
Thanh
======================================================================
Examples how ttf2afm can be used:
1) ttf2afm arial.ttf > arial.afm
this will print the AFM output from arial.ttf to stdout (redirected to
arial.afm in the above example) as:
- all glyphs are unencoded (assgined to code -1);
- all glyphs are printed by their associated names found in the ttf font;
- glyphs which don't have an associated name or associated name as
'.notdef' are printed in form 'index123' (apart from glyph 0, which
should be the `real' .notdef).
Such an AFM is ready to use with afm2tfm, afm2pl or fontinst to make tfm/vf
needed for use with pdftex.
The option '-o' can be used to specify the output filename instead of
stdout, i.e.:
ttf2afm -o arial.afm arial.ttf
2) ttf2afm -i -o arial.afm arial.ttf
This does the same as example (1), but all glyphs are printed in form
`index123' instead of their PostScript name. Useful when dealing with fonts
when glyph names are missing or wrong.
2) ttf2afm -u -o arial.afm arial.ttf
Glyphs names are printed as 'uniABCD' (unicode) instead of `index123'. There
are a few potential problems:
- some glyphs are associated with more than 1 unicode index; in this
case a warning will be written to stderr, and the first unicode index
will be used;
- some glyphs are not associated with any unicode index; in this case
they will be printed as `index123';
- some fonts may have multiple unicode mappings; they should be
identical and ttf2afm uses the first one by default.
In case those unicode mappings are different and on wishes to select
some other mapping than the first one, this can be done using option
'-m NUM', ie
ttf2afm -u -o arial.afm -m 2 arial.ttf
will select the 2nd unicode mapping of the font (they are numbered
from 1). To find out how many unicode encodings are available inside a
font, say something like:
ttf2afm -u -o arial.afm -m 0 arial.ttf
and ttf2afm will report the valid range of '-m'
3) ttf2afm -e cork.enc -o arial.afm arial.ttf
This does the same as example (1), plus that the AFM will be encoded
according to the given encoding vector `cork.enc'. Glyphs not specified in
the encoding will get code -1. ttf2afm will warn about glyph names that are
specified in the encoding vector but missing in the fontfile. Useful when
one wishes to encode the AFM output, or simply to check whether a font
contains all glyphs of an encoding.
Glyph names in encoding vector can take form `index123' or `uniABCD'; the
meaning is hopefully obvious. In case of form `uniABCD', if the code is not
mapped to any glyph, a warning will be written to stderr. Similarly for
form `index123' with index out of valid range. pdftex should be also able
to understand this convention of glyph naming.
4) ttf2afm -c -o arial.afm arial.ttf
This is the same as example (1), plus that ttf2afm will write the mappings
inside the font to files arial.e<platformID><encodingID>. Useful when one
wishes to use some of the mapping for further processing (most likely as an
encoding vector to reencode the font by pdftex). Unicode encodings cannot
printed properly (doesn't make sense), thus all glyphs are printed as
comments.
======================================================================
More information about the pdftex
mailing list