[reportlab-users] Parsing of <table> & ICU wordWrap
Buganini
buganini at gmail.com
Sat Nov 7 07:32:58 EST 2015
http://pastebin.com/JuQVrGzC
But I just found two problem:
1. table is double if width < 100mm (line 55)
2. this program dies with following message if fontName is not set (line 51)
Traceback (most recent call last):
File "table.py", line 63, in <module>
p.wrap(width-padding*2, height-padding*2)
File "/usr/local/lib/python2.7/dist-packages/reportlab-3.2.9-py2.7-linux-x86_64.egg/reportlab/platypus/paragraph.py",
line 1111, in wrap
blPara = self.breakLines(self._wrapWidths)
File "/usr/local/lib/python2.7/dist-packages/reportlab-3.2.9-py2.7-linux-x86_64.egg/reportlab/platypus/paragraph.py",
line 1430, in breakLines
spaceWidth = stringWidth(' ',fontName, fontSize)
File "/usr/local/lib/python2.7/dist-packages/reportlab-3.2.9-py2.7-linux-x86_64.egg/reportlab/pdfbase/pdfmetrics.py",
line 720, in stringWidth
return getFont(fontName).stringWidth(text, fontSize, encoding=encoding)
File "/usr/local/lib/python2.7/dist-packages/reportlab-3.2.9-py2.7-linux-x86_64.egg/reportlab/pdfbase/pdfmetrics.py",
line 686, in getFont
return findFontAndRegister(fontName)
File "/usr/local/lib/python2.7/dist-packages/reportlab-3.2.9-py2.7-linux-x86_64.egg/reportlab/pdfbase/pdfmetrics.py",
line 668, in findFontAndRegister
face = getTypeFace(fontName)
File "/usr/local/lib/python2.7/dist-packages/reportlab-3.2.9-py2.7-linux-x86_64.egg/reportlab/pdfbase/pdfmetrics.py",
line 625, in getTypeFace
return _typefaces[faceName]
KeyError: 'helvetica'
2015-11-04 21:08 GMT+08:00 Robin Becker <robin at reportlab.com>:
> On 04/11/2015 05:52, Buganini wrote:
> .........
>>>
>>> correct?
>>
>>
>> That's correct, BTW I don't know the meaning of cbDefn.
>>
> .....
> my bad; come from pre-history where var names are too long and use memory.
> cbDefn originally stood for "call back definition" and originally we
> intended it for really simple stuff like indexing which didn't use any width
> etc etc, but it got reused as the carrier of information for the img tag
> since it was the one non-regular thing we were already doing in the break
> lines and similar functions.
>
> If you have a good use case please post some small example so we can see how
> it looks. If it seems useful perhaps it can be rolled into RL.
>
> --
> Robin Becker
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at lists2.reportlab.com
> https://pairlist2.pair.net/mailman/listinfo/reportlab-users
More information about the reportlab-users
mailing list