[reportlab-users] Character placement off - bug or am I using it wrong?
ellie
el at horse64.org
Sun Aug 21 01:42:31 EDT 2022
Thanks for your answer!
Sorry for responding to the wrong message here, but your e-mail sadly
didn't arrive for me while some others did, I'm not sure why.
Tim Roberts timr at probo.com wrote:
> How did you convert it to a TTF? The font in the TeX library is an
> OTF
There is also a TTF version which I used, sadly I can't attach it.
However, I noticed a screenshot alone works, so I attached that. Look at
the "Tw" in "Two" or all the commas, upper render is reportlab
placement, lower is with what should be with font kerning working
(although due to my hacky approach to override it, maybe some hinting or
other details isn't, so it's not 100% correct, just less wrong).
Given the kerning works with a different TTF library with the same font
file, I would assume it's kind of out of the question the font contains
it. That is why I'm wondering why it doesn't work with reportlab.
Is this a bug in reportlab then? Where can I report it with all the
files like the font attached? I assume people would kind of hope for
something like basic glyph placement in a PDF library to work, so maybe
a fix might be worth a consideration.
On 8/16/22 8:21 PM, ellie wrote:
> Hi everyone,
>
> I have an issue with .drawString() called on reportlab.pdfgen.Canvas
> shown in the attached image, it seems characters are placed wrong. For
> example, look at the word "Two" in the upper paragraph (created with
> reportlab's placement), see how the "T" and "w" are oddly apart.
>
> Also compare to the lower image (created via a hack overriding reportlab
> placement), especially also all the commas which seem to be spaced too
> far to the right by reportlab as well.
>
> I use reportlab open-source 3.6.10, Python 3.10.6, and the attached 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.)
>
> 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 better
> 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?
>
> Regards, ellie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reportlabhmweird.jpg
Type: image/jpeg
Size: 18550 bytes
Desc: not available
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20220821/b91f15fe/attachment.jpg>
More information about the reportlab-users
mailing list