[reportlab-users] TTF, Platypus & Unicode...
andy robinson
reportlab-users@reportlab.com
Tue, 30 Jul 2002 14:28:28 +0100
> Here's a sample that works for me:
>
> from reportlab.pdfbase import pdfmetrics
> from reportlab.pdfbase.ttfonts import TTFont
>
> fontdir = '/usr/share/fonts/truetype/'
> pdfmetrics.registerFont(TTFont('Arial', fontdir + 'Arial.ttf'))
>
> from reportlab.pdfgen.canvas import Canvas
>
> canvas = Canvas('foo.pdf')
> canvas.setFont('Arial', 12)
> canvas.drawString(100, 700, unicode("Lithuanian national characters:
àèæûáðøûþ", "ISO-8859-13").encode("UTF-8"))
> canvas.save()
>
> Marius Gedminas
Thanks! That's a good one for the cookbook/FAQ