PREVIOUS HEAD

12  Corrected and Updated Metric Export

(First available in 4.0N.)

New metric-export features allow you to access any character in any Windows font in a completely general way. (See the later sections in this document for more information on virtual fonts and the composition interpreter.)

12.1  Metric Export Formats Supported

The metric export (File-Export Metrics menu item) now supports both VPL (TEX Virtual Property List) and XVP (Omega Extended Virtual Property List) file formats when exporting font metrics. The VPL format supports 8-bit encodings (the various TEX encodings and Windows ANSI), while XVP supports not just 8-bit encodings, but also 16-bit encodings (such as Unicode).

TRUETEX includes console versions of the programs VPtoVF and XVPtoXVF translate the property list files to their respective TFM, OFM, XFM, VF, and XVF binary formats for use with TEX and Omega. When you export a metric file, TRUETEX will attempt to run the converter program in a console (Windows NT or 95) or DOS (Windows 3.1) window to automatically yield a binary metric file.

One important application of the XVP metric export is to create 8-bit virtual TEX fonts which use the Unicode 16-bit codes in Windows TrueType to reach accented characters and math symbols in Unicode fonts.

TRUETEX metric export also supports the obsolete PL (TEX Property List) metric file format, and the companion program PLtoTF, should you need this format for use with older TEX software. In this case you specify only an input font encoding, and the property list will reflect this encoding as applied to the TrueType font you select.

The TRUETEX Users Guide is incorrect in saying you must retrieve PLTOTF from the CTAN archive. It is now included in the TRUETEX binary directory.

12.2  Selecting Input and Output Encodings

(First available in 4.0P.) The list of encodings which TRUETEX knows is presented twice each time you export metrics, once each for the input and output encodings. Each selection corresponds to a .cod file in directory \truetex\encoding. A new entry at the end of the list:

[Select any encoding file from File-Open dialog]

allows you to select any encoding-specification file using a File Open common dialog. Currently such files must be in .cod format, which is explained in the TRUETEX Users Guide.

We have provided two AWK scripts, codtoafm.awk and afmtocod.awk, to convert encoding specifications from .cod to .afm and back. These scripts will work with the GNU AWK program, which you can obtain from various Internet GNU archives, or with UNIX AWK.

12.3  Ligatures Supported

When you export metrics, TRUETEX puts the ligature rules of Table 1 into the TFM or XFM file, if the ligature characters exist in the font.

Table 1: Ligature Rules Applied to Exported Fonts.
First Second Result Description
Dashes
hyphen hyphen endash -- to endash
endash hyphen emdash endash- to emdash
Shortcuts to national symbols
comma comma quotedblbase ,, to quotedblbase
less less guillemotleft << to left guillemot
greater greater guillemotright >> to right guillemot
exclam quoteleft exclamdown !` to exclamdown
question quoteleft questiondown ?` to questiondown
F-ligatures
f f ff ff to ff
f i fi fi to fi
f l fl fl to fl
ff i ffi ffi to ffi
ff l ffl ffl to ffl
Paired single quotes to double quotes
quoteleft quoteleft quotedblleft `` to quotedblleft
quoteright quoteright quotedblright '' to quotedblright

12.4  Getting Unicode Fonts in Windows

The Windows standard fonts (Arial, Courier, Times New Roman) can contain various sets of accented characters, depending on your version of Windows and options you have installed: Windows 3.1 will contain ANSI fonts only. Windows 95 will contain all the English and Western-European characters (Latin-1) by default; to get Eastern Europe, Greek, Cyrillic, etc., you must install the ``Multilingual Options'' extension (you can do this easily by consulting the Windows 95 Help topic, ``multilanguage support, installing''). Windows NT automatically installs the multilanguage fonts, and also provides a Unicode demonstration font, Lucida Sans Unicode, containing 1700-odd characters.

Note that TEX text fonts like cmr10 contain Greek capitals, so you should try to virtualize Windows fonts that contain these characters. For example, with the standard fonts like Arial, you can make a TEX virtual font that fills all the positions of fonts like cmr10 except for the polishlcross and dotlessj characters.

You can examine the fonts on your system to verify how well-populated they are: use the TRUETEX Encoding Map on the Text menu (see below). This map works much better for viewing the Unicode tables than the Windows character mapper or font installer.

12.5  Limitations

Windows 95, which will display and print Unicode text from TRUETEX, unfortunately has a problem in that it will not report metrics or kerning for Unicode characters 256 and above (that is, the Microsoft GDI functions GetGlyphOutlineW() and GetKerningPairsW() do not work correctly in Windows 95). This means that you can export metrics for characters 256 and above only if you are running Windows NT. You can use the metrics TRUETEX exports under Windows NT to view and print in Windows 95, you just can't create the metrics themselves on Windows 95.

