Re: Hyphenation

Robin Becker <[email protected]>
Newsgroups gmane.comp.python.reportlab.user
Message-ID <[email protected]>
On 24/06/2018 22:30, Lele Gaifax wrote:
> Robin Becker <[email protected]> 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.
> 
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.