universal unicode font for reportlab

Laszlo Nagy gandalf at shopzeus.com
Mon Sep 8 19:18:51 CEST 2008

Iain Dalton wrote:
> Why don't you want to use multiple typefaces?  Many programs that deal
> with multilingual strings use multiple fonts (cf. any Web browser and
> Emacs).
You are right, but these PDF documents will show mixed strings. The end 
user can enter arbitrary strings into the database, and they must be 
presented. For example, the name of a product can be arabic or german. 
It might be possible to guess the language used from the unicode string, 
and then select a different font. But I don't want to go into that trouble.

It would be a great idea to use pango. Apparently pango is able to 
change fonts on the fly and render the requested glyph. However, if I 
use pango then I loose the much higher level of abstraction that comes 
with reportlab and platypus: I need automatic page headers and footers, 
I need to be able to repeat table headers on each page automatically 
(when the table doesn't fit one page) etc. Developing my own "platypus" 
like engine for pango and PDF rendering is a nightmare.

Better than that, I can develop my own flowable object for platypus: a 
special paragraph that changes the used true type font on the fly. 
(Split input string into parts, determine language for the parts and 
display each part with its own font.) But of course this is a lot of 
extra programming.

The simplest solution would be to use a font that is able to handle all 
encodings that I need.



More information about the Python-list mailing list