[reportlab-users] Notes for large TrueType font users

Marius Gedminas reportlab-users@reportlab.com
Mon, 7 Oct 2002 13:42:19 +0200


TrueType font parsing is quite slow at the moment.  For example, it
takes about 20 seconds to parse a 14 MB font file.  The culprit which
eats 90% of the time seems to be pdfbase.ttfonts.calcChecksum, which
wants rewriting in C badly.  Any volunteers? ;)  It only does a simple
thing -- sums all 32-bit words (modulo 2**32) in a chunk of data, but
Python makes it rather awkward.

A shorter term workaround is to disable checksum validation in
TTFontParser.  There's a constructor argument validate which defaults to
1 and is never actually passed.  If you trust your TTF fonts not to be
corrupted and want to win some time, you can just set it to 0 in the
sources.

It might make sense to make this tweakable via rl_config.py, I guess --
I'm not familiar with that infrastructure.

Marius Gedminas
-- 
Microsoft -- because God hates us.