Text-to-Path Conversion with Ghostscript

So you’ve prepared some PDF material with LaTeX, which you’re going to send to the printing company.

If they’ using the PDF as it is, fine and dandy. But if they need to import the PDF into, say, Illustrator for some further processing, you might be in some kind of a fix if the fonts you used (in LaTeX) aren’t easily obtainable as TTF OTF forms.

One solution is to convert all texts into paths before submitting the PDF to the printers. I don’t have Illustrator, so I tried Inkscape instead. Now Inkscape does have a convert-text-to-path function, but for the texts to display properly in Inkscape in the first place, I’d still need the TTF OTF files. Inkscape cannot make use of fonts embedded in the PDF to import the text as paths directly. Not very helpful, then.

Fortunately, suv gave this workaround using Ghostscript:

As a workaround, you can use Ghostscript to convert text in a PDF (or EPS/PS) file to outlines. It requires to convert the PDF to an intermediary PS file, and then back to PDF (thus losing PDF features not supported by PostScript, like transparency).
E.g. use a shell script, containing a command similar to this one:

$ gs -sDEVICE=pswrite -dNOCACHE \
-sOutputFile=- -q -dbatch -dNOPAUSE \
-dQUIET "$1" -c quit | ps2pdf - \
"`echo $1 | cut -f1 -d'.'`"-nofont.pdf

So long as your file does not contain any transparency, the script works just fine, and you can submit the file*-nofont.pdf to your printer. And of course, expect some increase in file size.

Fixing the Biolinum Font in Beamer

The libertine package provides LaTeX support to the Linux Libertine and Linux Biolinum fonts. The package release dated 2011-06-06 contains a bug, in which the ex unit value of the san serif font, Linux Biolinum, is not set correctly. This causes problems if the libertine package is used in a beamer presentation:

Notice how the heights of the headline and footline coloured boxes are almost zero. The same thing happens to the itemized and enumerated list markers, too.

A bug report has been filed with the LinuxLibertine project, but it’s still open at the time of writing.

In the meantime, Ulrike Fischer and Robin Fairbairns have provided an interim solution by resetting the ex value in the .fd files. Here’s what I did following their suggestions.

Locate the Biolinum .fd files, which should be in $TEXMF/tex/latex/libertine/ . I usually work with T1 encoding, so I homed in on the files t1fxb.fd, t1fxbf.fd, t1fxbj.fd, t1fxbjo.fd and t1fxbo.fd. (All these files, because sometimes I want the old-style numbers fonts.) I then added the code in red below for each m-n series-shapes:

\DeclareFontShape{T1}{fxb}{m}{n}{
\fxl@@scale fxbr-t1
}{\fontdimen5\font=\fontcharht\font`\x}

I didn’t bother with the \DeclareFontShape of other series-shapes, as the above seems to have fixed the problem for me:

So hopefully this’ll help anyone else who’s run into a similar predicament. Thanks again to Ulrike and Robin for the solution.

“Why isn’t Arial in my LaTeX installation by default?”

“Or Cooper Black, or a bunch of other fonts? They’re free, aren’t they? They’re already there on my computer!”

If you’ve ever wondered about this, this article on Free Fonts: Free Is Not Always Free may help you understand some of the underlying issues about font licensing. (Some people would argue that the M$-bundled fonts are of inferior quality compared to the real stuff anyway e.g. Times Roman, Helvetica etc)

On the other hand, rest assured that all is not lost as there are free clones of many of such fonts that you can use in your LaTeX documents anyway.

For example, \usepackage{mathptmx} loads Nimbus Roman, a look-alike for Times Roman, while \usepackage{helvet} loads Nimbus Sans to stand in for Helvetica, which is pretty much indistinguishable from Arial — to the untrained eye anyway.

One last thing: You can still use some non-free fonts: install them using the getnonfreefonts script.

One really last thing: The last thing I want to do is to start a font war on this blog, so please spare me the hate mails! 😉