[reportlab-users] stretching fonts
    Andy Robinson 
    andy at reportlab.com
       
    Mon Dec 29 15:09:43 EST 2008
    
    
  
2008/12/29 Tim Roberts <timr at probo.com>:
> Carl Karsten wrote:
>> Is there a way to make a font, wider?   or make a string take up x
>> amount of space?  the string is a constant (well, it will be "2009"
>> for the next year...) and I need it to fill up an area that is about
>> 1.5x the width it currently uses, without increasing the hight.  and I
>> don't want to just increase the spacing, because I like the look of
>> the wider font.
Instead of Canvas.drawString, you can create a TextObject which
offers methods for adjusting the inter-character spacing. You
could use PDFTextObject.setCharSpace or setWordSpace.
You will need to call stringwidth yourself to work out the actual
size, then add character or word spacing accordingly.
Docstrings here...
  src/reportlab/pdfgen/textobject.py
Examples of text object and stringwidth are in
   src/tests/test_pdfgen_general.py
Hope this helps,
- Andy
    
    
More information about the reportlab-users
mailing list