From e62a5e18a2497ff8c4eeff20d8d6da145fd7c5a6 Mon Sep 17 00:00:00 2001 From: Richard Schreiber Date: Tue, 21 Jun 2022 10:23:48 +0200 Subject: [PATCH] PDF render: enable word-wrap on hyphens (Z#23101879) --- src/pretix/base/pdf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pretix/base/pdf.py b/src/pretix/base/pdf.py index 7f575837c6..cc584072cc 100644 --- a/src/pretix/base/pdf.py +++ b/src/pretix/base/pdf.py @@ -831,9 +831,10 @@ class Renderer: textColor=Color(o['color'][0] / 255, o['color'][1] / 255, o['color'][2] / 255), alignment=align_map[o['align']] ) + # add an almost-invisible space   after hyphens as word-wrap in ReportLab only works on space chars text = conditional_escape( self._get_text_content(op, order, o) or "", - ).replace("\n", "
\n") + ).replace("\n", "
\n").replace("-", "- ") # reportlab does not support RTL, ligature-heavy scripts like Arabic. Therefore, we use ArabicReshaper # to resolve all ligatures and python-bidi to switch RTL texts.