Debian Codegraph @

texmf-dist/doc/man/man1/ttf2tfm.1

raw
1 .\" man page for ttf2tfm
2 .
3 .TH TTF2TFM 1 27-Jun-2013 "FreeType2 version"
4 .SH NAME
5 ttf2tfm \- build TeX metric files from a TrueType font
6 .SH SYNOPSIS
7 .na
8 .nh
9 .B ttf2tfm
10 'in +\n(.ku
11 .I ttffile\c
12 .RB [ .ttf | .ttc ]
13 [\c
14 .BI \-c \ \%caps-height-factor\c
15 ]
16 [\c
17 .BI \-e \ \%extension-factor\c
18 ]
19 [\c
20 .BI \-E \ \%encoding-id\^\c
21 ]
22 [\c
23 .BI \-f \ \%font-index\c
24 ]
25 [\c
26 .B \-l\c
27 ]
28 [\c
29 .B \-L\ \c
30 .IR \%ligature-file [ .sfd ]\c
31 ]
32 [\c
33 .B \-n\c
34 ]
35 [\c
36 .B \-N\c
37 ]
38 [\c
39 .B \-O\c
40 ]
41 [\c
42 .B \-p\ \c
43 .IR \%inencfile [ .enc ]\c
44 ]
45 [\c
46 .BI \-P \ \%platform-id\^\c
47 ]
48 [\c
49 .B \-q\c
50 ]
51 [\c
52 .BI \-r \ \%old-glyphname\ \%new-glyphname\c
53 ]
54 [\c
55 .B \-R\ \c
56 .IR \%replacement-file [ .rpl ]\c
57 ]
58 [\c
59 .BI \-s \ \%slant-factor\c
60 ]
61 [\c
62 .B \-t\ \c
63 .IR \%outencfile [ .enc ]\c
64 ]
65 [\c
66 .B \-T\ \c
67 .IR \%inoutencfile [ .enc ]\c
68 ]
69 [\c
70 .B \-u\c
71 ]
72 [\c
73 .B \-v\ \c
74 .IR \%vplfile [ .vpl ]\c
75 ]
76 [\c
77 .B \-V\ \c
78 .IR \%scvplfile [ .vpl ]\c
79 ]
80 [\c
81 .B \-w\c
82 ]
83 [\c
84 .B \-x\c
85 ]
86 [\c
87 .BI \-y \ \%vertical-shift-factor\c
88 ]
89 [\c
90 .IR \%tfmfile [ .tfm ]\c
91 ]
92 .br
93 .in
94 .B "ttf2tfm \-\^\-version"
95 |
96 .B \-\^\-help
97 .ad
98 .hy
99 .
100 .
101 .
102 .\" ====
103 .\" ==== macro definitions
104 .\" ====
105 .
106 .\" here we define \TeX for troff and nroff
107 .if t .ds TX T\\h'-0.1667m'\\v'0.20v'E\\v'-0.20v'\\h'-0.125m'X
108 .if n .ds TX TeX
109 .
110 .\" and here the same for \LaTeX
111 .if t \{\
112 .ie '\*(.T'dvi' \
113 .ds LX L\h'-0.36m'\v'-0.15v'\s-3A\s0\h'-0.15m'\v'0.15v'\*(TX
114 .el .ds LX L\h'-0.36m'\v'-0.22v'\s-2A\s0\h'-0.15m'\v'0.22v'\*(TX
115 .\}
116 .if n .ds LX LaTeX
117 .
118 .\" \LaTeXe
119 .\" note that we need \vareps for TeX instead of \eps which can only be
120 .\" accessed with the \N escape sequence (in the Math Italic font)
121 .if t \{\
122 .ie '\*(.T'dvi' .ds LE \*(LX\h'0.15m'2\v'0.20v'\f(MI\N'34'\fP\v'-0.20v'
123 .el .ds LE \*(LX\h'0.15m'2\v'0.20v'\(*e\v'-0.20v'
124 .\}
125 .if n .ds LE LaTeX\ 2e
126 .
127 .\" a typewriter font
128 .if t \{\
129 .de C
130 \fC\\$1\fP\\$2\fC\\$3\fP\\$4
131 ..
132 .\}
133 .if n \{\
134 .de C
135 \\$1\\$2\\$3\\$4
136 ..
137 .\}
138 .
139 .\" ====
140 .\" ==== end of macro definitions
141 .\" ====
142 .
143 .
144 .
145 .SH DESCRIPTION
146 This program extracts the metric and kerning information of a TrueType
147 font and converts it into metric files usable by \*(TX
148 (quite similar to
149 .B afm2tfm
150 which is part of the
151 .B dvips
152 package; please consult its info files for more details on the various
153 parameters (especially encoding files).
154 .PP
155 Since a TrueType font often contains more than 256\ glyphs, some means
156 are necessary to map a subset of the TrueType glyphs onto a \*(TX
157 font.
158 To do this, two mapping tables are needed: the first (called `input' or
159 `raw' encoding) maps the TrueType font to a raw \*(TX font (this mapping
160 table is used by both
161 .B ttf2tfm
162 and
163 .BR ttf2pk ),
164 and the second (called `output' or `virtual' encoding) maps the raw \*(TX
165 font to another (virtual) \*(TX
166 font, providing all kerning and ligature information needed by \*(TX.
167 .PP
168 This two stage mapping has the advantage that one raw font can be
169 accessed with various \*(LX
170 encodings (e.g.\ T1 and OT1) via the virtual font mechanism, and just
171 one
172 .C PK
173 file is necessary.
174 .PP
175 For CJKV (Chinese/Japanese/Korean/old Vietnamese) fonts, a different
176 mechanism is provided (see
177 .B "SUBFONT DEFINITION FILES"
178 below).
179 .
180 .
181 .SH PARAMETERS
182 Most of the command line switch names are the same as in
183 .B afm2tfm
184 for convenience.
185 One or more space characters between an option and its value is mandatory;
186 options can't be concatenated.
187 For historical reasons, the first parameter can
188 .I not
189 be a switch but must be the font name.
190 .TP
191 .BI \-c \ caps-height-factor
192 The height of small caps made with the
193 .B \-V
194 switch.
195 Default value of this real number is\ 0.8 times the height of uppercase
196 glyphs.
197 .IP
198 Will be ignored in subfont mode.
199 .TP
200 .BI \-e \ extension-factor
201 The extension factor to stretch the characters horizontally.
202 Default value of this real number is\ 1.0; if less than\ 1.0, you get a
203 condensed font.
204 .TP
205 .BI \-E \ encoding-id
206 The TrueType encoding ID.
207 Default value of this non-negative integer is\ 1.
208 .IP
209 Will be ignored if
210 .B \-N
211 is used.
212 .TP
213 .BI \-f \ font-index
214 The font index in a TrueType Collection.
215 Default is the first font (index\ 0).
216 [TrueType collections are usually found in some CJK fonts; e.g.\ the first
217 font index specifies glyphs and metrics for horizontal writing, and the
218 second font index does the same for vertical writing.
219 TrueType collections usually have the extension `\c
220 .C \&.ttc '.]
221 .IP
222 Will be ignored for ordinary TrueType fonts.
223 .TP
224 .B \-l
225 Create ligatures in subfonts between first and second bytes of all the
226 original character codes.
227 Example: Character code\ 0xABCD maps to character position\ 123 in
228 subfont\ 45.
229 Then a ligature in subfont\ 45 between position 0xAB and\ 0xCD pointing
230 to character\ 123 will be produced.
231 The fonts of the Korean H\*(LX
232 package use this feature.
233 Note that this option generates correct ligatures only for TrueType fonts
234 where the input cmap is identical to the output encoding.
235 In case of H\*(LX, TTFs must have platform ID\ 3 and encoding ID\ 5.
236 .IP
237 Will be ignored if not in subfont mode.
238 .TP
239 .BI \-L \ ligature-file
240 Same as
241 .BR \-l ,
242 but character codes for ligatures are specified in
243 .IR \%ligature-file .
244 For example, `\c
245 .C \-L\ \%KS-HLaTeX '
246 generates correct ligatures for the Korean H\*(LX
247 package regardless of the platform and encoding ID of the used TrueType
248 font (the file
249 .C KS-HLaTeX.sfd
250 is part of the ttf2pk package).
251 .IP
252 Ligature files have the same format and extension as
253 .C SFD
254 files.
255 This option will be ignored if not in subfont mode.
256 .TP
257 .B \-n
258 Use PS names (of glyphs) of the TrueType font.
259 Only glyphs with a valid entry in the selected cmap are used.
260 .IP
261 Will be ignored in subfont mode.
262 .TP
263 .B \-N
264 Use only PS names of the TrueType font.
265 No cmap is used, thus the switches
266 .B \-E
267 and
268 .B \-P
269 have no effect, causing a warning message.
270 .IP
271 Will be ignored in subfont mode.
272 .TP
273 .B \-O
274 Use octal values for all character codes in the
275 .C VPL
276 file rather than names; this is useful for symbol or CJK fonts where
277 character names such as `A' are meaningless.
278 .TP
279 .BI \-p \ inencfile
280 The input encoding file name for the TTF\(->raw\ \*(TX
281 mapping.
282 This parameter has to be specified in a map file
283 (default:
284 .C \%ttfonts.map )
285 recorded in
286 .C \%ttf2pk.cfg
287 for successive
288 .B ttf2pk
289 calls.
290 .IP
291 Will be ignored in subfont mode.
292 .TP
293 .BI \-P \ platform-id
294 The TrueType platform ID.
295 Default value of this non-negative integer is\ 3.
296 .IP
297 Will be ignored if
298 .B \-N
299 is used.
300 .TP
301 .B \-q
302 Make
303 .B ttf2tfm
304 quiet.
305 It suppresses any informational output except warning and error
306 messages.
307 For CJK fonts, the output can get quite large if you don't specify
308 this switch.
309 .TP
310 .BI \-r \ old-glyphname\ new-glyphname
311 Replaces
312 .I \%old-glyphname
313 with
314 .IR \%new-glyphname .
315 This switch is useful if you want to give an unnamed glyph (i.e., a glyph
316 which can be represented with `.gXXX' or `.cXXX' only) a name or if you want
317 to rename an already existing glyph name.
318 You can't use the `.gXXX' or `.cXXX' glyph name constructs for
319 .IR \%new-glyphname ;
320 multiple occurrences of
321 .B \-r
322 are possible.
323 .IP
324 If in subfont mode or if no encoding file is specified, this switch is
325 ignored.
326 .TP
327 .BI \-R \ replacement-file
328 Use this switch if you have many replacement pairs; they can be collected
329 in a file which should have `\c
330 .C \&.rpl '
331 as extension.
332 The syntax used in such replacement files is simple: Each non-empty
333 line must contain a pair `\c
334 .IR "\%old-glyphname \%new-glyphname" '
335 separated by whitespace (without the quotation marks).
336 A percent sign starts a line comment; you can continue a line on the next
337 line with a backslash as the last character.
338 .IP
339 If in subfont mode or if no encoding file is specified, this switch is
340 ignored.
341 .TP
342 .BI \-s \ slant-factor
343 The obliqueness factor to slant the font, usually much smaller than\ 1.
344 Default of this real number is\ 0.0; if the value is larger than zero,
345 the characters slope to the right, otherwise to the left.
346 .TP
347 .BI \-t \ outencfile
348 The output encoding file name for the virtual font(s).
349 Only characters in the raw \*(TX
350 font are used.
351 .IP
352 Will be ignored in subfont mode.
353 .TP
354 .BI \-T \ inoutencfile
355 This is equivalent to
356 .RB ` \-p
357 .I inoutencfile
358 .B \-t
359 .IR inoutencfile '.
360 .IP
361 Will be ignored in subfont mode.
362 .TP
363 .B \-u
364 Use only those characters specified in the output encoding, and no
365 others.
366 By default,
367 .B ttf2tfm
368 tries to include all characters in the virtual font, even those not
369 present in the encoding for the virtual font (it puts them into
370 otherwise-unused positions, rather arbitrarily).
371 .IP
372 Will be ignored in subfont mode.
373 .TP
374 .BI \-v \ vplfile
375 Output a
376 .C VPL
377 file in addition to the
378 .C TFM
379 file.
380 If no output encoding file is specified,
381 .B ttf2tfm
382 uses a default font encoding (cmtt10).
383 .B Note:
384 Be careful to use different names for the virtual font and the raw font!
385 .IP
386 Will be ignored in subfont mode.
387 .TP
388 .BI \-V \ scvplfile
389 Same as
390 .BR \-v ,
391 but the virtual font generated is a pseudo small caps font obtained by
392 scaling uppercase letters by\ 0.8 (resp. the value specified with
393 .BR \-c )
394 to typeset lowercase.
395 This font handles accented letters and retains proper kerning.
396 .IP
397 Will be ignored in subfont mode.
398 .TP
399 .B \-w
400 Generate PostScript encoding vectors containing glyph indices, primarily
401 used to embed TrueType fonts in pdf\*(TX.
402 .B ttf2tfm
403 takes the
404 .C TFM
405 names and replaces the suffix with
406 .C \&.enc ;
407 that is, for files
408 .C foo01.tfm ,
409 .C foo02.tfm ,\ \&.\|.\|.\&
410 it creates
411 .C foo01.enc ,
412 .C foo02.enc ,\ \&.\|.\|.\|\&
413 at the same place.
414 .IP
415 Will be ignored if not in subfont mode.
416 .TP
417 .B \-x
418 Rotate all glyphs by 90 degrees counter-clockwise.
419 If no
420 .B \-y
421 parameter is given, the rotated glyphs are shifted down vertically
422 by\ 0.25em.
423 .IP
424 Will be ignored if not in subfont mode.
425 .TP
426 .BI \-y \ vertical-shift-factor
427 Shift down rotated glyphs by the given amount (the unit is
428 .IR em ).
429 .IP
430 Ignored if not in subfont mode or glyphs are not rotated.
431 .TP
432 .B \-\^\-version
433 Shows the current version of
434 .B ttf2tfm
435 and the used file search library (e.g.
436 .BR kpathsea ).
437 .TP
438 .B \-\^\-help
439 Shows usage information.
440 .PP
441 If no
442 .C TFM
443 file name is given, the name of the
444 .C TTF
445 file is used, including the full path and replacing the extension with `\c
446 .C \&.tfm '.
447 .
448 .
449 .SH CMAPS
450 Contrary to Type\ 1 PostScript fonts (but similar to the new CID
451 PostScript font format), most TrueType fonts have more than one native
452 mapping table, also called `cmap', which maps the (internal) TTF glyph
453 indices to the (external) TTF character codes.
454 Common examples are a mapping table to Unicode encoded character
455 positions, and the standard Macintosh mapping.
456
457 To specify a TrueType mapping table, use the options
458 .B \-P
459 and
460 .BR \-E .
461 With
462 .B \-P
463 you specify the platform ID; defined values are:
464 .PP
465 .TS
466 l l.
467 \fIplatform\fP \fIplatform ID (pid)\fP
468 _
469 Apple Unicode 0
470 Macintosh 1
471 ISO 2
472 Microsoft 3
473 .TE
474 .PP
475 The encoding ID depends on the platform.
476 For pid=0, we ignore the
477 .B \-E
478 parameter (setting it to zero) since the mapping table is always
479 Unicode version\ 2.0.
480 For pid=1, the following table lists the defined values:
481 .PP
482 .RS
483 platform ID = 1
484 .RE
485 .TS
486 l l.
487 \fIscript\fP \fIencoding ID (eid)\fP
488 _
489 Roman 0
490 Japanese 1
491 Chinese 2
492 Korean 3
493 Arabic 4
494 Hebrew 5
495 Greek 6
496 Russian 7
497 Roman Symbol 8
498 Devanagari 9
499 Gurmukhi 10
500 Gujarati 11
501 Oriya 12
502 Bengali 13
503 Tamil 14
504 Telugu 15
505 Kannada 16
506 Malayalam 17
507 Sinhalese 18
508 Burmese 19
509 Khmer 20
510 Thai 21
511 Laotian 22
512 Georgian 23
513 Armenian 24
514 Maldivian 25
515 Tibetan 26
516 Mongolian 27
517 Geez 28
518 Slavic 29
519 Vietnamese 30
520 Sindhi 31
521 Uninterpreted 32
522 .TE
523 .PP
524 Here are the ISO encoding IDs:
525 .PP
526 .RS
527 platform ID = 2
528 .RE
529 .TS
530 l l.
531 \fIencoding\fP \fIencoding ID (eid)\fP
532 ASCII 0
533 ISO 10646 1
534 ISO 8859-1 2
535 .TE
536 .PP
537 And finally, the Microsoft encoding IDs:
538 .PP
539 .RS
540 platform ID = 3
541 .RE
542 .TS
543 l l.
544 \fIencoding\fP \fIencoding ID (eid)\fP
545 Symbol 0
546 Unicode 2.0 1
547 Shift JIS 2
548 GB 2312 (1980) 3
549 Big 5 4
550 KS X 1001 (Wansung) 5
551 KS X 1001 (Johab) 6
552 UCS-4 10
553 .TE
554 .PP
555 The program will abort if you specify an invalid platform/encoding ID
556 pair.
557 It will then show the possible pid/eid pairs.
558 Please note that most fonts have at most two or three cmaps, usually
559 corresponding to the pid/eid pairs (1,0), (3,0), or (3,1) in case of
560 Latin based fonts.
561 Valid Microsoft fonts should have a (3,1) mapping table, but some
562 fonts exist (mostly Asian fonts) which have a (3,1) cmap not encoded
563 in Unicode.
564 The reason for this strange behavior is the fact that some old
565 MS\ Windows versions will reject fonts having a non-(3,1) cmap (since
566 all non-Unicode Microsoft encoding IDs are for Asian MS\ Windows
567 versions).
568 .PP
569 The
570 .B \-P
571 and
572 .B \-E
573 options of
574 .B ttf2tfm
575 must be equally specified for
576 .BR ttf2pk ;
577 the corresponding parameters in a map file are `Pid' and `Eid',
578 respectively.
579 .PP
580 The default pid/eid pair is (3,1).
581 .PP
582 Similarly, an
583 .B \-f
584 option must be specified as `Fontindex' parameter in a map file.
585 .PP
586 If you use the
587 .B \-N
588 switch, all cmaps are ignored, using only the PostScript names in the
589 TrueType font.
590 The corresponding option in a map file is \%`PS=Only'.
591 If you use the
592 .B \-n
593 switch, the default glyph names built into
594 .B ttf2tfm
595 are replaced with the PS glyph names found in the font.
596 In many cases this is not what you want because the glyph names in the
597 font are often incorrect or non-standard.
598 The corresponding option in a map file is \%`PS=Yes'.
599 .PP
600 Single replacement glyph names specified with
601 .B \-r
602 must be given directly as `\c
603 .IR "old-glyphname new-glyphname" '
604 in a map file;
605 .B \-R
606 is equivalent to the `Replacement' option.
607 .
608 .
609 .SH INPUT AND OUTPUT ENCODINGS
610 You must specify the encoding vectors from the TrueType font to the
611 raw \*(TX
612 font and from the raw \*(TX
613 font to the virtual \*(TX
614 font exactly as with
615 .BR afm2tfm ,
616 but you have more possibilities to address the character codes.
617 [With `encoding vector' a mapping table with 256\ entries in form of a
618 PostScript vector is meant; see the file
619 .C \%T1-WGL4.enc
620 of this package for an example.]
621 With
622 .BR afm2tfm ,
623 you must access each glyph with its Adobe glyph name, e.g.\ \c
624 \%`/quotedsingle' or \%`/Acircumflex'.
625 This has been extended with
626 .BR ttf2tfm ;
627 now you can (and sometimes must) access the code points and/or glyphs
628 directly, using the following syntax for specifying the character position
629 in decimal, octal, or hexadecimal notation:
630 `/.c\c
631 .IR <decimal-number> ',
632 `/.c0\c
633 .IR <octal-number> ',
634 or `/.c0x\c
635 .IR <hexadecimal-number> '.
636 Examples: \%`/.c72', \%`/.c0646', \%`/.c0x48'.
637 To access a glyph index directly, use the character `g' instead of `c' in
638 the just introduced notation.
639 Example: \%`/.g0x32'.
640 [Note: The `.cXXX' notation makes no sense if
641 .B \-N
642 is used.]
643 .PP
644 For pid/eid pairs (1,0) and (3,1), both
645 .B ttf2tfm
646 and
647 .B ttf2pk
648 recognize built-in default Adobe glyph names; the former follows the names
649 given in Appendix\ E of the book `Inside Macintosh', volume\ 6, the latter
650 uses the names given in the TrueType Specification (WGL4, a Unicode subset).
651 Note that Adobe names for a given glyph are often not unique and do
652 sometimes differ, e.g., many PS fonts have the glyph `mu', whereas this
653 glyph is called `mu1' in the WGL4 character set to distinguish it from the
654 real Greek letter mu.
655 Be also aware that OpenType (i.e. TrueType\ 2.0) fonts use an updated WGL4
656 table; we use the data from the latest published TrueType specification
657 (1.66).
658 You can find those mapping tables in the source code file
659 .C \%ttfenc.c .
660 .PP
661 On the other hand, the switches
662 .B \-n
663 and
664 .B \-N
665 makes
666 .B ttf2tfm
667 read in and use the PostScript names in the TrueType font itself (stored
668 in the `post' table) instead of the default Adobe glyph names.
669 .PP
670 Use the
671 .B \-r
672 switch to remap single glyph names and
673 .B \-R
674 to specify a file containing replacement glyph name pairs.
675 .PP
676 If you don't select an input encoding, the first 256\ glyphs of the
677 TrueType font with a valid entry in the selected cmap will be mapped
678 to the \*(TX
679 raw font (without the
680 .B \-q
681 option,
682 .B ttf2tfm
683 prints this mapping table to standard output), followed by all glyphs
684 not yet addressed in the selected cmap.
685 However, some code points for the (1,0) pid/eid pair are omitted since
686 they do not represent glyphs useful for \*(TX:
687 0x00 (null), 0x08 (backspace), 0x09 (horizontal tabulation), 0x0d
688 (carriage return), and 0x1d (group separator).
689 The `invalid character' with glyph index\ 0 will be omitted too.
690 .PP
691 If you select the
692 .B \-N
693 switch, the first 256\ glyphs of the TrueType font with a valid PostScript
694 name will be used in case no input encoding is specified.
695 Again, some glyphs are omitted: `.notdef', `.null', and
696 `nonmarkingreturn'.
697 .PP
698 If you don't select an output encoding,
699 .B ttf2tfm
700 uses the same mapping table as
701 .B afm2tfm
702 would use (you can find it in the source code file
703 .C \%texenc.c );
704 it corresponds to \*(TX
705 typewriter text.
706 Unused positions (either caused by empty code points in the mapping
707 table or missing glyphs in the TrueType font) will be filled (rather
708 arbitrarily) with characters present in the input encoding but not
709 specified in the output encoding (without the
710 .B \-q
711 option
712 .B ttf2tfm
713 prints the final output encoding to standard output).
714 Use the
715 .B \-u
716 option if you want only glyphs in the virtual font which are defined
717 in the output encoding file, and nothing more.
718 .PP
719 One feature missing in
720 .B afm2tfm
721 has been added which is needed by \*(LX's T1 encoding:
722 .B ttf2tfm
723 will construct the glyph `Germandbls' (by simply concatenating two `S'
724 glyphs) even for normal fonts if possible.
725 It appears in the glyph list as the last item, marked with an asterisk.
726 Since this isn't a real glyph it will be available only in the virtual
727 font.
728 .PP
729 For both input and output encoding, an empty code position is
730 represented by the glyph name \%`/.notdef'.
731 .PP
732 In encoding files, you can use `\\' as the final character of a line to
733 indicate that the input is continued on the next line.
734 The backslash and the following newline character will be removed.
735 .PP
736 .
737 .
738 .SH SUBFONT DEFINITION FILES
739 CJKV (Chinese/Japanese/Korean/old Vietnamese) fonts usually contain
740 several thousand glyphs; to use them with \*(TX
741 it is necessary to split such large fonts into subfonts.
742 Subfont definition files (usually having the extension `\c
743 .C \&.sfd ')
744 are a simple means to do this smoothly.
745 .PP
746 A subfont file name usually consists of a prefix, a subfont infix, and
747 a postfix (which is empty in most cases), e.g.
748 .PP
749 .in +2m
750 ntukai23 \(-> prefix: ntukai, infix: 23, postfix: (empty)
751 .PP
752 Here the syntax of a line in an
753 .C SFD
754 file, describing one subfont:
755 .in +2m
756 .TP
757 .I <whitespace> <infix> <whitespace> <ranges> <whitespace>
758 .sp
759 .TP
760 .IR <infix> \ :=
761 anything except whitespace.
762 It is best to use only alphanumerical characters.
763 .TP
764 .IR <whitespace> \ :=
765 space, formfeed, carriage return, horizontal and vertical tabs -- no
766 newline characters.
767 .TP
768 .IR <ranges> \ :=
769 .IR "<ranges> <whitespace> <codepoint>" \ |
770 .br
771 .IR "<ranges> <whitespace> <range>" \ |
772 .br
773 .I <ranges> <whitespace> <offset> <whitespace> <range>
774 .TP
775 .IR <codepoint> \ :=
776 .I <number>
777 .br
778 .TP
779 .IR <range> \ :=
780 .IR <number> \ `_' \ <number>
781 .br
782 .TP
783 .IR <offset> \ :=
784 .IR <number> \ `:'
785 .TP
786 .IR <number> \ :=
787 hexadecimal (prefix `0x'), decimal, or octal (prefix `0')
788 .PP
789 A line can be continued on the next line with a backslash ending the line.
790 The ranges must not overlap; offsets have to be in the range 0-255.
791 .PP
792 Example:
793 .PP
794 .in +2m
795 The line
796 .PP
797 .in +4m
798 .C "03 10: 0x2349 0x2345_0x2347"
799 .PP
800 .in +2m
801 assigns to the code positions 10, 11, 12, and\ 13 of the subfont
802 having the infix `03' the character codes 0x2349, 0x2345, 0x2346, and
803 0x2347 respectively.
804 .PP
805 The
806 .C SFD
807 files in the distribution are customized for the CJK package for
808 \*(LX.
809 .PP
810 You have to embed the
811 .C SFD
812 file name into the
813 .C TFM
814 font name (at the place where the infix will appear) surrounded by two
815 `@' signs, on the command line resp.\ a map file;
816 both
817 .B ttf2tfm
818 and
819 .B ttf2pk
820 switch then to subfont mode.
821 .PP
822 It is possible to use more than a single
823 .C SFD
824 file by separating them with commata and no whitespace; for a given
825 subfont, the first file is scanned for an entry, then the next file,
826 and so on.
827 Later entries override entries found earlier (possibly only partially).
828 For example, the first
829 .C SFD
830 file sets up range 0x10-0xA0, and the next one modifies entries
831 0x12 and 0x25.
832 As can be easily seen, this algorithm allows for adding and replacing,
833 but not for removing entries.
834 .PP
835 Subfont mode disables the options
836 .BR \-n ,
837 .BR \-N ,
838 .BR \-p ,
839 .BR \-r ,
840 .BR \-R ,
841 .BR \-t ,
842 .BR \-T ,
843 .BR \-u ,
844 .BR \-v ,
845 .BR \-V
846 and
847 .B \-w
848 for
849 .BR ttf2tfm ;
850 similarly, no `Encoding' or `Replacement' parameter is allowed in
851 a map file.
852 Single replacement glyph names are ignored too.
853 .PP
854 .B ttf2tfm
855 will create all subfont
856 .C TFM
857 files specified in the
858 .C SFD
859 files (provided the subfont contains glyphs) in one run.
860 .PP
861 Example:
862 .PP
863 .in +2m
864 The call
865 .PP
866 .in +4m
867 .C "ttf2tfm ntukai.ttf ntukai@Big5,Big5-supp@"
868 .PP
869 .in +2m
870 will use
871 .C Big5.sfd
872 and
873 .C Big5-supp.sfd ,
874 producing
875 .I all
876 subfont files
877 .C ntukai01.tfm ,
878 .C ntukai02.tfm ,
879 etc.
880 .
881 .
882 .SH "RETURN VALUE"
883 ttf2tfm returns 0 on success and 1 on error; warning and error
884 messages are written to standard error.
885 .
886 .
887 .SH "SOME NOTES ON FILE SEARCHING"
888 Both
889 .B ttf2pk
890 and
891 .B ttf2tfm
892 use either the
893 .BR kpathsea ,
894 .BR emtexdir ,
895 or
896 .B MiK\*(TX
897 library for searching files
898 .RB ( emtexdir
899 will work only on operating systems which have an MS-DOSish background, i.e.
900 MS-DOS, OS/2, Windows;
901 .B Mik\*(TX
902 is specific to MS Windows).
903 .PP
904 As a last resort, both programs can be compiled without a search library;
905 the searched files must be then in the current directory or specified with a
906 path.
907 Default extensions will be appended also (with the exception that only `\c
908 .C \&.ttf '
909 is appended and not `\c
910 .C \&.ttc ').
911 .
912 .
913 .SS kpathsea
914 The actual version of kpathsea is displayed on screen if you call
915 either
916 .B ttf2pk
917 or
918 .B ttf2tfm
919 with the
920 .B \-\^\-version
921 command line switch.
922 .PP
923 Here is a table of the file type and the corresponding
924 .B kpathsea
925 variables.
926 .C TTF2PKINPUTS
927 and
928 .C TTF2TFMINPUTS
929 are program specific environment variables introduced in
930 .B kpathsea
931 version\ 3.2:
932 .PP
933 .RS
934 .TS
935 l l.
936 \&.ttf and .ttc TTFONTS
937 ttf2pk.cfg TTF2PKINPUTS
938 \&.map TTF2PKINPUTS
939 \&.enc TTF2PKINPUTS, TTF2TFMINPUTS
940 \&.rpl TTF2PKINPUTS, TTF2TFMINPUTS
941 \&.tfm TFMFONTS
942 \&.sfd TTF2PKINPUTS, TTF2TFMINPUTS
943 .TE
944 .RE
945
946 .PP
947 Please consult the info files of
948 .B kpathsea
949 for details on these variables.
950 .PP
951 You should set the
952 .C TEXMFCNF
953 variable to the directory where your
954 .C texmf.cnf
955 configuration file resides.
956 .PP
957 Here is the proper command to find out to which value a
958 .B kpathsea
959 variable is set (we use
960 .C TTFONTS
961 as an example).
962 This is especially useful if a variable isn't set in
963 .C texmf.cnf
964 or in the environment, thus pointing to the default value which is
965 hard-coded into the
966 .B kpathsea
967 library.
968 .PP
969 .RS
970 .C "kpsewhich -progname=ttf2tfm -expand-var='$TTFONTS'"
971 .RE
972 .PP
973 We select the program name also since it is possible to specify
974 variables which are searched only for a certain program -- in our
975 example it would be
976 .C TTFONTS.ttf2tfm .
977 .PP
978 A similar but not identical method is to say
979 .PP
980 .in +2m
981 .C "kpsewhich -progname=ttf2tfm -show-path='truetype fonts'"
982 .PP
983 [A full list of format types can be obtained by saying `\c
984 .C "kpsewhich --help" '
985 on the command line prompt.]
986 This is exactly how
987 .B ttf2tfm
988 (and
989 .BR ttf2pk )
990 searches for files; the disadvantage is that all variables are expanded
991 which can cause very long strings.
992 .
993 .
994 .SS emtexdir
995 Here the list of suffixes and their related environment variables to be
996 set in
997 .C autoexec.bat
998 (resp. in
999 .C config.sys
1000 for OS/2):
1001 .PP
1002 .RS
1003 .TS
1004 l l.
1005 \&.ttf and .ttc TTFONTS
1006 ttf2pk.cfg TTFCFG
1007 \&.map TTFCFG
1008 \&.enc TTFCFG
1009 \&.rpl TTFCFG
1010 \&.tfm TEXTFM
1011 \&.sfd TTFCFG
1012 .TE
1013 .RE
1014 .PP
1015 If one of the variables isn't set, a warning message is emitted.
1016 The current directory will always be searched.
1017 As usual, one exclamation mark appended to a directory path causes
1018 subdirectories one level deep to be searched, two exclamation marks cause
1019 all subdirectories to be searched.
1020 Example:
1021 .PP
1022 .in +2m
1023 .C TTFONTS=c:\\\\fonts\\\\truetype!!;d:\\\\myfonts\\\\truetype!
1024 .PP
1025 Constructions like `\c
1026 .C c:\\\\fonts!!\\\\truetype '
1027 aren't possible.
1028 .
1029 .
1030 .SS MiK\*(TX
1031 Both
1032 .B ttf2tfm
1033 and
1034 .B ttf2pk
1035 have been fully integrated into
1036 .BR MiK\*(TX .
1037 Please refer to the documentation of
1038 .B MiK\*(TX
1039 for more details on file searching.
1040 .
1041 .
1042 .SH PROBLEMS
1043 Many
1044 .B vptovf
1045 implementations allow only 100\ bytes for the
1046 .C TFM
1047 header (the limit is 1024 in the
1048 .C TFM
1049 file format itself): 8\ bytes for checksum and design size, 40\ bytes for the
1050 family name, 20\ bytes for the encoding, and 4\ bytes for a face byte.
1051 There remain only 28\ bytes for some additional information which is used by
1052 .B ttf2tfm
1053 for an identification string (which is essentially a copy of the command
1054 line), and this limit is always exceeded.
1055
1056 The optimal solution is to increase the value of
1057 .I \%max_header_bytes
1058 in the file
1059 .C vptovf.web
1060 (and probably
1061 .C pltotf.web
1062 too) to, say,\ 400
1063 and recompile
1064 .B vptovf
1065 (and
1066 .BR pltotf ).
1067 Otherwise you'll get some (harmless) error messages like
1068 .PP
1069 .in +2m
1070 .C "This HEADER index is too big for my present table size"
1071 .PP
1072 which can be safely ignored.
1073 .
1074 .
1075 .SH "SEE ALSO"
1076 .BR ttf2pk (1),
1077 .BR afm2tfm (1),
1078 .BR vptovf (1),
1079 .br
1080 the info pages for
1081 .B dvips
1082 and
1083 .B kpathsea
1084 .
1085 .
1086 .SH AVAILABILITY
1087 .B ttf2tfm
1088 is part of the FreeType\ 1 package, a high quality TrueType rendering
1089 library.
1090 .
1091 .
1092 .SH AUTHORS
1093 Werner LEMBERG
1094 .C <[email protected]>
1095 .br
1096 Fr\('ed\('eric LOYER
1097 .C <[email protected]>