April 2024 | ||||||
Mo | Tu | We | Th | Fr | Sa | Su |
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 |
Since a TrueType font often contains more than 256 glyphs, some means are necessary to map a subset of the TrueType glyphs onto a TeX font. To do this, two mapping tables are needed: the first (called `input' or `raw' encoding) maps the TrueType font to a raw TeX font (this mapping table is used by both ttf2tfm and ttf2pk), and the second (called `output' or `virtual' encoding) maps the raw TeX font to another (virtual) TeX font, providing all kerning and ligature information needed by TeX.
This two stage mapping has the advantage that one raw font can be accessed with various LaTeX encodings (e.g. T1 and OT1) via the virtual font mechanism, and just one file is necessary.
For CJKV (Chinese/Japanese/Korean/old Vietnamese) fonts, a different mechanism is provided (see SUBFONT DEFINITION FILES below).
If no file name is given, the name of the file is used, including the full path and replacing the extension with `
To specify a TrueType mapping table, use the options -P and -E. With -P you specify the platform ID; defined values are:
platform platform ID (pid)
Apple Unicode 0
Macintosh 1
ISO 2
Microsoft 3
The encoding ID depends on the platform. For pid=0, we ignore the -E parameter (setting it to zero) since the mapping table is always Unicode version 2.0. For pid=1, the following table lists the defined values:
platform ID = 1
script encoding ID (eid)
Roman 0
Japanese 1
Chinese 2
Korean 3
Arabic 4
Hebrew 5
Greek 6
Russian 7
Roman Symbol 8
Devanagari 9
Gurmukhi 10
Gujarati 11
Oriya 12
Bengali 13
Tamil 14
Telugu 15
Kannada 16
Malayalam 17
Sinhalese 18
Burmese 19
Khmer 20
Thai 21
Laotian 22
Georgian 23
Armenian 24
Maldivian 25
Tibetan 26
Mongolian 27
Geez 28
Slavic 29
Vietnamese 30
Sindhi 31
Uninterpreted 32
Here are the ISO encoding IDs:
platform ID = 2
encoding encoding ID (eid)
ASCII 0
ISO 10646 1
ISO 8859-1 2
And finally, the Microsoft encoding IDs:
platform ID = 3
encoding encoding ID (eid)
Symbol 0
Unicode 2.0 1
Shift JIS 2
GB 2312 (1980) 3
Big 5 4
KS X 1001 (Wansung) 5
KS X 1001 (Johab) 6
UCS-4 10
The program will abort if you specify an invalid platform/encoding ID pair. It will then show the possible pid/eid pairs. Please note that most fonts have at most two or three cmaps, usually corresponding to the pid/eid pairs (1,0), (3,0), or (3,1) in case of Latin based fonts. Valid Microsoft fonts should have a (3,1) mapping table, but some fonts exist (mostly Asian fonts) which have a (3,1) cmap not encoded in Unicode. The reason for this strange behavior is the fact that some old MS Windows versions will reject fonts having a non-(3,1) cmap (since all non-Unicode Microsoft encoding IDs are for Asian MS Windows versions).
The -P and -E options of ttf2tfm must be equally specified for ttf2pk; the corresponding parameters in a map file are `Pid' and `Eid', respectively.
The default pid/eid pair is (3,1).
Similarly, an -f option must be specified as `Fontindex' parameter in a map file.
If you use the -N switch, all cmaps are ignored, using only the PostScript names in the TrueType font. The corresponding option in a map file is `PS=Only'. If you use the -n switch, the default glyph names built into ttf2tfm are replaced with the PS glyph names found in the font. In many cases this is not what you want because the glyph names in the font are often incorrect or non-standard. The corresponding option in a map file is `PS=Yes'.
Single replacement glyph names specified with -r must be given directly as `old-glyphname new-glyphname' in a map file; -R is equivalent to the `Replacement' option.
For pid/eid pairs (1,0) and (3,1), both ttf2tfm and ttf2pk recognize built-in default Adobe glyph names; the former follows the names given in Appendix E of the book `Inside Macintosh', volume 6, the latter uses the names given in the TrueType Specification (WGL4, a Unicode subset). Note that Adobe names for a given glyph are often not unique and do sometimes differ, e.g., many PS fonts have the glyph `mu', whereas this glyph is called `mu1' in the WGL4 character set to distinguish it from the real Greek letter mu. Be also aware that OpenType (i.e. TrueType 2.0) fonts use an updated WGL4 table; we use the data from the latest published TrueType specification (1.66). You can find those mapping tables in the source code file
On the other hand, the switches -n and -N makes ttf2tfm read in and use the PostScript names in the TrueType font itself (stored in the `post' table) instead of the default Adobe glyph names.
Use the -r switch to remap single glyph names and -R to specify a file containing replacement glyph name pairs.
If you don't select an input encoding, the first 256 glyphs of the TrueType font with a valid entry in the selected cmap will be mapped to the TeX raw font (without the -q option, ttf2tfm prints this mapping table to standard output), followed by all glyphs not yet addressed in the selected cmap. However, some code points for the (1,0) pid/eid pair are omitted since they do not represent glyphs useful for TeX: 0x00 (null), 0x08 (backspace), 0x09 (horizontal tabulation), 0x0d (carriage return), and 0x1d (group separator). The `invalid character' with glyph index 0 will be omitted too.
If you select the -N switch, the first 256 glyphs of the TrueType font with a valid PostScript name will be used in case no input encoding is specified. Again, some glyphs are omitted: `.notdef', `.null', and `nonmarkingreturn'.
If you don't select an output encoding, ttf2tfm uses the same mapping table as afm2tfm would use (you can find it in the source code file it corresponds to TeX typewriter text. Unused positions (either caused by empty code points in the mapping table or missing glyphs in the TrueType font) will be filled (rather arbitrarily) with characters present in the input encoding but not specified in the output encoding (without the -q option ttf2tfm prints the final output encoding to standard output). Use the -u option if you want only glyphs in the virtual font which are defined in the output encoding file, and nothing more.
One feature missing in afm2tfm has been added which is needed by LaTeX's T1 encoding: ttf2tfm will construct the glyph `Germandbls' (by simply concatenating two `S' glyphs) even for normal fonts if possible. It appears in the glyph list as the last item, marked with an asterisk. Since this isn't a real glyph it will be available only in the virtual font.
For both input and output encoding, an empty code position is represented by the glyph name `/.notdef'.
In encoding files, you can use `\' as the final character of a line to indicate that the input is continued on the next line. The backslash and the following newline character will be removed.
A subfont file name usually consists of a prefix, a subfont infix, and a postfix (which is empty in most cases), e.g.
ntukai23 → prefix: ntukai, infix: 23, postfix: (empty)
Here the syntax of a line in an file, describing one subfont:
A line can be continued on the next line with a backslash ending the line. The ranges must not overlap; offsets have to be in the range 0-255.
Example:
The line
assigns to the code positions 10, 11, 12, and 13 of the subfont having the infix `03' the character codes 0x2349, 0x2345, 0x2346, and 0x2347 respectively.
The files in the distribution are customized for the CJK package for LaTeX.
You have to embed the file name into the font name (at the place where the infix will appear) surrounded by two `@' signs, on the command line resp. a map file; both ttf2tfm and ttf2pk switch then to subfont mode.
It is possible to use more than a single file by separating them with commata and no whitespace; for a given subfont, the first file is scanned for an entry, then the next file, and so on. Later entries override entries found earlier (possibly only partially). For example, the first file sets up range 0x10-0xA0, and the next one modifies entries 0x12 and 0x25. As can be easily seen, this algorithm allows for adding and replacing, but not for removing entries.
Subfont mode disables the options -n, -N, -p, -r, -R, -t, -T, -u, -v, -V and -w for ttf2tfm; similarly, no `Encoding' or `Replacement' parameter is allowed in a map file. Single replacement glyph names are ignored too.
ttf2tfm will create all subfont files specified in the files (provided the subfont contains glyphs) in one run.
Example:
The call
will use and producing all subfont files etc.
As a last resort, both programs can be compiled without a search library; the searched files must be then in the current directory or specified with a path. Default extensions will be appended also (with the exception that only ` is appended and not `
Here is a table of the file type and the corresponding kpathsea variables. and are program specific environment variables introduced in kpathsea version 3.2:
And here the same for pre-3.2-versions of kpathsea:
Finally, the same for pre-3.0-versions (as used e.g. in teTeX 0.4):
Please consult the info files of kpathsea for details on these variables. The decision whether to use the old or the new scheme will be done during compilation.
You should set the variable to the directory where your configuration file resides.
Here is the proper command to find out to which value a kpathsea variable is set (we use as an example). This is especially useful if a variable isn't set in or in the environment, thus pointing to the default value which is hard-coded into the kpathsea library.
We select the program name also since it is possible to specify variables which are searched only for a certain program -- in our example it would be
A similar but not identical method is to say
[A full list of format types can be obtained by saying ` on the command line prompt.] This is exactly how ttf2tfm (and ttf2pk) searches for files; the disadvantage is that all variables are expanded which can cause very long strings.
If one of the variables isn't set, a warning message is emitted. The current directory will always be searched. As usual, one exclamation mark appended to a directory path causes subdirectories one level deep to be searched, two exclamation marks cause all subdirectories to be searched. Example:
Constructions like ` aren't possible.
The optimal solution is to increase the value of max_header_bytes in the file (and probably too) to, say, 400 and recompile vptovf (and pltotf). Otherwise you'll get some (harmless) error messages like