[reportlab-users] Character placement off - bug or am I using it wrong?

ellie el at horse64.org
Sat Aug 20 08:02:57 EDT 2022


Hi everyone,

I have an issue with .drawString() called on reportlab.pdfgen.Canvas, it 
seems characters are placed wrong. For example, for the word "Two" 
(created with reportlab's placement), the "T" and "w" are oddly apart. 
Commas are spaced wrong as well, when I use a hack to use a placement of 
another TTF lib it works.

I use reportlab open-source 3.6.10, Python 3.10.6, and the font "Tex 
Gyre Pagella" from the LaTeX community in TTF format.


It looks like reportlab is placing letters with naive bounding boxes 
rather than to properly overlap special pairs in whatever smart way the 
font would provide. (That might be wrong, just my uninformed guess.) 
Basically, like the sort of "placement hinting" of the font is off (my 
bad if that's not how it's called) and it looks horrible as a result.

Is this a reportlab bug? Is it a problem with the reportlab install, 
like a missing library? Or do I need to pass some option for proper 
placement? If it's a bug, is there hope for a fix? If it's an install 
issue, can I detect this in Python to avoid silently generating broken 
PDFs? The result is ad enough to be useless for serious print.

Regards, ellie

PS: I would attach font & demonstration image but I was told not to, so 
I guess you'll have to find them yourself if you want to check it out


More information about the reportlab-users mailing list