[reportlab-users] CJK fonts

Robin Becker robin at reportlab.com
Mon Jun 20 05:32:52 EDT 2011

On 18/06/2011 06:58, Glenn Linderman wrote:

> So in generating some documents from UTF-8 text files, most of which are in

> European languages, but one is in Chinese (Simplified script), I discovered that

> the Times-New-Roman font that I'd been using for the European languages doesn't

> contain the CJK characters. So the Chinese text I have also has some European

> characters.


> Does the ReportLab API provide a way of selecting multiple fonts at the same

> time, so that characters not in one font will be found in another?


For the T1 fonts we have such a mechanism via a list of substitution fonts.
That's used in pdfbase.pdfmetrics.unicode2T1 to fix up any encoding issues from
the available fonts. That's reasonable for T1 because the maximum number of
glyphs is 256.

In the TTF fonts the assumption is that they cover all of utf8/unicode and we
make lazy subset fonts so we don't get errors at the right time; in fact we only
detect that the font lacks a glyph when we are building the subset. That means
we might end up trying to build a subset for a different font in the middle of
building subsets. I'm not sure how feasible it would be to do that.
Robin Becker

More information about the reportlab-users mailing list