<font face="georgia,serif"><span class="Apple-style-span" style="font-family: arial; ">2011/3/28 Michael Sharpe <span dir="ltr"><<a href="mailto:msharpe@ucsd.edu">msharpe@ucsd.edu</a>></span></span><br></font><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div></div><div class="h5"><br>
On Mar 28, 2011, at 8:59 AM, Paolo Matteucci wrote:<br>
<br>
> Some [far from enlightening :-/] comments [on PS fonts], as promised…<br>
><br>
> 2011/3/22 Bruno Voisin <<a href="mailto:bvoisin@me.com">bvoisin@me.com</a>><br>
><br>
>  General principles: Fonts<br>
> =========================<br>
><br>
> TeX fonts generally come in PostScript Type 1 format (either PFB binary files or PFA ascii files), often accompanied with metric files in AFM format (if not, the AFM files can be recreated from the PFB or PFA files). To be used by Textures, the fonts must be converted to a format recognized by OS X, which may raise license issues. I won't enter into these, except in one case (Lucida), and leave it to the reader to assess the matter…<br>


><br>
> PostScript<br>
> ----------<br>
><br>
> The Mac version of a PostScript font is a screen font suitcase, in FFIL resource format or DFONT data format, plus printer font files in LWFN format. These are legacy formats inherited from Mac OS Classic. On OS X they are deprecated and may stop being supported at any point in the future (Lion?).<br>


><br>
> […]<br>
><br>
> In addition, FFIL/DFONT screen fonts are required. These are only used by OS X to locate the LWFN files and get basic metric info, no character bitmaps or outlines from the screen fonts are actually used. For that reason, the Windows-only Y&Y Font Manipulation Package (see "Creating Mac screen fonts from Type 1 outlines" at the bottom of <<a href="http://www.faqs.org/faqs/fonts-faq/part7/" target="_blank">http://www.faqs.org/faqs/fonts-faq/part7/</a>>) included a tool AFMtoSCR for creating fake Mac screen fonts from AFM metric files.<br>


><br>
> […]<br>
><br>
> AFMtoSCR still lives as C source <<a href="http://code.google.com/p/yytex/source/browse/trunk/src/c32/afmtoscr.c" target="_blank">http://code.google.com/p/yytex/source/browse/trunk/src/c32/afmtoscr.c</a>>, but I do not think it has ever been ported to the Mac or to Unix.<br>


><br>
> Actually, the code seems to make use of fairly standard libraries (different paths [and path separator] aside), and I believe it would be worthwhile porting not just AFMtoSCR, but the whole Y&Y Font Manipulation Package to Mac/Linux, but am afraid that would require someone better at C than me! :-(<br>


><br>
> This only leaves FontForge <<a href="http://fontforge.sourceforge.net/" target="_blank">http://fontforge.sourceforge.net/</a>>, using the binary packages now relegated at <<a href="http://sourceforge.net/projects/fontforge/files/fontforge-executables/" target="_blank">http://sourceforge.net/projects/fontforge/files/fontforge-executables/</a>>. FontForge can be scripted, and the GW Extras i-Package includes such a script <a href="http://dumpafm.pe" target="_blank">dumpafm.pe</a> for extracting AFM files from a DFONT suitcase or a TTC collection (see the penultimate message in this series). However, I am totally helpless at scripting and won't venture into this territory.<br>


><br>
> So let's go GUI: with FontForge installed, practically any font file can be double-clicked in the Finder and it will open in FontForge. For each PFB file you must first create a bitmap version by going to<br>
><br>
>        Element > Bitmap Strikes Available<br>
><br>
> (namely, go to the Element menu and select "Bitmap Strikes Available"). Check the Mac checkbox and enter a bitmap size; I chose 4 pt, which was the bitmap size of the screen fonts in BSR's distribution of the Lucida fonts (this is immaterial, since the bitmaps are not actually used). Then go to<br>


><br>
>        File > Generate Fonts<br>
><br>
> and select<br>
><br>
>        PS Type 1 (Resource) + NFNT (Resource)<br>
><br>
> This will create a .bmap screen font in FFIL format, and a LWFN printer font file. The FFIL file will have the name of the AFM metrics inside the PFB file, and the LWFN file will have a name satisfying some norm like 3-letter abbreviations for each of Bold, Italic, etc.<br>


><br>
> However, the result doesn't work because of the way the fonts are grouped in families by Mac OS.<br>
><br>
> Actually, this doesn’t work for me even for a single font! (FontForge 20090923) …whereas it works perfectly if I use FontLab Studio (v5.0.4). :-?<br>
><br>> […]<br>
<br>
</div></div>I don't have a recent Textures that can serve as the ultimate test, but with a small change to Bruno's instructions, I can produce a PS Type 1 (Resource) + NFNT (Resource) that works when installed via Fontbook.<br>


<br>
Before opening your pfb, make sure that the corresponding afm is in the same folder, so that when FontForge opens the pfb, it picks up the complete metrics from the afm.<br>
<br>
After you open the pfb, select the menu item Encoding > Reencode > Macintosh Latin. (The font may print OK, but will not show correctly on the screen without this step.)<br>
<br>
Then follow the remaining steps to generate the single old-style Macintosh font pair. I didn't try it, but I think the same should work for a family if you choose instead File > Generate Mac Family.</blockquote><div>

<font class="Apple-style-span" face="georgia, serif"><br></font></div><div><font class="Apple-style-span" face="georgia, serif">Thank you, Michael.</font></div><div><font class="Apple-style-span" face="georgia, serif"> </font></div>

</div><font class="Apple-style-span" face="georgia, serif">Actually, I don’t think the AFM step is necessary: after all, FontLab Studio doesn’t need it, and most TeX [PS] fonts are supplied as PFB + TFM pairs, so the AFMs would have to be recreated from those, anyway.</font><div>

<font class="Apple-style-span" face="georgia, serif"><br></font></div><div><font class="Apple-style-span" face="georgia, serif">What did eventually make FontForge generate a Mac OS X-valid LWFN + FFIL pair is the "Macintosh Latin" re-encoding (script-wise, it’s enough to add the line </font><font class="Apple-style-span" face="'courier new', monospace">Reencode("mac")</font><font class="Apple-style-span" face="georgia, serif"> before generating the fonts), *but* this is not always what you want, and did not work for the fonts at hand: as in the CFF case, the characters got slotted into the *correct* positions (e.g., alpha into the "alpha" slot, not into the "a" slot), which seem to lie *beyond* what Textures is able to see *even if* you explicitly set the encoding to "MacintoshStandard" in the TeX metrics window.</font></div>

<div><font class="Apple-style-span" face="georgia, serif"><br></font></div><div><font class="Apple-style-span" face="georgia, serif">I tried also with the "Symbol" encoding, but FontForge didn’t seem to be able to generate </font><span class="Apple-style-span" style="font-family: georgia, serif; ">a Mac OS X-valid LWFN + FFIL pair in that case, whereas I didn’t try with the "Adobe Standard" one.</span></div>

<div><span class="Apple-style-span" style="font-family: georgia, serif; "><br></span></div><div><span class="Apple-style-span" style="font-family: georgia, serif; ">I must admit I ran *very* quick tests, so OS and/or Textures font caching might have played a role there, but they seemed to confirm the impression that FontForge (unlike FontLab Studio) is unable to generate a valid LWFN + FFIL/NFNT pair for "custom" encodings… :-(</span></div>

<div><span class="Apple-style-span" style="font-family: georgia, serif; "><br></span></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><span class="Apple-style-span" style="font-family: georgia, serif; ">Paolo</span></div>

</blockquote>