[reportlab-users] Re: warnOnMissingFontGlyphs does not work?

Andy Robinson andy at reportlab.com
Mon Jun 19 13:36:26 EDT 2006

> Unfortunately, that's not the purpose of warnOnMissingFontGlyphs.  All
> that it does is enable an error if the font does not contain glyphs for
> all of the characters in the current encoding.  It doesn't actually
> check each character of each string.

It was written when we first allowed people to embed Type 1 fonts
and I suspect we never actually thought to do the tests when TrueType 
was added.

There is a need now to 'redefine the meaning' of this to be what you 
want, and tell you clearly when you've used a character not in the font. 
  I am not sure what the performance cost would be to scan a font when 
loading it and extract the set of Unicode characters it supports.

>>also, is there a way to specify more fonts, and somehow combine them so 
>>that reportlab picks the needed glyph from them? i mean, so that for 
>>example, arial.ttf will be the default, but when a glyph is missing, he 
>>takes it from kochi-mincho.ttf.
> No, that would be unpredictable, which is never a good thing with PDF. 
> The whole point is to get precise and predictable output.  However,
> Mincho contains all of the glyphs in Arial.  They aren't as pretty, but
> you couldn't just use Mincho for everything.

Actually I believe there is a fallback mechanism under the covers 
somewhere, which Robin Becker added doing the Unicode work.  The idea 
was to switch to the Symbol or Dingbats fonts when Helvetica etc. do not 
have the characters you want.    It has not been documented (in fact 
only Robin Becker here knows about it - he's away today but I'll ask him 
when he's back).

IMHO this kind of fallback is desirable, provided it is explicit and yo 
have to set it up and declare it.  You would essentially be defining 
'synthetic fonts' made of multiple real fonts with an order of 
precedence.    But it probably needs C code to do it at useful speeds.

Thanks for flagging up an important hole/bug/whatever - I wish I had an 
instant fix but don't.   We'll look into this.

- Andy

More information about the reportlab-users mailing list