[reportlab-users] CJK fonts

Jonathan Liu net147 at gmail.com
Sun Jun 26 18:53:23 EDT 2011


On 20/06/2011 7:32 PM, Robin Becker wrote:

> 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.


iText supports specifying a list of fonts that can be selected that are
checked in order for rendering text using the FontSelector class
(http://api.itextpdf.com/itext/com/itextpdf/text/pdf/FontSelector.html).

I use FontSelector in iText quite extensively and it would be good if I
could use ReportLab instead of calling Java from Python to generate PDFs.

Does ReportLab plan to include an equivalent to this in a future version
or is there a way to emulate it?



More information about the reportlab-users mailing list