Skip to content

[Bug] RTL (Right-to-Left) layout and text direction are not preserved when exporting to PDF #4833

Description

@xyasharx

Description

When writing Persian (RTL) text in MarkText, the editor renders the layout and text direction correctly (right-aligned text, proper word ordering). However, when exporting the document to PDF (File -> Export -> PDF), the RTL styling and alignment are completely lost. The text in the PDF becomes left-aligned (LTR), list bullet points move to the left, and sentences with mixed LTR/RTL words (e.g., English words inside Persian text) suffer from scrambled and reversed word order.

Steps to Reproduce

  1. Set the editor text direction to Right-to-Left (or write RTL Persian text).
  2. Write a paragraph with mixed Persian and English text (e.g., تست راست به چپ در pdf مشکل دارد).
  3. Observe that it aligns and orders correctly in the editor view (aligned to the right).
  4. Go to File -> Export -> PDF.
  5. Open the exported PDF file.

Expected Behavior

The exported PDF should preserve the RTL alignment, list structures, and correct text ordering just as displayed in the editor.

Actual Behavior

The PDF renders all text as Left-to-Right (LTR). Text is left-aligned, bullet points are placed on the left, and mixed-language sentences have their word order reversed. For example:
تست راست به چپ در pdf مشکل دارد
renders incorrectly as:
مشکل دارد pdf تست راست به چپ در

Screenshots / Logs

Image

Operating System

Windows

MarkText Version

v0.20.0-beta.5

OS Version

Windows 11

Reproducibility

  • I can reliably reproduce this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions