[Textures] Helvetica Outline

Bruno Voisin bvoisin at me.com
Fri May 25 08:22:00 EDT 2012


(cc'ed to the mactex list for the amusement of the people there, since this also speaks of TeX Live)


Those who have used Textures up to version 2.1 may remember the presence of Helvetica Outline (ie HelveticaO) in the built-in metrics, drawing Helvetica glyph outlines with empty interior. Like that:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Example.png
Type: image/png
Size: 8024 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/textures/attachments/20120525/f31c8fd1/attachment.png>
-------------- next part --------------


The presence of this metrics may be linked with the involvement of Doug Henderson in the creation of Textures, and his work <http://www.tug.org/TUGboat/tb10-1/tb23henderson.pdf> on the matter. Be that as it may, the metrics ceased to work with Textures 2.2: plain Helvetica is displayed where outline Helvetica ought to be.

One year and a half ago <http://tug.org/pipermail/macostex-archives/2011-March/046718.html>, looking to get the Textures built-in metrics accessible in TeX Live, and founding in section 6.3.2 of the dvips doc an indication of how to get outline fonts (by setting the PaintType to 2), I ended up with the addition of a map file containing

HelveticaO NimbusSanL-Regu "/PaintType 2 store Textures ReEncodeFont" <texmac.enc <uhvr8a.pfb

where texmac.enc is the Textures (aka LM1, aka LT1) encoding file provided by Y&Y <http://code.google.com/p/yytex/source/browse/trunk/fonts/vec/texmac.enc>, and HelveticaO.tfm is obtained by saving the HelveticaO metrics in the Textures built-in TeX Metrics suitcase to VPL format in EdMetrics then applying pltotf.

However several problems remained:

- The outlines were very thin and barely visible.

- The solution only worked with dvips, not pdfTeX (which only recognizes the instructions SlantFont and ExtendFont in map files and ignores all other instructions, according to section 3.1 of its doc).

- This left totally aside the matter of how to get the same result in Textures 2.2.

A couple of days ago, cleaning files and directories on my disks, I found a copy of the PostScript Language Reference Manual and then, browsing through it, the mention that a PaintType of 2 must be accompanied by the specification of a StrokeWidth. This prompted a closer look at the problem and, while I was at it, the search for solutions working with pdfTeX and Textures 2.2.


dvips solution
==============

First, how to get the StrokeWidth value? Typesetting testfont.tex with HelveticaO in Textures 2.1 under SheepShaver, then printing the output to a PS file, reveals that HelveticaO is drawn by applying to Helvetica the outline operator .o defined as

/.o {/old exch def old length 2 add dict /FontDef exch def
 old {exch dup /FID ne {exch FontDef 3 1 roll put}
 {pop pop}ifelse}forall
 FontDef dup /PaintType 2 put /StrokeWidth 20 put
 /testfont FontDef definefont}bd

This hints to a StrokeWidth of 20. However, when used in a dvips map file, this value gives too heavy strokes. Trial-and-error yields a value of 10.

Hence a solution for dvips alone is

HelveticaO NimbusSanL-Regu "/PaintType 2 store /StrokeWidth 10 store Textures ReEncodeFont" <texmac.enc <uhvr8a.pfb


pdfTeX solution
===============

Not knowing anything about the PDF language, the only solution I could think of is take the URW Helvetica clone uhvr8a.pfb in TeX Live and turn it into a stroked outline font with FontForge, using the Helvetica Narrow clone uhvr8ac.pfb as an indication of how font and family names etc. should be labelled for Helvetica variants.

So what I did is open uhvr8a.pfb in FontForge, go to Element > Font Info and set

Fontname	NimbusSanL-ReguOutl
Family Name	Nimbus Sans L
Name For Humans	Nimbus Sans L Regular Outline

then go to Edit > Select > Select All and to Element > Style > Outline, set the Outline Width to 10, save the result, go to File > Generate Fonts, select the PS Type 1 (Binary) format and choose the name uhvr8al.pfb.

The corresponding addition in the map file becomes

HelveticaO NimbusSanL-ReguOutl "Textures ReEncodeFont" <texmac.enc <uhvr8al.pfb

and works for both dvips and pdfTeX.


Textures 2.2 solution
=====================

The solution for Textures 2.2 follows directly from that for pdfTeX. First, get the TrueType URW Helvetica clone NimbusSanL-Regu.ttf distributed as part of the GhostPDL sources at <http://www.ghostscript.com/download/gpdldnld.html>. Open it in FontForge, change the font info to

Fontname	NimbusSanL-ReguOutl
Family Name	NimbusSanLOut
Name For Humans	NimbusSanLOut

set the outline width to 10 as before and use Generate Fonts to save the result to TrueType format as NimbusSanL-ReguOutl.ttf. (You really need to change the Family Name and/or the Name For Humans from their NimbusSanL default, in order for Textures to use the font; originally I did not, and Textures displayed Helvetica for HelveticaO instead of NimbusSanL-ReguOutl.ttf in the Typeset window.)

Then all that's needed is edit the built-in HelveticaO in "/Applications/Textures.app/Contents/Resources/Metrics/TeX Metrics", either with EdMetrics in SheepShaver

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Capture d??cran 2012-05-25 ? 13.41.30.png
Type: image/png
Size: 17387 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/textures/attachments/20120525/f31c8fd1/attachment-0001.png>
-------------- next part --------------


or more simply in Textures 2.2 itself: open the TeX Metrics window, browse to Helvetica and change the PS fontname field (it is editable) to the PS name of the font (NimbusSanL-ReguOutl):

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Capture d??cran 2012-05-25 ? 13.40.27.png
Type: image/png
Size: 51339 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/textures/attachments/20120525/f31c8fd1/attachment-0002.png>
-------------- next part --------------


Quit textures, you will be asked whether to save the changes, choose yes. Then the next time you open Textures HelveticaO will point to this new font:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Capture d??cran 2012-05-25 ? 13.42.41.png
Type: image/png
Size: 51287 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/textures/attachments/20120525/f31c8fd1/attachment-0003.png>
-------------- next part --------------



Comparison
==========

Following is a comparison of the stroked outline character ? obtained with Textures 2.1, Textures 2.2, dvips and pdfTeX:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Comparison.png
Type: image/png
Size: 138577 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/textures/attachments/20120525/f31c8fd1/attachment-0004.png>
-------------- next part --------------


The ring accent is slightly different between Textures 2.1 on one hand, and Textures 2.2, dvips and pdfTeX on the other hand, probably as a result of the difference between the original Helvetica (used by the first) and its URW clone (used by the others).

But another difference remains, between the PostScript-based solution on one hand (Textures 2.1 and dvips) and the FontForge-based solutions on the other hand (Textures 2.2 and pdfTeX): it seems as if Postscript was placing the strokes just outside the glyph outline, and FontForge just inside it. As a result, the glyph as a whole (not the strokes) seems thinner in the second case compared with the first (compare the thickness of the arms of the A).

Of course, that's really only nitpicking compared with having no outline glyphs at all!

Finally here are the test files I used.

Happy Texturing,

Bruno Voisin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: batchtestfont.tex
Type: application/x-tex
Size: 9227 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/textures/attachments/20120525/f31c8fd1/attachment.tex>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestHelveticaO-TeXLive+dvips.pdf
Type: application/pdf
Size: 28814 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/textures/attachments/20120525/f31c8fd1/attachment.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestHelveticaO-TeXLive+FontForge.pdf
Type: application/pdf
Size: 85002 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/textures/attachments/20120525/f31c8fd1/attachment-0001.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestHelveticaO-Textures21.pdf
Type: application/pdf
Size: 36572 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/textures/attachments/20120525/f31c8fd1/attachment-0002.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestHelveticaO-Textures22.pdf
Type: application/pdf
Size: 39589 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/textures/attachments/20120525/f31c8fd1/attachment-0003.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestHelveticaO.tex
Type: application/x-tex
Size: 81 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/textures/attachments/20120525/f31c8fd1/attachment-0001.tex>


More information about the Textures mailing list