I often need to convert text files to PDF from the command line. I currently use enscript, a2pdf, cupsfilter, etc. The feature I'm missing is the ability to use an OS X font instead of one of the "standard Unix" fonts. I'm particularly interested in the AmericanTypewriter font. Is there an existing tool to do that or perhaps an Apple Script? If not, are there any other ideas?

2 Answers 2


The solution is to create an afm version of the font you want to use which is American-typewriter for the enscript program to create with.

What you need to do is grab a copy of the AmericanTypewriter font. Which is located at /Library/Fonts/AmericanTypewriter.ttc

Next obtain and run the program ttf2pt1. Copy the output file that you can name atw.afm to enscript's afm directory located at /usr/share/enscript/afm.

Edit the "font.map" file located in /usr/share/enscript/afm

Add in the AmericanTypewriter font to the list.

AmericanTypewriter         atw
AvantGarde-Demi            agd
...                        ...

Lastly re-run the enscript and choose the new font, process as you would normally after that but now including the AmericanTypewriter font.

enscript -f "AmericanTypewriter12" -p postScriptOutputfile yourFile.txt
  • 1
    A modification of your procedure worked for me. Thanks for pointing me in the right direction! ttf2afm did not want to convert a ttc file (which, as I understand, is a collection of ttf fonts). I needed to use ttf2pt1 and the procedure outline here: svn.savannah.gnu.org/svn/emacswiki/emacswikipages/EnscriptPrint
    – Dominique
    Apr 19, 2012 at 15:21
  • Glad you were able to get it work, I updated the answer above accordingly to reflect your finding.
    – MrDaniel
    Apr 19, 2012 at 15:35

If you have some basic LaTeX knowledge (and a working LaTeX installation), I strongly recommend you to take a look at Fletcher Penney's Multimarkdown, an extended Markdown interpreter, which has a great customizable feature of converting text files to .tex –from there, it's obviously a short step to a beautiful .pdf document formatted in accordance with your needs.

Check Chapter 5 of the Multimarkdown manual on how to customize LaTeX output – you will need to install both Multimarkdown (installer) and the support files.

Then, nothing prevents you from using XeTeX instead of LaTeX, which will allow you to use the fontspec package to select any font installed on your system. I haven't actually tried, but it should be fairly easy to create a simple custom LaTeX template for Multimarkdown (without the Author & Title information and all that) to produce PDF output in the font of your choice.

  • Thank you. I am familiar with Markdown and LaTeX but it's not an option for me as I need to convert the files without changing them. And they predate Markdown.
    – Dominique
    Apr 19, 2012 at 15:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .