[reportlab-users] parseAFMFile sfsc1200.afm

Gregor Horvath g.horvath at gmx.at
Tue Aug 23 13:01:14 EDT 2005


Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I am trying to get a font with small caps running with reportlab.
Therefore I download the file

ftp://ftp.univie.ac.at/packages/tex/fonts/ps-type1/cm-super/afm/sfsc1200.afm.gz

placed in the fonts directory together with the pfb file.

Running my script ends up with the following error:


File "./rechnung.py", line 45, in __init__
     justFace = pdfmetrics.EmbeddedType1Face(afmFile, pfbFile)
   File 
"/usr/lib/python2.2/site-packages/reportlab/pdfbase/pdfmetrics.py", line
447, in __init__
     self._loadMetrics(afmFileName)
   File 
"/usr/lib/python2.2/site-packages/reportlab/pdfbase/pdfmetrics.py", line
472, in _loadMetrics
     (topLevel, glyphData) = parseAFMFile(afmFileName)
   File 
"/usr/lib/python2.2/site-packages/reportlab/pdfbase/pdfmetrics.py", line
91, in parseAFMFile
     width = string.atoi(r)
   File "/usr/lib/python2.2/string.py", line 220, in atoi
     return _int(s, base)
ValueError: invalid literal for int(): 363.338

Running the script with the example font in the fonts order works.

I discoverd that the sfsc1200.afm contains float numbers for the width:


[....]
C 32 ; WX 363.338 ; N space ; B 0 0 0 0 ;
[...]

The working afm file contains integers.

Now, is the afm file wrong or is it a bug in reportlab??

-- 
Greg


More information about the reportlab-users mailing list