[reportlab-users] font weights

Jerome Alet alet at librelogiciel.com
Mon Dec 4 00:49:10 EST 2006


On Mon, Dec 04, 2006 at 02:11:27AM +0000, Chris Withers wrote:

>

> Feeling a bit feeble minded this late at night...

>

> I have a TTF font that I'm using and I'd like to emphasise a word in the

> middle of a textobject output stream. The font I'm using has no bold

> variant.

>

> How can I get a bold word?


If you know the exact position of this word, and can "print" it
independantly from the rest, you could slightly increment
the canvas' scale before printing this word, something like
(untested) :

word = u"Blah"
xpos, ypos = (320, 200)
fontname = "MyFont"
fontsize = 12

canvas.saveState()
canvas.translate(xpos, ypos)
canvas.scale(1.2, 1.2)
canvas.setFont(fontname, fontsize)
canvas.drawString(xpos, ypos, word)
canvas.restoreState()

it's ugly, but I hope this helps anyway

bye

Jerome Alet


More information about the reportlab-users mailing list