5

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.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
AnonSubmitter85
  • 221
  • 2
  • 6

1 Answers1

5

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.

AnonSubmitter85
  • 221
  • 2
  • 6
  • 1
    Note that the `font.map` file can be generated by `mkafmmap` which comes with `enscript` : `cd /your/afm/dir; mkafmmap *.afm` will create the file. – mivk Aug 27 '20 at 15:01