[reportlab-users] Hyphenation

Robin Becker robin at reportlab.com
Mon Jun 25 03:32:10 EDT 2018

On 24/06/2018 22:30, Lele Gaifax wrote:
> Robin Becker <robin at reportlab.com> writes:
>> The hyphenator is not being propagated to any split sub pararagraphs. I
>> think that we don't want to go down the route of supporting large numbers
>> of optional attributes on the paragraph instances that is what the style is
>> for. I tried this and it seems to work.
> Oh, right, I forgot about that, thank you! I will keep using a custom
> Paragraph subclass.
> ciao, lele.

probably I will drop the support for an explicit attribute. If that's done then the easy way for you to subclass Paragraph would 
be something like

from reportlab.platypus import Paragraph
class LeleParagraph(Paragraph):
     def __init__(self, text, style, **kwds):
         hyphenator = kwds.pop('hyphenator',kwds.pop('hyphenationLang',None))
         if hyphenator:
             #override the default
             style = style.clone(style.name+'-hyphenated', hyphenationLang=hyphenator)
         Paragraph.__init__(self,text,style, **kwds)

Robin Becker

More information about the reportlab-users mailing list