📄 ttf2pk.doc
字号:
ttf2tfm -- TrueType to TFM converterttf2pk -- TrueType to PK converter====================================These two auxiliary programs make TrueType fonts usable with TeX.ttf2tfm extracts the metric and kerning information of a TrueType fontand converts it into metric files usable by TeX (quite similar toafm2tfm which is part of the dvips package). ttf2pk rasterizes theglyph outlines of a TrueType font into a bitmap font in PK format.Since a TrueType font often contains more than 256 glyphs, some meansare necessary to map a subset of the TrueType glyphs into a TeX font.To do this, two mapping tables are needed: the first maps from theTrueType font to a raw TeX font (this mapping table is used both byttf2tfm and ttf2pk), and the second maps from the raw TeX font toanother (virtual) TeX font providing all kerning and ligatureinformation needed by TeX.We sometimes refer to this first map as the `input' or `raw' map, andto the second as the `output' or `virtual' map.This two stage mapping has the advantage that one raw font can beaccessed with various TeX encodings (e.g. T1 and OT1) via the virtualfont mechanism, and just one PK file is necessary.For CJKV fonts, a different mechanism is provided (see section`Subfont definition files' below). Additionally, rotated glyphs forpseudo-vertical writing are supported -- if possible, vertical glyphpresentation forms are used from the font's GSUB table.ttf2tfm=======Usage: ttf2tfm FILE[.ttf|.ttc] [OPTION]... [FILE[.tfm]]Options (default values are given in brackets):-c REAL use REAL for height of small caps made with -V [0.8]-e REAL widen (extend) characters by a factor of REAL [1.0]-E INT select INT as the TTF encoding ID [1]-f INT select INT as the font index in a TTC [0]-l create 1st/2nd byte ligatures in subfonts-L LIGFILE[.sfd] create 1st/2nd byte ligatures in subfonts using LIGFILE-n use PS names of TrueType font-N use only PS names and no cmap-O use octal for all character codes in the vpl file-p ENCFILE[.enc] read ENCFILE for the TTF->raw TeX mapping-P INT select INT as the TTF platform ID [3]-q suppress informational output-r OLDNAME NEWNAME replace glyph name OLDNAME with NEWNAME-R RPLFILE[.rpl] read RPLFILE containing glyph replacement names-s REAL oblique (slant) characters by REAL, usually <<1 [0.0]-t ENCFILE[.enc] read ENCFILE for the encoding of the vpl file-T ENCFILE[.enc] equivalent to -p ENCFILE -t ENCFILE-u output only characters from encodings, nothing extra-v FILE[.vpl] make a VPL file for conversion to VF-V SCFILE[.vpl] like -v, but synthesize smallcaps as lowercase-w generate subfont enc. vectors containing glyph indices-x rotate subfont glyphs by 90 degrees-y REAL move rotated glyphs down by a factor of REAL [0.25]--help print this message and exit--version print version number and exitThe usage is very similar to afm2tfm. Please consult the dvips infofile for more details on the various parameters. Here we willconcentrate on the differences between afm2tfm and ttf2tfm.cmaps-----Contrary to Type 1 PostScript fonts (but similar to the new CID-keyedPostScript fonts), most TrueType fonts have more than one nativemapping table, also called `cmap', which maps the (internal) TTF glyphindices to the (external) TTF character codes. Common examples are amapping table to Unicode encoded character positions and the standardMacintosh mapping. To specify this TrueType mapping table, use theoptions `-P' and `-E'. With `-P' you specify the platform ID; definedvalues are: platform platform ID (pid) ---------------------------------- Apple Unicode 0 Macintosh 1 ISO 2 Microsoft 3The encoding ID depends on the platform. For pid=0, we ignore the`-E' parameter (setting it to zero) since the mapping table is alwaysUnicode version 2.0. For pid=1, the following table lists the definedvalues: 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 32Here are the ISO encoding IDs: platform ID = 2 encoding encoding ID ---------------------------- ASCII 0 ISO 10646 1 ISO 8859-1 2And finally, the Microsoft encoding IDs: platform ID = 3 encoding encoding ID --------------------------- Symbol 0 Unicode 2.0 1 Shift JIS 2 GB 2312 (1980) 3 Big 5 4 KSC 5601 (Wansung) 5 KSC 5601 (Johab) 6 UCS-4 10The program will abort if you specify an invalid platform/encoding IDpair. It will then show the possible pid/eid pairs. Please note thatmost fonts have at most two or three cmaps, usually corresponding tothe 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 somefonts exist (mostly Asian fonts) which have a (3,1) cmap not encodedin Unicode. The reason for this strange behavior is the fact thatsome old MS Windows versions will reject fonts having a non-Unicodecmap (since all non-Unicode Microsoft encoding IDs are for Asianspecific MS Windows versions).The `-P' and `-E' options to ttf2tfm must be equally specified forttf2pk; the corresponding parameters in a map file are `Pid' and`Eid', respectively.The default pid/eid pair is (3,1).If you use the `-N' switch, all cmaps are ignored, using only thePostScript names in the TrueType font. The corresponding option in amap file is `PS=Only'.If you use the `-n' switch, the default glyph names built into ttf2tfmare replaced with the PS glyph names found in the font. In many casesthis is not what you want because the glyph names in the font areoften incorrect or non-standard. The corresponding option in a mapfile is `PS=Yes'.input and output encodings--------------------------You must specify the encoding vectors from the TrueType font to theraw TeX font and from the raw TeX font to the virtual TeX font exactlyas with afm2tfm, but you have more possibilities to address thecharacter codes. [With `encoding vector' a mapping table with 256entries in form of a PostScript vector is meant; see the file`T1-WGL4.enc' of this package for an example.] With afm2tfm, you mustaccess each glyph with its Adobe glyph name, e.g. `/quotedsingle' or`/Acircumflex'. This has been extended with ttf2tfm; now you can (andsometimes must) access the code points and/or glyphs directly usingthe following syntax for specifying the character position in decimal,octal, or hexadecimal notation: `/.c<decimal-number>',`/.c0<octal-number>', or `/.c0x<hexadecimal-number>'. Examples:`/.c72', `/.c0646', `/.c0x48'. To access a glyph index directly, usethe character `g' instead of `c' in the just introduced notation.Example: `/.g0x32'.[Note: The `.cXXX' notation makes no sense if `-N' is used.]Another possibility is to use the `-r old-glyphname new-glyphname'switch to rename a glyph. Example: ttf2tfm ... -r .g0xc7 dotlessi -r hungarumlaut dblacute ...Nevertheless, it is not allowed to use the `.gXXX' or `.cXXX' glyphname construct for `new-glyphname'.Alternatively, you can collect such replacement pairs in a file whichshould have `.rpl' as extension, using the `-R' option. The syntax issimple: Each line contains a pair `old-glyphname new-glyphname'separated by whitespace (without the quotation marks). The percentsign starts a line comment; you can continue a line with a backslashas the last character. An example for a replacement file is `VPS.rpl'(to be used in conjunction with `t5.enc' for Vietnamese) which ispart of this package.The `-r' and `-R' switches are ignored for subfonts or if no encodingtables are specified. For ttf2pk, the corresponding option to `-R' is`Replacement'. Single replacements are directly given asold_glyphname=newglyphname in a map file.For pid/eid pairs (1,0) and (3,1), both ttf2tfm and ttf2pk recognizebuilt-in default Adobe glyph names; the former pair follows the namesgiven in Appendix E of the book `Inside Macintosh', volume 6, thelatter uses the names given in the TrueType Specification (WGL4, aUnicode subset). Note that Adobe glyph names are not unique and dosometimes differ: E.g., many PS fonts have the glyph `mu', whereasthis glyph is called `mu1' in the WGL4 character set to distinguish itfrom the real Greek letter mu. You can find those mapping tables inthe source code file `ttfenc.c'. Be also aware that OpenType(i.e. TrueType 2.0) fonts use an updated WGL4 table; we use the datafrom the latest published TrueType specification (1.66).On the other hand, the switches `-n' and `-N' make ttf2tfm read in anduse the PostScript names in the TrueType font itself (stored in thefont's `post' table) instead of the default Adobe glyph names.If you don't select an input encoding, the first 256 glyphs of theTrueType font with a valid entry in the selected cmap will be mappedto the TeX raw font (without the `-q' option ttf2tfm prints thismapping table to standard output), followed by all glyphs not yetaddressed in the selected cmap. However, some code points for the(1,0) pid/eid pair are omitted since they do not represent glyphsuseful for TeX: 0x00 (null), 0x08 (backspace), 0x09 (horizontaltabulation), 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 TrueTypefont with a valid PostScript name will be used in case no inputencoding is specified. Again, some glyphs are omitted: `.notdef',`.null', and `nonmarkingreturn'.If you don't select an output encoding, ttf2tfm uses the same mappingtable as afm2tfm would use (you can find it in the source code filetexenc.c); it corresponds to TeX typewriter text. Unused positions(either caused by empty code points in the mapping table or missingglyphs in the TrueType font) will be filled (rather arbitrarily) withcharacters present in the input encoding but not specified in theoutput encoding (without the `-q' option ttf2tfm prints the finaloutput encoding to standard output). Use the `-u' option if you wantonly glyphs in the virtual font which are defined in the outputencoding file, and nothing more.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -