I have a design template that forces me to use very large capital letters for the title. If I have a long word that does not fit on one line, I run into the expected problems, because RL has no built-in hyphens - everything is fine. However, if I have a long compound word containing a hyphen (for example, "VVVVEEEERRRRYYYY-LLLLOOOOONNNNGGGG"), it does not break into a hyphen as I expected.
Expected:
|VVVVEEEERRRRYYYY- |
|LLLLOOOONNNNGGGG |
Actual:
|VVVVEEEERRRRYYYY-LLLLOO|
|OONNNNGGGG |
How can I tell ReportLab to execute a conditional line break when meeting with a hyphen?
BTW, PDF is created using Python 3.4 and reportlab 3.1.8 as follows:
doc = BaseDocTemplate(fname,
leftMargin=20 * mm, rightMargin=20 * mm,
topMargin=25 * mm, bottomMargin=20 * mm)
story = []
frame_first_page = Frame(doc.leftMargin, doc.bottomMargin, doc.width,
doc.height - 24 * mm,
leftPadding=0, rightPadding=0, id='first')
doc.addPageTemplates([PageTemplate(id='first_page',
frames=frame_first_page,
onPage=_on_first_page),
PageTemplate(id='remaining_pages',
frames=frame_remaining_pages,
onPage=_on_remaining_pages)])
story.append(Paragraph(heading_text.upper(), styles["title"]))
doc.build(story)
source
share