[Textures] A bit of everything (2/7)

Bruno Voisin bvoisin at me.com
Tue Mar 22 16:15:11 EDT 2011

General principles: Metrics


In addition to the fonts themselves, the TFM and VF metrics must be in a format recognized by Textures. OS X Textures (ie Textures 2.2) can use TFM and VF files directly, but this only works for TFM and VF files with the same name as the font they refer to (like cmr10.tfm) and this also doesn't work when some re-encoding or re-scaling of the font is involved.

With Textures 2.2.0b16 the ability to edit the font inside the TeX metrics window has been added, and in particular to edit the name of the font in the "coding" column and to paste an encoding in the "encoding" column. But I didn't manage to get this to work in the quick tests I did, and most of the following had been done earlier with Textures 2.2.0b15 anyway, so I went on in the old-fashioned way of Classic Textures (ie Textures 2.1 and below), using EdMetrics to create and edit metrics suitcases.

EdMetrics 1.7.1, available from the Blue Sky FTP server at <ftp://ftp.bluesky.com/utilities/EdMetrics.sea.hqx>, is the version you'll want, not the earlier version 1.7.0 available on the Textures 2.1.1 CD, which doesn't knows about TeX 'n ANSI encoding (while 1.7.1 does).

Running EdMetrics means having either a Mac still running Classic, or a SheepShaver installation <http://www.emaculation.com/doku.php/sheepshaver_mac_os_x_setup>. Getting SheepShaver to work is far from trivial, and took me at least two or three days. Beware too that SheepShaver is pretty unstable: you can use it, but don't move the mouse too fast, don't open too many windows, don't breathe too heavily, that sort of things... Otherwise it will just crash. All things being relative, the 25-10-2009 build appears more reliable than the 06-11-2010 build.

In EdMetrics, for those who have forgotten how it's like, here's the font metrics window, where you pack the information contained in TFM, VF, MAP and ENC files from standard TeX:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: EdMetrics Main.png
Type: image/png
Size: 36307 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/textures/attachments/20110322/8b227036/attachment.png>
-------------- next part --------------

On OS X, the "Quickdraw map" pull-down menu is irrelevant and the "PostScript map" menu can be avoided entirely, since all the required information can be put in the "PostScript encoding" menu alone. For example, the Google repository for Y&Y TeX contains an encoding file


which reproduces the effect of setting

	PostScript map -> Roman->MacintoshStandard
	PostScript encoding -> MacintoshStandard

as explained in the accompanying encoding vector


In other words, the above is equivalent to

	PostScript map -> None
	Postscript encoding -> Custom [texmac]

Similarly, based on


one can easily create a file texmax.enc equivalent to

	PostScript map -> Typewriter->MacintoshStandard
	PostScript encoding -> MacintoshStandard

All the following is based on the use of PostScript encoding files.

In order for these files to be accepted by EdMetrics, you need to (1) remove all text before the opening bracket "[" and after the closing bracket "]" of the encoding specification, together with any comment, and (2) make sure no char name inside the encoding contains an underscore. For example, a char name /f_f (used by Hoefler Text, for example) will cause the encoding to be rejected. By rejected, I mean that when you draw a glyph chart, you will realize that the custom encoding has been ignored and Textures has reverted to its default, Macintosh Standard Roman encoding, defined in


and drawn in Figure B-1 of the Textures Users Guide, namely

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lm1-cropped.pdf
Type: application/pdf
Size: 56301 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/textures/attachments/20110322/8b227036/attachment.pdf>
-------------- next part --------------

To "populate" a metrics suitcase with TFM and VF files in EdMetrics, using

	File > Add PL/VPL metric

you need to preprocess the binary TFM and VF files by tftopl and vftovp to convert them to ascii PL and VPL files, respectively, then make sure these files use Mac-style line endings and that they are of type "TEXT". While the line endings and type can be set happily with TextWrangler or BBEdit say on a per-file basis, a command-line solution in Terminal is required for processing whole series of files. A nice solution, doing all this in one go and figured out with the expert help of Peter Dyballa, is

	apply 'tftopl %1 | tr "\n" "\r" > `basename %1 .tfm`.pl' *.tfm
	/Developer/Tools/SetFile -t "TEXT" *.pl

for TFM files, and

	apply 'vftovp %1 | tr "\n" "\r" > `basename %1 .vf`.vpl' *.vf
	/Developer/Tools/SetFile -t "TEXT" *.vpl

