📄 ttf2pk.doc
字号:
Both ttf2pk and ttf2tfm use either the kpathsea, emtexdir, or MiKTeXlibrary for searching files (emtexdir will work only on operatingsystems which have an MS-DOSish background, i.e. MS-DOS, OS/2,Windows; MiKTeX is specific to MS Windows).During compilation, you have to define HAVE_KPATHSEA, HAVE_EMTEXDIR,or MIKTEX to activate the specific file search code.As a last resort, both programs can be compiled without a searchlibrary; the searched files must be then in the current directory orspecified with a path. Default extensions will be appended also (withthe exception that only `.ttf' is appended and not `.ttc').kpathsea--------Please note that older versions of kpathsea (<3.2) have no specialmeans to search for TrueType fonts and related files, thus we use thepaths for PostScript related stuff. The actual version of kpathsea isdisplayed on screen if you call either ttf2pk or ttf2tfm with the`--version' command line switch.Here is a table of the file type and the corresponding kpathseavariables. TTF2PKINPUTS and TTF2TFMINPUTS are program specificenvironment variables introduced in kpathsea version 3.2: .ttf and .ttc TTFONTS ttf2pk.cfg TTF2PKINPUTS .map TTF2PKINPUTS .enc TTF2PKINPUTS, TTF2TFMINPUTS .rpl TTF2PKINPUTS, TTF2TFMINPUTS .tfm TFMFONTS .sfd TTF2PKINPUTS, TTF2TFMINPUTSAnd here the same for pre-3.2-versions of kpathsea: .ttf and .ttc T1FONTS ttf2pk.cfg TEXCONFIG .map TEXCONFIG .enc TEXPSHEADERS .rpl TEXPSHEADERS .tfm TFMFONTS .sfd TEXPSHEADERSFinally, the same for pre-3.0-versions: .ttf and .ttc DVIPSHEADERS ttf2pk.cfg TEXCONFIG .map TEXCONFIG .enc DVIPSHEADERS .rpl DVIPSHEADERS .tfm TFMFONTS .sfd DVIPSHEADERSPlease consult the info files for kpathsea for details on thesevariables. The decision whether to use the old or the new scheme willbe done during compilation.You should set the TEXMFCNF variable to the directory where yourtexmf.cnf configuration file resides.The default TDS location for the files in the data subdirectory is $TEXMF/ttf2tfm(or $TEXMF/ttf2pk; you should either make a symbolic link % ln -s $TEXMF/ttf2tfm $TEXMF/ttf2pkor set the variable TTF2PKINPUTS to $TEXMF/ttf2tfm for newer kpathseaversions)Here is the proper command to find out to which value a kpathseavariable is set (we use `TTFONTS' as an example). This is especiallyuseful if a variable isn't set in texmf.cnf or in the environment,thus pointing to the default value which is hard-coded into thekpathsea library. % kpsewhich --progname=ttf2tfm --expand-var='$TTFONTS'We select the program name also since it is possible to specifyvariables which are searched only for a certain program -- in ourexample it would be `TTFONTS.ttf2tfm'.A similar but not identical method is to say % kpsewhich --progname=ttf2tfm --show-path='truetype fonts'[A full list of format types can be obtained by saying `kpsewhich--help' on the command line prompt.] This is exactly how ttf2tfm (andttf2pk) searches for files; the disadvantage is that all variables areexpanded which can cause a very long string.emtexdir--------Here the list of suffixes and its related environment variables to beset in autoexec.bat (resp. in config.sys for OS/2): .ttf and .ttc TTFONTS ttf2pk.cfg TTFCFG .map TTFCFG .enc TTFCFG .rpl TTFCFG .tfm TEXTFM .sfd TTFCFGWith other words, all files in the `data' subdirectory should be movedto a place in your emtex tree with TTFCFG pointing to this directory.If one of the variables isn't set, a warning message is emitted. Thecurrent directory will always be searched. As usual, one exclamationmark appended to a directory path causes subdirectories one level deepto be searched, two exclamation marks causes all subdirectories to besearched. Example: TTFONTS=c:\fonts\truetype!!;d:\myfonts\truetype!Constructions like `c:\fonts!!\truetype' aren't possible.MiKTeX------Both ttf2tfm and ttf2pk have been fully integrated into MiKTeX.Please refer to the documentation of MiKTeX for more details on filesearching.A full example==============Here an example how to handle the font `verdana.ttf' and its variants.1. Construct the font name-------------------------- [This is the most complicated part -- in case you are too lazy to construct font names compliant to TeX's `fontname' scheme, just use your own names.] Using the `ftdump' utility (which is part of FreeType 1) you can find out the PostScript name of the specific TTF which is probably the best choice to adapt TrueType fonts to the PostScript-oriented `fontname' scheme. In our example, the PostScript name is `Verdana'. `fontname' uses the scheme S TT W [V...] [N] [E] [DD] as documented in `fontname.texi' resp. `fontname.dvi'. Now you have to check the various mapping files: S: supplier.map: `j' for `Microsoft' TT: typeface.map: `vn' for `Verdana' W: weight.map: `r' for `Regular Roman', `b' for `bold' V, N: variant.map: `8r' for the raw base font `8t' for the virtual font (i.e., LaTeX's T1 encoding) [additionally an inserted `c' for small caps, `o' for slanted (`oblique'), or `i' for italic fonts] Here the standard combinations: `jvnr8r' for the default base font. `jvnr8t' for the virtual default font. `jvnrc8t' for the virtual font with small caps. [As you can see, no additional raw font is needed.] `jvnro8r' for the slanted base font. `jvnro8t' for the virtual slanted font. The corresponding variants are: bold: verdanab.ttf -> jvnb{8r,8t} small caps: jvnbc8t slanted: jvnbo{8r,8t} italic: verdanai.ttf -> jvni{8r,8t} bold and italic: verdanaz.ttf -> jvnbi{8r,8t}* NOTE: Be careful to use different names for the virtual font and the* raw font! In the above example, `*8r' and `*8t' is used. You* could also use the postfix `*-raw', to name an example, for* the raw font if you don't follow the `fontname' naming scheme.2. Font definition files------------------------ The FD file should be called `t1jvn.fd' (as you can see, this is T1 encoding). It is very similar to `t1ptm.fd', part of the PSNFSS package (which can be found in almost all TeX distributions). A `verdana.sty' file can also be modeled after `times.sty'.3. Calling ttf2tfm------------------ To make the example simpler, we use `T1-WGL4.enc' for both the raw and the virtual encoding. This should be sufficient for most TrueType fonts mapped to T1 encoding. Other packages may define other encodings (e.g. the `t2' package available from CTAN defines mapping files for Cyrillic encodings) -- it may also be necessary to use the `-n' or `-N' switch together with replacement glyph names to access all glyph names in the TrueType font. To create `jvnr8r' and `jvnr8t', just call ttf2tfm verdana -T T1-WGL4 -v jvnr8t jvnr8r vptovf jvnr8t For `jvnrc8t', do ttf2tfm verdana -T T1-WGL4 -V jvnrc8t jvnr8r vptovf jvnrc8t Note that almost always some warnings will appear about missing glyphs. The last line written to stdout by ttf2tfm is a suitable entry for a map file -- let's call it `verdana.map'. Since ttf2pk doesn't care about virtual fonts, both calls below produce the same. Now just repeat this procedure. For slanted fonts you should additionally use the switch `-s 0.176' (of course you can change the slanting amount to make it fit your needs).4. Modifying ttf2pk.cfg----------------------- The final step is to add `verdana.map' to ttf2pk's configuration file. Simply insert the following line at the end of `ttf2pk.cfg': map +verdanaProblems========Most vptovf implementations allow only 100 bytes for the TFM header(the limit is 1024 in the TFM file itself): 8 bytes for checksum anddesign size, 40 bytes for the family name, 20 bytes for the encoding,and 4 bytes for a face byte. There remain only 28 bytes for someadditional information which is used by ttf2tfm for an identificationstring (which is essentially a copy of the command line), and thislimit is always exceeded.The optimal solution is to increase the value of `max_header_bytes' inthe file vptovf.w (and probably pltotf.w) to, say, 400 and recompilevptovf (and pltotf). Otherwise you will get some (harmless) errormessages like This HEADER index is too big for my present table sizewhich can be safely ignored.--- end of ttf2pk.doc ---
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -