[reportlab-users] reportlab with Thai language
Andy Robinson
reportlab-users@reportlab.com
Mon, 24 May 2004 09:11:07 +0100
>
> pdfmetrics.registerFont(TTFont('Tahoma',
> 'c:\\Windows\\Fonts\\Tahoma.TTF'))
> c = canvas.Canvas('c:\\temp\\test.pdf')
> c.setFont('Tahoma', 20)
> c.drawString(100, 100, u'thai text goes here'.encode('utf-8'))
> c.showPage()
> c.save()
>
>
> The only font that can display Thai character is "Tahoma", I don't quite
> understand why.
Tahoma contains almost all the world's languages. If you have
any other TrueType fonts which definitely contain Thai characters
in UTF8, they should work.
> And I also have no idea why I have to manually "encode('utf-8')" for
> every unicode text I draw.
Yes, this sounds like a bug. We should really accept unicode
characters.
Can you send us some 'escaped thai text' e.g. send the results of
u.'thai text goes here'.encode('utf-8'), and a link on the web
to 'what it should look like' ? This will help us.
Thanks, Andy Robinson