How to Specify Font with Enscript for Printing

enscriptpostscriptprinting

I've read the man page for enscript but cannot find the answer to this problem. I am trying to print using enscript with a downloaded AFM file but I can't get it to work. I keep getting the following error:

$ enscript foo.txt -B -f OCRA10 -p - > foo.ps;
couldn't open AFM file for font "OCRA", using default

I have downloaded the AFM file for OCRA and it is located at /usr/share/fonts/ocr/OCRA.afm. I've rebuilt the font cache with fc-cache -fv. I also added a local enscript config file with the path for AFM files:

$ cat ~/.enscriptrc 
AFMPath: /usr/share/fonts/ocr

Any help would be greatly appreciated.

Best Answer

Rather than scanning all AFM files looking for the name of the given font, enscript only scans the font.map text file. This file is a simple two-column ASCII file where each line has the format FontName filename. If you place the AFM file in enscript's afm directory (on my system it's located at /usr/share/enscript/afm) and then add a line in the font.map file (located in the same directory), it will then be able to find and use the font.

I don't know but would guess that any path you give in the AFMPath: field of the config file would also need a font.map file. This would be necessary if you don't have root access to the system and cannot write to enscript's directory.

Related Question