Skip to content

feat(rtl): add end-to-end RTL and bidirectional text support#7011

Open
kuanglijun312 wants to merge 1 commit into
dream-num:devfrom
kuanglijun312:pr/rtl-bidi-support
Open

feat(rtl): add end-to-end RTL and bidirectional text support#7011
kuanglijun312 wants to merge 1 commit into
dream-num:devfrom
kuanglijun312:pr/rtl-bidi-support

Conversation

@kuanglijun312
Copy link
Copy Markdown

@kuanglijun312 kuanglijun312 commented Jun 3, 2026

Summary

Adds right-to-left (RTL) and bidirectional (bidi) text support across the document and spreadsheet rendering stack.

  • core: text-direction helpers, worksheet implicit/explicit direction resolution, and centralized createDocumentModelWithStyle / extractOtherStyle cell-style utilities.
  • engine-render: bidi reordering (via bidi-js), Arabic/Thai/Tibetan language rulers, sub-glyph caret metrics (charAdvances), and per-line right-flush line adjustment.
  • docs-ui / sheets-ui: RTL-aware caret and selection geometry, arrow-key visual↔logical mapping, clipboard text-direction preservation on copy/paste, cell-edit alignment, and formula bar/editor pinned to LTR.
  • ui: default font fallback adjustments.

Adds the bidi-js dependency to @univerjs/engine-render.

Test plan

  • pnpm typecheck passes for all touched packages (core, engine-render, docs-ui, sheets-ui, sheets-formula-ui, sheets, ui).
  • pnpm test passes for the touched packages.
  • eslint reports 0 errors on changed files.
  • New unit tests: bidi reordering, Arabic language ruler, RTL line adjustment.
  • Reviewer: verify visual RTL behavior in the editor / spreadsheet.

Note: this branch is currently based on the v0.25.0 release tag; happy to rebase onto the latest dev if preferred.

Adds right-to-left (RTL) and bidirectional (bidi) text support across the
document and spreadsheet rendering stack.

- core: text-direction helpers, worksheet implicit/explicit direction
  resolution, and centralized createDocumentModelWithStyle /
  extractOtherStyle cell-style utilities
- engine-render: bidi reordering (bidi-js), Arabic/Thai/Tibetan language
  rulers, sub-glyph caret metrics (charAdvances), per-line right-flush
  line adjustment, and RTL default cell alignment
- docs-ui / sheets-ui: RTL-aware caret and selection geometry, arrow-key
  visual<->logical mapping, clipboard direction preservation on
  copy/paste, cell-edit alignment, and formula bar/editor pinned to LTR

Adds the bidi-js dependency to engine-render. New tests cover bidi
reordering, the Arabic language ruler, and RTL line adjustment.
@kuanglijun312 kuanglijun312 force-pushed the pr/rtl-bidi-support branch from 9c5801c to cc65c8d Compare June 3, 2026 12:43
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