enscript cannot print spaces with Truetype Consolas font

49 views Asked by At

I am trying to create with enscript a PDF source code listing of this Python script:

import numpy as np

def f1(x):
    return x * x * np.sin(x)

however I am getting this output: enter image description here

I am using this command line:

enscript --filter="cat %s | iconv -f utf-8 -t iso-8859-1" -v -rG --font="Consolas@12" --highlight=python -o - -M Letter --color=0 -X 88591 --non-printable-format=octal -O test_enscript.py | ps2pdf - a.pdf
AFM: scanning path...
AFM: reading font map "/usr/local/share/enscript/afm/font.map"
AFM: reading font map "/home/arrigo/fonts/Consolas/font.map"
downloading font "Consolas"
states: autoloading `lang_enscript' from `/usr/local/share/enscript/hl/lang_enscript.st'
states: autoloading `style_emacs' from `/usr/local/share/enscript/hl/style_emacs.st'
states: autoloading `default_faces' from `/usr/local/share/enscript/hl/default_faces.st'
states: autoloading `python' from `/usr/local/share/enscript/hl/python.st'
processing file "test_enscript.py"...
[ 1 page * 1 copy ] left in -
1 character was missing
missing character codes (decimal):
 32

It looks like the space is not mapped correctly to the iso-8859 encoding. I have installed the Consolas font files as explained here. After some investigations, I found that the problem seems to be that TrueType fonts like Consolas do not define a character for code U+0020 (0x20 space). I am not a font expert, but this seems weird. Any ideas about how to fix it?

0

There are 0 answers