mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
PDF: Fix Arabic string rendering
This commit is contained in:
@@ -862,6 +862,10 @@ class Renderer:
|
|||||||
self._get_text_content(op, order, o) or "",
|
self._get_text_content(op, order, o) or "",
|
||||||
).replace("\n", "<br/>\n").replace("-", "- ")
|
).replace("\n", "<br/>\n").replace("-", "- ")
|
||||||
|
|
||||||
|
# reportlab does not support unicode combination characters
|
||||||
|
# It's important we do this before we use ArabicReshaper
|
||||||
|
text = unicodedata.normalize("NFKC", text)
|
||||||
|
|
||||||
# reportlab does not support RTL, ligature-heavy scripts like Arabic. Therefore, we use ArabicReshaper
|
# 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.
|
# to resolve all ligatures and python-bidi to switch RTL texts.
|
||||||
try:
|
try:
|
||||||
@@ -869,9 +873,6 @@ class Renderer:
|
|||||||
except:
|
except:
|
||||||
logger.exception('Reshaping/Bidi fixes failed on string {}'.format(repr(text)))
|
logger.exception('Reshaping/Bidi fixes failed on string {}'.format(repr(text)))
|
||||||
|
|
||||||
# reportlab does not support unicode combination characters
|
|
||||||
text = unicodedata.normalize("NFKC", text)
|
|
||||||
|
|
||||||
p = Paragraph(text, style=style)
|
p = Paragraph(text, style=style)
|
||||||
w, h = p.wrapOn(canvas, float(o['width']) * mm, 1000 * mm)
|
w, h = p.wrapOn(canvas, float(o['width']) * mm, 1000 * mm)
|
||||||
# p_size = p.wrap(float(o['width']) * mm, 1000 * mm)
|
# p_size = p.wrap(float(o['width']) * mm, 1000 * mm)
|
||||||
|
|||||||
Reference in New Issue
Block a user