[reportlab-users] Hyphenation glitch when using HTML entities

Robin Becker robin at reportlab.com
Sun Dec 5 03:13:33 EST 2021

On 04/12/2021 17:03, Lele Gaifax wrote:
> Hi,
> I have an issue when rendering a justified-hyphenated paragraph containing
> HTML entities. It may very well be a font issue, because I was not able to
> replicate it with a standard font, but I will try harder if that helps.
> Basically, when the paragraph is a plain text everything goes well, but as
> soon as it contains, say, a '"' entity instead of the corresponding
> double quote '"', apparently the machinery that compute the extra space and
> adjust the word space fails, even on subsequent lines of text.
> I wrote a trimmed down example that exhibits the problem:
>    https://gist.github.com/lelit/f0e1ed1e2f9dec431463bec77a047362
> You can see the problem in the third paragraph here:
>    https://gist.github.com/lelit/f0e1ed1e2f9dec431463bec77a047362#file-hyphenation_glitch-pdf
> Does this ring any bell or should I simply blame the specific font's metrics?
> Thanks in advance,
> bye, lele.

I see that the justification has failed in the last paragraph. Use of the quote turns the paragraph into a multi-frag 
para and that is handled differently. It will need some detailed debugging to figure out why.

It looks like the space count has failed in those lines, but exactly why I don't know.
Robin Becker

More information about the reportlab-users mailing list