Skip to content

fix(layout): correct Arabic/RTL font sizing, indent direction & mirroring#4

Open
dawidbudaszewski wants to merge 1 commit into
mainfrom
fix/rtl-arabic-rendering
Open

fix(layout): correct Arabic/RTL font sizing, indent direction & mirroring#4
dawidbudaszewski wants to merge 1 commit into
mainfrom
fix/rtl-arabic-rendering

Conversation

@dawidbudaszewski

Copy link
Copy Markdown
Owner

Summary

Three related complex-script (RTL) rendering fixes that align SuperDoc with Word / Pages / Google Docs, in both the editable and paginated layout-engine paths:

  • Complex-script font size & face — runs flagged complex-script (w:rtl / w:cs) now render from w:szCs and the w:rFonts w:cs slot (e.g. Qatar3), instead of falling back to the Latin w:sz / ascii font (often a generator-emitted 12pt Times). Editable: super-converter/styles.js; layout: layout-adapter/attributes/paragraph.ts.
  • Direction-aware indentation — resolves OOXML logical w:start/w:end vs physical w:left/w:right against paragraph direction, so an RTL indent lands on the correct visual edge. Fixes RTL signature blocks collapsing/wrapping under w:jc="both" (encodeCSSFromPPr).
  • RTL indent mirroringmirrorIndentForRtl now only swaps left/right and no longer negates firstLine/hanging, fixing the first-line outdent in the paginated layout engine (bidi.ts).

Test plan

  • image/bidi/paragraph/styles unit tests updated and green
  • Verify Arabic letter (Qatar MoFA template) renders at correct szCs size + cs font in editable and paginated views
  • Verify RTL signature block fits on one line (no wrap/justify gaps)
  • Verify first line of RTL paragraphs indents inward (not outdented) with layout engine on

Part of the @scale fork release (SCALE_BRANCHES).

Made with Cursor

…ring

Three related complex-script (RTL) rendering fixes that align SuperDoc with
Word/Pages/Google Docs in both the editable and paginated layout-engine paths:

- Complex-script font size & face: render runs flagged complex-script (w:rtl /
  w:cs) from w:szCs and the w:rFonts w:cs slot, instead of falling back to the
  Latin w:sz / ascii font (often a generator-emitted 12pt Times). Applied in
  super-converter/styles.js (editable) and layout-adapter paragraph.ts (layout).

- Direction-aware indentation: resolve OOXML logical w:start/w:end vs physical
  w:left/w:right against paragraph direction so an RTL indent lands on the
  correct visual edge; fixes RTL signature blocks collapsing/wrapping under
  w:jc="both" (encodeCSSFromPPr).

- RTL indent mirroring: mirrorIndentForRtl now only swaps left/right and no
  longer negates firstLine/hanging, fixing the first-line outdent in the
  paginated layout engine (bidi.ts).

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant