1 .\" man page for ttf2tfm
3 .TH TTF2TFM 1 15-Aug-1999 "FreeType version 1.3"
5 ttf2tfm \- build TeX metric files from a TrueType font
12 .IR ttffile [ .ttf | .ttc ]
14 .BI -c \ \%caps-height-factor\c
17 .BI -e \ \%extension-factor\c
20 .BI -E \ \%encoding-id\^\c
23 .BI -f \ \%font-index\c
39 .IR \%inencfile [ .enc ]\c
42 .BI -P \ \%platform-id\^\c
48 .BI -r \ \%old-glyphname\ \%new-glyphname\c
52 .IR \%replacement-file [ .rpl ]\c
55 .BI -s \ \%slant-factor\c
59 .IR \%outencfile [ .enc ]\c
63 .IR \%inoutencfile [ .enc ]\c
70 .IR \%vplfile [ .vpl ]\c
74 .IR \%scvplfile [ .vpl ]\c
80 .BI -y \ \%vertical-shift-factor\c
83 .IR \%tfmfile [ .tfm ]\c
87 .B "ttf2tfm --version"
96 .\" ==== macro definitions
99 .\" here we define \TeX for troff and nroff
100 .if t .ds TX \fRT\\h'-0.1667m'\\v'0.20v'E\\v'-0.20v'\\h'-0.125m'X\fP
103 .\" and here the same for \LaTeX
106 .ds LX \fRL\h'-0.36m'\v'-0.15v'\s-3A\s0\h'-0.15m'\v'0.15v'\fP\*(TX
107 .el .ds LX \fRL\h'-0.36m'\v'-0.22v'\s-2A\s0\h'-0.15m'\v'0.22v'\fP\*(TX
112 .\" note that we need \vareps for TeX instead of \eps which can only be
113 .\" accessed with the \N escape sequence (in the Math Italic font)
115 .ie '\*(.T'dvi' .ds LE \*(LX\h'0.15m'2\v'0.20v'\f(MI\N'34'\fP\v'-0.20v'
116 .el .ds LE \*(LX\h'0.15m'2\v'0.20v'\(*e\v'-0.20v'
118 .if n .ds LE LaTeX\ 2e
120 .\" a typewriter font
123 \fC\\$1\fP\\$2\fC\\$3\fP\\$4
133 .\" ==== end of macro definitions
139 This program extracts the metric and kerning information of a TrueType
140 font and converts it into metric files usable by \*(TX
145 package; please consult its info files for more details on the various
146 parameters (especially encoding files).
148 Since a TrueType font often contains more than 256\ glyphs, some means
149 are necessary to map a subset of the TrueType glyphs into a \*(TX
151 To do this, two mapping tables are needed: the first (called `input' or
152 `raw' encoding) maps the TrueType font to a raw \*(TX font (this mapping
153 table is used by both
157 and the second (called `output' or `virtual' encoding) maps the raw \*(TX
158 font to another (virtual) \*(TX
159 font, providing all kerning and ligature information needed by \*(TX.
161 This two stage mapping has the advantage that one raw font can be
162 accessed with various \*(TX
163 encodings (e.g.\ T1 and OT1) via the virtual font mechanism, and just
168 For CJKV (Chinese/Japanese/Korean/old Vietnamese) fonts, a different
169 mechanism is provided (see
170 .B "SUBFONT DEFINITION FILES"
175 Most of the command line switch names are the same as in
178 One or more space characters between an option and its value is mandatory;
179 options can't be concatenated.
180 For historical reasons, the first parameter can
182 be a switch but must be the font name.
184 .BI -c \ caps-height-factor
185 The height of small caps made with the
188 Default value of this real number is\ 0.8 times the height of uppercase
190 Will be ignored in subfont mode.
192 .BI -e \ extension-factor
193 The extension factor to stretch the characters horizontally.
194 Default value of this real number is\ 1.0; if less than\ 1.0, you get a
198 The TrueType encoding ID.
199 Default value of this non-negative integer is\ 1.
205 The font index in a TrueType Collection.
206 Default is the first font (index\ 0).
207 Will be ignored for ordinary TrueType fonts.
208 [TrueType collections are usually found in some CJK fonts; e.g.\ the first
209 font index specifies glyphs and metrics for horizontal writing, and the
210 second font index does the same for vertical writing.
211 TrueType collections usually have the extension `\c
215 Create ligatures in subfonts between first and second bytes of all the
216 original character codes.
217 Example: Character code\ 0xABCD maps to character position\ 123 in
219 Then a ligature in subfont\ 45 between position 0xAB and\ 0xCD pointing
220 to character\ 123 will be produced.
221 The fonts of the Korean H\*(LX
222 package use this feature.
223 Will be ignored if not in subfont mode.
226 Use PS names (of glyphs) of the TrueType font.
227 Will be ignored in subfont mode.
228 Only glyphs with a valid entry in the selected cmap are used.
231 Use only PS names of the TrueType font.
232 No cmap is used, thus the switches
236 have no effect, causing a warning message.
237 Will be ignored in subfont mode.
240 Use octal values for all character codes in the
242 file rather than names; this is useful for symbol or CJK fonts where
243 character names such as `A' are meaningless.
246 The input encoding file name for the TTF\(->raw\ \*(TX
248 This parameter has to be specified in
253 Will be ignored in subfont mode.
256 The TrueType platform ID.
257 Default value of this non-negative integer is\ 3.
266 It suppresses any informational output except warning and error
268 For CJK fonts, the output can get quite large if you don't specify
271 .BI -r \ old-glyphname\ new-glyphname
275 .IR \%new-glyphname .
276 This switch is useful if you want to give an unnamed glyph (i.e., a glyph
277 which can be represented with `.gXXX' or `.cXXX' only) a name or if you want
278 to rename an already existing glyph name.
279 You can't use the `.gXXX' or `.cXXX' glyph name constructs for
280 .IR \%new-glyphname ;
281 multiple occurrences of
284 If in subfont mode or if no encoding file is specified, this switch is
287 .BI -R \ replacement-file
288 Use this switch if you have many replacement pairs; they can be collected
289 in a file which should have `\c
292 The syntax used in such replacement files is simple: Each non-empty
293 line must contain a pair `\c
294 .IR "\%old-glyphname \%new-glyphname" '
295 separated by whitespace (without the quotation marks).
296 A percent sign starts a line comment; you can continue a line on the next
297 line with a backslash as the last character.
298 If in subfont mode or if no encoding file is specified, this switch is
301 .BI -s \ slant-factor
302 The obliqueness factor to slant the font, usually much smaller than\ 1.
303 Default of this real number is\ 0.0; if the value is larger than zero,
304 the characters slope to the right, otherwise to the left.
307 The output encoding file name for the virtual font(s).
308 Only characters in the raw \*(TX
310 Will be ignored in subfont mode.
312 .BI -T \ inoutencfile
313 This is equivalent to
318 Will be ignored in subfont mode.
321 Use only those characters specified in the output encoding, and no
325 tries to include all characters in the virtual font, even those not
326 present in the encoding for the virtual font (it puts them into
327 otherwise-unused positions, rather arbitrarily).
328 Will be ignored in subfont mode.
333 file in addition to the
336 If no output encoding file is specified,
338 uses a default font encoding (cmtt10).
339 Will be ignored in subfont mode.
344 but the virtual font generated is a pseudo small caps font obtained by
345 scaling uppercase letters by\ 0.8 (resp. the value specified with
347 to typeset lowercase.
348 This font handles accented letters and retains proper kerning.
349 Will be ignored in subfont mode.
352 Rotate all glyphs by 90 degrees counter-clockwise.
355 parameter is given, the rotated glyphs are shifted down vertically
357 Will be ignored if not in subfont mode.
359 .BI -y \ vertical-shift-factor
360 Shift down rotated glyphs by the given amount (the unit is
362 Ignored if not in subfont mode or glyphs are not rotated.
365 Shows the current version of
367 and the used file search library (e.g.
371 Shows usage information.
375 file name is given, the name of the
377 file is used, including the full path and replacing the extension with `\c
382 Contrary to Type\ 1 PostScript fonts (but similar to the new CID
383 PostScript font format), most TrueType fonts have more than one native
384 mapping table, also called `cmap', which maps the (internal) TTF glyph
385 indices to the (external) TTF character codes.
386 Common examples are a mapping table to Unicode encoded character
387 positions, and the standard Macintosh mapping.
389 To specify a TrueType mapping table, use the options
395 you specify the platform ID; defined values are:
399 .I "platform platform ID (pid)"
410 The encoding ID depends on the platform.
411 For pid=0, we ignore the
413 parameter (setting it to zero) since the mapping table is always
414 Unicode version\ 2.0.
415 For pid=1, the following table lists the defined values:
422 .I "script encoding ID (eid)"
491 Here are the ISO encoding IDs:
498 .I "encoding encoding ID (eid)"
507 And finally, the Microsoft encoding IDs:
514 .I "encoding encoding ID (eid)"
531 The program will abort if you specify an invalid platform/encoding ID
533 It will then show the possible pid/eid pairs.
534 Please note that most fonts have at most two or three cmaps, usually
535 corresponding to the pid/eid pairs (1,0), (3,0), or (3,1) in case of
537 Valid Microsoft fonts should have a (3,1) mapping table, but some
538 fonts exist (mostly Asian fonts) which have a (3,1) cmap not encoded
540 The reason for this strange behavior is the fact that some MS\ Windows
541 versions will reject fonts having a non-(3,1) cmap (since all non-Unicode
542 Microsoft encoding IDs are for Asian MS\ Windows versions).
550 must be equally specified for
552 the corresponding parameters in
554 are `Pid' and `Eid', respectively.
556 The default pid/eid pair is (3,1).
560 option must be specified as `Fontindex' parameter in
565 switch, all cmaps are ignored, using only the PostScript names in the
567 The corresponding option in
572 switch, the default glyph names built into
574 are replaced with the PS glyph names found in the font.
575 In many cases this is not what you want because the glyph names in the
576 font are often incorrect or non-standard.
577 The corresponding option in
581 Single replacement glyph names specified with
583 must be given directly as `\c
584 .IR old-glyphname = new-glyphname ';
586 is equivalent to the `Replacement' option.
589 .SH INPUT AND OUTPUT ENCODINGS
590 You must specify the encoding vectors from the TrueType font to the
592 font and from the raw \*(TX
593 font to the virtual \*(TX
596 but you have more possibilities to address the character codes.
597 [With `encoding vector' a mapping table with 256\ entries in form of a
598 PostScript vector is meant; see the file
600 of this package for an example.]
603 you must access each glyph with its Adobe glyph name, e.g.\ \c
604 \%`/quotedsingle' or \%`/Acircumflex'.
605 This has been extended with
607 now you can (and sometimes must) access the code points and/or glyphs
608 directly, using the following syntax for specifying the character position
609 in decimal, octal, or hexadecimal notation:
611 .IR <decimal-number> ',
613 .IR <octal-number> ',
615 .IR <hexadecimal-number> '.
616 Examples: \%`/.c72', \%`/.c0646', \%`/.c0x48'.
617 To access a glyph index directly, using the character `g' instead of
618 `c' in the just introduced notation.
619 Example: \%`/.g0x32'.
620 [Note: The `.cXXX' notation makes no sense if
624 For pid/eid pairs (1,0) and (3,1), both
628 recognize built-in default Adobe glyph names; the former follows the names
629 given in Appendix\ E of the book `Inside Macintosh', volume\ 6, the latter
630 uses the names given in the TrueType Specification (WGL4, a Unicode subset).
631 Note that Adobe names for a given glyph are often not unique and do
632 sometimes differ, e.g., many PS fonts have the glyph `mu', whereas this
633 glyph is called `mu1' in the WGL4 character set to distinguish it from the
634 real Greek letter mu.
635 Be also aware that OpenType (i.e. TrueType\ 2.0) fonts use an updated WGL4
636 table; we use the data from the latest published TrueType specification
638 You can find those mapping tables in the source code file
641 On the other hand, the switches
647 read in and use the PostScript names in the TrueType font itself (stored
648 in the `post' table) instead of the default Adobe glyph names.
652 switch to remap single glyph names and
654 to specify a file containing replacement glyph name pairs.
656 If you don't select an input encoding, the first 256\ glyphs of the
657 TrueType font with a valid entry in the selected cmap will be mapped
659 raw font (without the
663 prints this mapping table to standard output), followed by all glyphs
664 not yet addressed in the selected cmap.
665 However, some code points for the (1,0) pid/eid pair are omitted since
666 they do not represent glyphs useful for \*(TX:
667 0x00 (null), 0x08 (backspace), 0x09 (horizontal tabulation), 0x0d
668 (carriage return), and 0x1d (group separator).
669 The `invalid character' with glyph index\ 0 will be omitted too.
673 switch, the first 256\ glyphs of the TrueType font with a valid PostScript
674 name will be used in case no input encoding is specified.
675 Again, some glyphs are omitted: `.notdef', `.null', and
678 If you don't select an output encoding,
680 uses the same mapping table as
682 would use (you can find it in the source code file
684 it corresponds to \*(TX
686 Unused positions (either caused by empty code points in the mapping
687 table or missing glyphs in the TrueType font) will be filled (rather
688 arbitrarily) with characters present in the input encoding but not
689 specified in the output encoding (without the
693 prints the final output encoding to standard output).
696 option if you want only glyphs in the virtual font which are defined
697 in the output encoding file, and nothing more.
699 One feature missing in
701 has been added which is needed by the T1 encoding:
703 will construct the glyph `Germandbls' (by simply concatenating to `S'
704 glyphs) even for normal fonts if possible.
705 It appears in the glyph list as the last item, marked with an asterisk.
706 Since this isn't a real glyph it will be available only in the virtual
709 For both input and output encoding, an empty code position is
710 represented by the glyph name \%`/.notdef'.
712 In encoding files, you can use `\\' as the final character of a line to
713 indicate that the input is continued on the next line.
714 The backslash and the following newline character will be removed.
718 .SH SUBFONT DEFINITION FILES
719 CJKV (Chinese/Japanese/Korean/old Vietnamese) fonts usually contain several
720 thousand glyphs; to use them with \*(TX
721 it is necessary to split such large fonts into subfonts.
722 Subfont definition files (usually having the extension `\c
724 are a simple means to do this smoothly.
726 A subfont file name usually consists of a prefix, a subfont infix, and
727 a postfix (which is empty in most cases), e.g.
730 ntukai23 \(-> prefix: ntukai, infix: 23, postfix: (empty)
732 Here the syntax of a line in an
734 file, describing one subfont:
737 .I <whitespace> <infix> <whitespace> <ranges> <whitespace>
741 anything except whitespace.
742 It's best to use only alphanumerical characters.
744 .IR <whitespace> \ :=
745 space, formfeed, carriage return, horizontal and vertical tabs -- no
749 .IR "<ranges> <whitespace> <codepoint>" \ |
751 .IR "<ranges> <whitespace> <range>" \ |
753 .I <ranges> <whitespace> <offset> <whitespace> <range>
760 .IR <number> \ `_' \ <number>
767 hexadecimal (prefix `0x'), decimal, or octal (prefix `0')
769 A line can be continued on the next line with a backslash ending the line.
770 The ranges must not overlap; offsets have to be in the range 0-255.
778 .C "03 10: 0x2349 0x2345_0x2347"
781 assigns to the code positions 10, 11, 12, and\ 13 of the subfont
782 having the infix `03' the character codes 0x2349, 0x2345, 0x2346, and
787 files in the distribution are customized for the CJK package for
790 You have to embed the
794 font name (at the place where the infix will appear) surrounded by two
795 `@' signs, on the command line resp.\ the
801 switch then to subfont mode.
803 Subfont mode disables the options
804 .BR -n , \ -N , \ -p ,
805 .BR -r , \ -R , \ -t ,
806 .BR -T , \ -u , \ -v ,
811 similarly, no `Encoding' or `Replacement' parameter is allowed in
813 Single replacement glyph names are ignored too.
816 will create all subfont
818 files specified in the
820 files (provided the subfont contains glyphs) in one run.
828 .C "ttf2tfm ntukai.ttf ntukai@/usr/local/lib/ttf2tfm/Big5@"
832 .C /usr/local/lib/ttf2tfm/Big5.sfd ,
842 ttf2tfm returns 0 on success and 1 on error; warning and error
843 messages are written to standard error.
846 .SH "SOME NOTES ON FILE SEARCHING"
856 library for searching files
858 will work only on operating systems which have an MS-DOSish background, i.e.
859 MS-DOS, OS/2, Windows;
861 is specific to MS Windows).
863 As a last resort, both programs can be compiled without a search library;
864 the searched files must be then in the current directory or specified with a
866 Default extensions will be appended also (with the exception that only `\c
868 is appended and not `\c
873 Please note that older versions of
875 (<3.2) have no special means to seach for TrueType fonts and related
876 files, thus we use the paths for PostScript related stuff.
877 The actual version of kpathsea is displayed on screen if you call
886 Here is a table of the file type and the corresponding
892 are program specific environment variables introduced in
898 .C \&.ttf \ and "\ .ttc TTFONTS"
900 .C "ttfonts.map TTF2PKINPUTS"
902 .C "\&.enc TTF2PKINPUTS, TTF2TFMINPUTS"
904 .C "\&.rpl TTF2PKINPUTS, TTF2TFMINPUTS"
908 .C "\&.sfd TTF2PKINPUTS, TTF2TFMINPUTS"
910 And here the same for pre-3.2-versions of
915 .C \&.ttf \ and "\ .ttc T1FONTS"
917 .C "ttfonts.map TEXCONFIG"
919 .C "\&.enc TEXPSHEADERS"
921 .C "\&.rpl TEXPSHEADERS"
925 .C "\&.sfd TEXPSHEADERS"
927 Finally, the same for pre-3.0-versions (as used e.g. in te\*(TX\ 0.4):
931 .C \&.ttf \ and "\ .ttc DVIPSHEADERS"
933 .C "ttfonts.map TEXCONFIG"
935 .C "\&.enc DVIPSHEADERS"
937 .C "\&.rpl DVIPSHEADERS"
941 .C "\&.sfd DVIPSHEADERS"
943 Please consult the info files of
945 for details on these variables.
946 The decision whether to use the old or the new scheme will be done
951 variable to the directory where your
953 configuration file resides.
955 Here is the proper command to find out to which value a
957 variable is set (we use
960 This is especially useful if a variable isn't set in
962 or in the environment, thus pointing to the default value which is
968 .C "kpsewhich -progname=ttf2tfm -expand-var='$TTFONTS'"
970 We select the program name also since it is possible to specify
971 variables which are searched only for a certain program -- in our
975 A similar but not identical method is to say
978 .C "kpsewhich -progname=ttf2tfm -show-path='truetype fonts'"
980 [A full list of format types can be obtained by saying `\c
981 .C "kpsewhich --help" '
982 on the command line prompt.]
983 This is exactly the how
987 search for files; the disadvantage is that all variables are expanded
988 which can cause very long strings.
992 Here the list of suffixes and its related environment variables to be
1001 .C \&.ttf \ and "\ .ttc TTFONTS"
1003 .C "ttfonts.map TTFCFG"
1013 If one of the variables isn't set, a warning message is emitted.
1014 The current directory will always be searched.
1015 As usual, one exclamation mark appended to a directory path causes
1016 subdirectories one level deep to be searched, two exclamation marks causes
1017 all subdirectories to be searched.
1021 .C TTFONTS=c:\\\\fonts\\\\truetype!!;d:\\\\myfonts\\\\truetype!
1023 Constructions like `\c
1024 .C c:\\\\fonts!!\\\\truetype '
1033 have been fully integrated into
1035 Please refer to the documentation of
1037 for more details on file searching.
1043 implementations allow only 100\ bytes for the
1045 header (the limit is 1024 in the
1047 file itself): 8\ bytes for checksum and design size, 40\ bytes for the
1048 family name, 20\ bytes for the encoding, and 4\ bytes for a face byte.
1049 There remain only 28\ bytes for some additional information which is used by
1051 for an identification string (which is essentially a copy of the command
1052 line), and this limit is always exceeded.
1054 The optimal solution is to increase the value of
1055 .I \%max_header_bytes
1065 Otherwise you'll get some (harmless) error messages like
1068 .C "This HEADER index is too big for my present table size"
1070 which can be safely ignored.
1086 is part of the FreeType package, a high quality TrueType rendering
1094 Fr\('ed\('eric LOYER