[reportlab-users] Text scaling and finding out how much space text will take up

pier carteri pier.carteri at gmail.com
Wed Nov 1 06:52:25 EST 2006


Hi,
you can obtain the width of a string using the canvas method
stringwidth(text, font_name, font_size, encoding)


Pier

On 11/1/06, Chris Withers <chris at simplistix.co.uk> wrote:
> Hi there...
>
> Background: I'm generating track listings for CDs for use in clubs so I
> can have easy to read, consistent track lists. I used to do these by
> hand using nested tables in an OOo document and manually "optimise" each
> one so the columns (track no, artist, track, remixer) all lined up but
> gave as much space as needed to each column, and chopping off any really
> stupidly long artist or track names.
>
> Now I'm trying to automate this ;-)
>
> Is there any way in reportlab to find out how much space (in cm) a piece
> of text is going to take up when rendered?
>
> Also, is there any way to horizontally squash text by a % so that it
> takes up less room when it's generated with a TTF font?
>
> cheers,
>
> Chris
>
> --
> Simplistix - Content Management, Zope & Python Consulting
>             - http://www.simplistix.co.uk
>
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
>


More information about the reportlab-users mailing list