[reportlab-users] Character placement off - bug or am I using it wrong?
Tim Roberts
timr at probo.com
Sat Aug 20 14:56:18 EDT 2022
On 8/20/22 05:02, ellie wrote:
> 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.
How did you convert it to a TTF? The font in the TeX library is an OTF
with Postscript outlines, which Reportlab doesn't support.
> 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.
"Kerning" is the word you're looking for. Reportlab knows about
kerning, so if they're in the font, it should work.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the reportlab-users
mailing list