[reportlab-users] Multiple hyphenation issue

Christoph Zwerschke cito at online.de
Mon Mar 9 11:32:55 EDT 2020


Good to see that ReportLab is still around and some hyphenation support 
has been built-in.

Unfortunately, I'm still struggling with several hyphenation issues.

For instance, when I want to print a very long word in a very narrow 
column, it will be only split once, which may be not sufficient.

Here is an example:

###

from reportlab.pdfgen import canvas
from reportlab.platypus import Frame, Paragraph
from reportlab.lib.styles import ParagraphStyle

pagesize = (80, 120)
c = canvas.Canvas('hyphenation.pdf', pagesize=pagesize)
f = Frame(0, 0, *pagesize)
style = ParagraphStyle(
     'normal', fontName='Helvetica', fontSize=12,
     embeddedHyphenation=1, splitLongWords=0)
text = 'Super-cali-fragi-listic-expi-ali-docious'
f.addFromList([Paragraph(text, style)], c)
c.showPage()
c.save()

###

With ReportLab 3.5.34, you get

Super-cali-
fragi-listic-exp (cut off here)

What I expect is actually this:

Super-cali-
fragi-listic-
expi-ali-
docious

I've already found the problem in Pragraph.breakLines() and fixed it, 
and I'd like to contribute the patch and tests. What's the best way to 
do this? There is a GitHub mirror, can I send a pull request? Or must I 
use mercurial (but I haven't used that for years)?

-- Christoph


More information about the reportlab-users mailing list