[reportlab-users] Font size, baseline and typography stuff

Dinu Gherman gherman at darwin.in-berlin.de
Wed Aug 10 05:44:32 EDT 2011


"Robin Becker" <robin at reportlab.com>:


> for what it's worth I have fixed (hopefully) Path.getBounds so it

> doesn't use the simplistic assumption from the original code.

>

> Testing using some rather extreme paths eg

>

>

>> from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin,

>> definePath, String, Rect

>> from reportlab.lib.colors import red, blue, green

>>

>> class TPathBounds_002(_DrawingEditorMixin,Drawing):

>> def __init__(self,width=400,height=200,*args,**kw):

>> Drawing.__init__(self,width,height,*args,**kw)

>> self._add(self,definePath([('moveTo',10,100),('curveTo',70,160,160,40,100,100)],strokeWidth=1,strokeColor=red),name='p',validate=None,desc=None)

>> sb = self.p.getBounds()

>> self._add(self,String(10,self.height-12,'bounds:

>> '+str(sb),fillColor=blue),name=None,validate=None,desc=None)

>> self._add(self,Rect(sb[0],sb[1],sb[2]-sb[0],sb[3]-sb[1],strokeColor=blue,strokeDashArray=(1,1),fillColor=None),name='b',validate=None,desc=None)

>>

>> if __name__=="__main__": #NORUNTESTS

>> TPathBounds_002().save(formats=['pdf'],outDir='.',fnRoot=None)

>

> revealed an error in renderPM (caused by the old version of

> libart_lgpl); the bounds were good, but the _renderPM bpath to vpath

> conversion left out the extreme point.

>

> It should now be fixed.


Sounds great, except that I didn't have the time yet to trace
your changes in your SVN repository. Isn't there any nicer
overview (with change dates etc) than this:

http://svn.reportlab.com/svn/public/reportlab/trunk/src/rl_addons/renderPM/

OTOH, I wrote another test, showing single characters' bound-
ding boxes and splitting them into glyphs and showing their
individual bounding boxes, too. See attached script (I'm not
adding a PDF since I remember some tight size limitations on
this list...).

I found that for the TT fonts I checked the boxes seemed more
correct than for the standard Type1 fonts. And I found an
issue with Unicode when trying to display letters with dia-
critical marks.

Robin, maybe you can have a look at that? Or point me to the
list of changes and files I need to download to check myself?

Thanks!

Dinu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_nanotypometrics.py
Type: text/x-python
Size: 3582 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20110810/1d7d1951/attachment.py>


More information about the reportlab-users mailing list