[reportlab-users] Using Arial Unicode MS TrueType Font for Bold and Italic

Robin Becker robin at reportlab.com
Thu Feb 4 08:17:36 EST 2010


On 04/02/2010 08:24, Christian Wilhelm wrote:

> Hi list,

>

> is there any way to use the Arial Unicode MS TrueType Font for bold

> and italic with reportlab? Seems like that font doesn't have any bold

> or italic settings in it, but if I export a PDF-File from OpenOffice

> with bold and italic characters (with Arial Unicode MS as font),

> the text is rendered correctly (with the right font settings) within

> kpdf.

> Is there any way to get the same result with reportlab?

>

> Thanks,

> Christian

.......

I just played a bit with Canvas.setTextRenderMode and it is possible to make
fonts bolder without too much trouble, but the technique relies on using
stroking and filling and that makes the appearance of the bolded font depend on
line width, join etc etc. The results show that the text render mode is
remembered and is subject to the standard stroking properties. You get funny
results with line width 2 and join 0 etc etc.


from reportlab.pdfgen import canvas
canv = canvas.Canvas('t.pdf')

canv.setLineWidth(1)
canv.setLineJoin(1)
canv.drawString(72,8*72,'ABCDEF abcdef mode=None')
canv.drawString(72,8*72-1*12,'ABCDEF abcdef mode=1',mode=1)
canv.drawString(72,8*72-2*12,'ABCDEF abcdef mode=None')
canv.drawString(72,8*72-3*12,'ABCDEF abcdef mode=2',2)
canv.drawString(72,8*72-4*12,'ABCDEF abcdef mode=None')

canv.save()
--
Robin Becker


More information about the reportlab-users mailing list