[reportlab-users] reportlab with Thai language

Sakesun Roykiattisak reportlab-users@reportlab.com
Mon, 24 May 2004 13:26:10 +0700


Hi all,
I'm  now evaluating reportlab for my new report solution. With a quck 
test , I've found that I can  display Thai language with these lines


from reportlab.pdfgen import canvas
from reportlab.pdfbase import pdfmetrics, ttfonts

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.
And I also have no idea why I have to manually "encode('utf-8')" for 
every unicode text I draw.
I'm happy with reportlab already even with Tahoma as the only font.  
However, I still wonder
what have to be done to make reportlab fully support Thai code and 
unicode string ?
Perhaps I can contribute some efforts.