for VF files. This will process all files with extensions .tfm and .vf, respectively, in a given directory. SetFile is part of Xcode, while tftopl and vftovp are part of MacTeX.

Here's how things work once the PL and VPL files are ready. Consider typical lines from a MAP file, for example

	pplr8r URWPalladioL-Roma "TeXBase1Encoding ReEncodeFont" <8r.enc <uplr8a.pfb
	pplr8y URWPalladioL-Roma "TeXnANSIEncoding ReEncodeFont" <texnansi.enc <uplr8a.pfb
	rpplr URWPalladioL-Roma "StandardEncoding ReEncodeFont" <8a.enc <uplr8a.pfb

The first line associates the metrics pplr8r.tfm with the font of PostScript name URWPalladioL-Roma contained in the file uplr8a.pfb (a public-domain clone of Palatino-Roman), and re-encodes it into the TeXBase1 encoding defined in the file 8r.enc.

Performing the same with EdMetrics means:

- Use "File > Add PL/VPL metric" to import pplr8r.pl.

- Remove the .pl extension from the "TeX metric name".

- Check the "PostScript font" box to tell the font is outline and not bitmap. Despite the name, the box applies to both PostScript and TrueType.

- Set the "PostScript name" to Palatino-Roman, namely to the PostScript name of the Palatino regular font built in OS X (as double-checked in Font Book).

- Choose TeXBase1 in the pull-down menu for the "PostScript encoding".

Like this:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pplr8r.png
Type: image/png
Size: 22461 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/textures/attachments/20110322/8b227036/attachment-0001.png>
-------------- next part --------------

Similarly for the second and third lines of the MAP file you would import pplr8y.pl and rpplr.tfm and use the same settings as above, except for the PostScript encoding which would be TeXnANSI for pplr8y and AdobeStandard for rpplr.

When the encoding isn't built in EdMetrics and is contained instead in an ENC file, prepared for Textures as described above, then you select Custom in the pull-down menu and the ENC file in the dialog that follows.

For virtual fonts contained in VPL files, you only remove the .vpl extension from the "TeX metric name" field and leave all the other fields blank. 

One thing which doesn't work is PostScript modifiers, for outlining, slanting or extending a PostScript font. As for Classic Textures, I took care to round any slant or extension to entire percentages, but this didn't change a thing: no slant or extension appears in the Textures output, and after saving then reopening a metrics it is no longer present. So it seems to simply be ignored. In all the following I scrupulously translated MAP file instructions such as
	pplr8rn URWPalladioL-Roma ".82 ExtendFont TeXBase1Encoding ReEncodeFont" <8r.enc <uplr8a.pfb
	pplro8r URWPalladioL-Roma ".167 SlantFont TeXBase1Encoding ReEncodeFont" <8r.enc <uplr8a.pfb
	pplrr8re URWPalladioL-Roma "1.2 ExtendFont TeXBase1Encoding ReEncodeFont" <8r.enc <uplr8a.pfb
	pplru8r URWPalladioL-Ital "-.1763 SlantFont TeXBase1Encoding ReEncodeFont" <8r.enc <uplri8a.pfb

into "Condense to 82 percent", "Slant to 17 percent", "Condense to 120 percent", "Slant to -18 percent" respectively, but this was unsuccessful: all the modifiers are ignored.


After preparing fonts and metrics, the results can be checked by drawing glyphs charts. A solution is to make a copy of <http://mirror.ctan.org/macros/plain/base/testfont.tex>, comment out the line


call the result batchtestfont.tex say then write plain TeX files calling the metrics one by one as in

	\input batchtestfont



Such charts, however, are not sufficient, as they do not test for ligatures. Here's a test file based on accentst.tex from the Blue Sky Research Lucida floppies from the early 1990s:

	  {\bf Test of #1}\smallskip
	  Standard Ligatures: fi fl ff ffi ffl\par
	  Standard pseudo ligatures: ``English'' - -- --- !` ?`\par
	  Extra pseudo ligatures: <<French>> ,,German''



and the output it gives

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ligatures-cropped.pdf
Type: application/pdf
Size: 60107 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/textures/attachments/20110322/8b227036/attachment-0001.pdf>
-------------- next part --------------

As for fonts, I was sometimes puzzled by the behaviour of Textures regarding metrics: though I could not find any repeatable pattern to it, several times I had the impression Textures was still using metrics suitcases even after I moved them away from the Textures Metrics folder and then quit and restarted Textures. Generally closing the current user session then re-opening a new one solved the matter.

Enough general considerations! Now let the fun begin ;-)

More information about the Textures mailing list