For distilling a PDF on the Mac I had to unlearn almost everything. Or at least I have to use some more tools, while ignoring others. What I shall write down now is the product of one night of intensive research by googling with lots of trial-and-error.
So, producing the
.ps with lout was easy and just like on Solaris. But there is no Distiller in my setup, instead I normally use
Preview.app. Double-clicking on the
.ps file in the Finder usually is sufficient. Not this time, though, because the
Latin Modern fonts were missing, and Preview.app substitutes Courier for them. Clearly a suboptimal solution.
Dropping the
.pfb and
.afm files into the Fonts folder (personal or system Libraries/Fonts) only had the effect of locking up Preview.app with every job. This is what other people also report in support forums. I removed the font files again.
The solution must be including the font into the
.ps file. There is a small utility called
includeres in the
MacPorts psutils package. Unfortunately the script did not run out of the box, I had to edit it to invoke perl by full pathname (#!/opt/local/bin/perl). But then I had to symlink
LMRoman9-Regular to
lmr9.pfb for this approach to work. Opening the resultant pimped up
.ps file with Preview.app resulted in the well-known hangup. Hmmm,
.pfb is apparently not palatable for Preview.app.
So I began digging deeper. It looked like there is a PSNormalizer entry in the
/tmp/ directory. It seems to be the bastard child of Distiller, licensed to Apple from Adobe. I figured it also has a command-line interface
pstopdf too. PSNormalizer seems to be a private system framework, with a certain directory structure. After finding it on my HD, I could examine its contents. There is a Resource/ directory with fonts/ in it. I dropped my
.pfb there. Hangup. At least I knew now that I am on the right path. PSNormalizer looks for fonts in Resource/fonts/ and after that in ~/Library/Fonts and the global /Library/Fonts.
Resource/fonts/ has two files in it, one of them being Courier. Looking at the dump, it seemed very close to
.pfb files, but all ascii. It must be a
.pfa file! From here it was easier to proceed:
- grabbing a pfb2pfa converter from CTAN (part of ps2mf)
- with a small script converting all .pfbs to .pfas
- dropping these into Resource/fonts/
- redistilling
This time it worked! But it is tiresome to invoke Preview.app all the time using the mouse, so I am using
pstopdf now, which is a perfect substitute for
Distiller. Also I have my
.pfas in /Library/Fonts/, so everybody on that Mac has access to them.
Nevertheless I could relax at this point, and do some experimentation. Here are some things I stumbled upon:
- PSNormalizer/Startup/ can contain arbitrary .ps files that are run before each distillation job starts. This can be useful for customization.
- Resource/startupNORM.ps contains some interesting code and can probably also be modified.
- Using includeres with .pfa fonts also works.
- The PSRESOURCEPATH environment variable does not seem to affect pstopdf.
- pstopdf has two brothers, pstopnm and pstops. I still have to find out what they are good for.
- And there is more: ps2epsi and many other commands starting with "ps" come from the Ghostscript MacPorts package.
All in all, I feel much better about the PDF-workflow on the Mac now :-)
Addendum (2017)
there is an utility (from Ghostscript?) for converting pfb->pfa:
cd /System/Library/PrivateFrameworks/PSNormalizer.framework/Resources/fonts
foreach i (`find /opt/local/share/texmf-texlive/fonts/type1/public/amsfonts -name "*.pfb"`)
sudo pfbtopfa $i
end