There is a work-around for this Windows 95 limitation, however. You can generate an AFM (Adobe Font Metrics) file for a TrueType font outside of Windows by using an accessory program ttf_edit included with TRUETEX. This program is a TrueType font encoding editor, and is documented in the file ttf_edit.w in directory \truetex\bin. For example, to create and AFM file for arial.ttf, use ttf_edit as follows:

C> \truetex\bin\ttf_edit arial.ttf font 3 1 afm > arial.afm

This will produce an AFM file giving metric information for the platform 3.1 (Windows, ANSI or Unicode) encoding of the Arial font. (warning: pending implementation as of 2 Jun 1996).

Now, using the previewer, choose File + Export Metrics for the Arial font, choosing the input encoding, ``Windows 3.1 ANSI or ATM (16-bit Unicode)''. When TRUETEX encounters the Windows 95 metric export limitation at codes 256 and above, it will ask you if you want to use an AFM file instead of TrueType metrics, and you can respond by opening the AFM file arial.afm you have just created for that purpose.

12.6  Making 8-Bit TEX Fonts from Unicode Fonts

While exporting XVP files (Omega 16-bit font metrics) will connect the TRUETEX previewer to Windows' Unicode fonts, the TEX formatter requires TFM metric files, not Omega XFM or OFM files. If, when exporting metrics, you specify an 8-bit output encoding, the resulting virtual font will be compatible with the original TEX formatter and will not require the Omega formatter.

To create a TFM file for such a font, use the xvptovpl.exe filter to truncate the virtual codes in the XVP file and produce a truncated VPL file. For example, if you have exported arial.xvp:

xvptovpl < arial.xvp > arial.vpl vptovf arial

will create arial.tfm for use with TEX. You should delete the arial.vf file also created by these commands, since it does not properly map the 8-bit characters to Unicode.

The XFM and TFM files produced by this process will contain the same information; the XFM format is not needed in this case. The previewer will look first for an OFM or XFM file for a font in preference to a TFM file, if the OFM or XFM exists, so either format is acceptable to the previewer. The previewer does need the XVF file to map the 8-bit TEX characters to Unicode positions, however, and VF file would be incorrect.

12.7  Using Adobe Type Manager (ATM) for Type 1 Fonts with Windows 95

You can use Adobe Type Manager and Windows 95 together with TRUETEX, if you follow a few precautions. Adobe Type Manager 3.02 (the first version that worked under Windows 95) does not report the metrics and kerning for its fonts to Windows, so TRUETEX cannot learn what it needs to export TEX metrics by simply querying Windows. When you export metrics for an ATM font, TRUETEX will instead ask you for an AFM (Adobe Font Metrics) file which goes with the font you are are exporting TEX metrics for. TRUETEX will use the AFM file you provide as the source for items such as the character bounding boxes and kerning pairs. The encoding given in the AFM file is ignored, so do not depend on it as a means to re-encode fonts; the input and output encodings you specify to TRUETEX for the export are the ones which the export process will use.

ATM fonts are strictly 8-bit input encodings, so you should select the ``Windows 3.1 ANSI or ATM (8-bit)'' input encoding whenever you export metrics for an ATM font in Windows 3.1 or 95, and ``Windows 3.1 ANSI or ATM (16-bit Unicode)'' in Windows NT (in theory, anyway; as of this writing there is no ATM for Windows NT). The virtual font files (.vf, .ovf, or .xvf) will be specific to the 8-bit or Unicode environment respectively. ATM itself is lagging behind advances in Windows, notably in its lack of Unicode support and lack of a version for Windows NT.

Whenever you export metrics, TRUETEX tries to guess some sane values for the font's ItalicAngle, Quad, SpaceWidth, and XHeight. If you find that the spacings appear incorrect, you may need to alter these values in the .vpl (or .xvp) file and convert them with vptovf (or xvptoxvf).

TRUETEX does not (in this release) forward kerning to composed ligatures (that is, those generated by the composition script), even if the components are kerned. For example, if the pair ``o'' followed by ``f'' were kerned closer in the font, and the exported font contains a composed ligature ``ffi'', the string ``office'' would not be kerned between the ``o'' and the ``f'' unless you defeated the kerning with TEX commands.

Although installed fonts are supposed to be registered in the Windows 95 registry (so that applications can enumerate fonts), ATM 3.02 does not support the Windows 95 registry. You must therefore add the file ATM.INI to the Options + Expert + Font Subsitution Files(s) path to notify TRUETEX of the list of ATM fonts. You must do this before you can use ATM fonts in TRUETEX for exporting metrics or previewing.

TRUETEX does not use the composition information present in an AFM file.

This release also corrected a possibility of exported TEX metrics having negative heights for characters which were entirely below the baseline; the corrected software ensures that such below-baseline heights are always zero.


NEXT HEAD