[reportlab-users] Text scaling and finding out how much space
text will take up
Tim Roberts
timr at probo.com
Wed Nov 1 17:44:53 EST 2006
Andy Robinson wrote:
> Chris Withers wrote:
>
>> Andy Robinson wrote:
>>
>>> Correctly, as long as you have registered the font ;-)
>>>
>>> The code to register TT fonts is in the user guide, Ch3 I think.
>>
>>
>> Great, yep, I remember it :-)
>>
>> Which leaves one question: how do I horizontally scale (ie: squish)
>> text by a certain amount?
>
>
>
> canv.saveState()
> canvas.scale(0.5, 1.0)
> canv.drawString(x, y, 'half as slim but just as tall')
> canv.restoreState()
However, note that "scale" also affects the coordinates. So you
probably need something like:
canv.drawString( x*2, y, 'half as slim but just as tall')
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the reportlab-users
mailing list