[reportlab-users] Multiple hyphenation issue

Robin Becker robin at reportlab.com
Tue Mar 10 10:39:23 EDT 2020


On 09/03/2020 15:32, Christoph Zwerschke wrote:
> 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
........

just post the patch here. The github mirror is exactly that and we copy directly from the mercurial.
-- 
Robin Becker


More information about the reportlab-users mailing list