Before you asking
Is your feature request related to a problem?
First off, thanks for building such a great tool! It works amazingly well for many layout structures, but there is currently a major rendering issue when translating documents into Right-to-Left (RTL) languages such as Persian (fa), Arabic (ar).
The Problem
While the translation service itself returns accurate translated text, the rendered text on the output PDF canvas is unreadable due to two main layout constraints:
Disconnected Characters (Lack of Shaping): Arabic and Persian script characters are rendered in their isolated forms rather than being connected correctly according to their position in a word.
Reversed Text Flow: Words are placed onto the canvas sequentially from left to right (LTR), causing sentences and words to be drawn completely backward.
Passing custom fonts via parameters (like --vfont) solves glyph missing errors, but it doesn't fix the underlying BiDi (Bidirectional) layout and glyph shaping issues.
Expected Behavior
When --lang-out fa (or any RTL language) is specified, the rendering engine should shape the characters and apply BiDi reordering before placing text elements onto the PDF canvas.
Describe the solution you'd like
In Python, this is usually addressed by processing the translated string before sending it to the PDF canvas layer, using tools such as:
arabic-reshaper (to handle contextual character joining)
python-bidi (to reorder visual text according to the Unicode BiDi algorithm)
Or enabling native HarfBuzz / BiDi shaping if supported by the underlying layout engine.
Having native RTL rendering support would make pdf2zh fully usable for millions of Persian, Arabic, and Hebrew speakers reading academic papers.
I'd be glad to help test any experimental builds or pull requests targeting Persian/RTL text rendering!
Additional context
No response
Before you asking
Is your feature request related to a problem?
First off, thanks for building such a great tool! It works amazingly well for many layout structures, but there is currently a major rendering issue when translating documents into Right-to-Left (RTL) languages such as Persian (fa), Arabic (ar).
The Problem
While the translation service itself returns accurate translated text, the rendered text on the output PDF canvas is unreadable due to two main layout constraints:
Disconnected Characters (Lack of Shaping): Arabic and Persian script characters are rendered in their isolated forms rather than being connected correctly according to their position in a word.
Reversed Text Flow: Words are placed onto the canvas sequentially from left to right (LTR), causing sentences and words to be drawn completely backward.
Passing custom fonts via parameters (like --vfont) solves glyph missing errors, but it doesn't fix the underlying BiDi (Bidirectional) layout and glyph shaping issues.
Expected Behavior
When --lang-out fa (or any RTL language) is specified, the rendering engine should shape the characters and apply BiDi reordering before placing text elements onto the PDF canvas.
Describe the solution you'd like
In Python, this is usually addressed by processing the translated string before sending it to the PDF canvas layer, using tools such as:
arabic-reshaper (to handle contextual character joining)
python-bidi (to reorder visual text according to the Unicode BiDi algorithm)
Or enabling native HarfBuzz / BiDi shaping if supported by the underlying layout engine.
Having native RTL rendering support would make pdf2zh fully usable for millions of Persian, Arabic, and Hebrew speakers reading academic papers.
I'd be glad to help test any experimental builds or pull requests targeting Persian/RTL text rendering!
Additional context
No response