diff --git a/packages/layout-engine/painters/dom/src/features/feature-registry.ts b/packages/layout-engine/painters/dom/src/features/feature-registry.ts index 05cab44146..831c2e3eaf 100644 --- a/packages/layout-engine/painters/dom/src/features/feature-registry.ts +++ b/packages/layout-engine/painters/dom/src/features/feature-registry.ts @@ -32,11 +32,14 @@ export const RENDERING_FEATURES = { spec: '§17.3.1.31', }, - // ─── RTL Paragraph ───────────────────────────────────────────── + // ─── Inline Direction ────────────────────────────────────────── + // Paragraph/run inline bidi handling. NOT table visual direction + // (w:bidiVisual, §17.4.1), NOT writing mode (w:textDirection, + // §17.3.1.41 paragraph / §17.4.72 cell; values in §17.18.93). // @spec ECMA-376 §17.3.1.1 (bidi), §17.3.2.30 (rtl) 'w:bidi': { - feature: 'rtl-paragraph', - module: './rtl-paragraph', + feature: 'inline-direction', + module: './inline-direction', handles: ['w:pPr/w:bidi', 'w:rPr/w:rtl'], spec: '§17.3.1.1', }, diff --git a/packages/layout-engine/painters/dom/src/features/inline-direction/index.ts b/packages/layout-engine/painters/dom/src/features/inline-direction/index.ts new file mode 100644 index 0000000000..14ab684072 --- /dev/null +++ b/packages/layout-engine/painters/dom/src/features/inline-direction/index.ts @@ -0,0 +1,22 @@ +/** + * Inline Direction - rendering feature module + * + * Centralises paragraph base-direction and run-level RTL/bidi handling + * used by DomPainter: + * - Detecting whether a paragraph is RTL + * - Applying dir="rtl" and the correct text-align to an element + * - Resolving text-align for RTL vs LTR (justify -> right/left) + * - Deciding whether segment-based (absolute) positioning is safe + * + * Scope is paragraph/run inline bidi handling only. Table visual + * direction (w:bidiVisual, ECMA-376 §17.4.1) is a separate orthogonal + * axis owned by the painter's table rendering path. Writing mode + * (w:textDirection, ECMA-376 §17.3.1.41 paragraph / §17.4.72 cell; + * values in §17.18.93 ST_TextDirection) is another separate axis. + * + * @ooxml w:pPr/w:bidi - paragraph bidirectional flag + * @ooxml w:rPr/w:rtl - run-level right-to-left flag + * @spec ECMA-376 §17.3.1.1 (bidi), §17.3.2.30 (rtl) + */ + +export { applyRtlStyles, shouldUseSegmentPositioning } from './rtl-styles.js'; diff --git a/packages/layout-engine/painters/dom/src/features/rtl-paragraph/rtl-styles.ts b/packages/layout-engine/painters/dom/src/features/inline-direction/rtl-styles.ts similarity index 100% rename from packages/layout-engine/painters/dom/src/features/rtl-paragraph/rtl-styles.ts rename to packages/layout-engine/painters/dom/src/features/inline-direction/rtl-styles.ts diff --git a/packages/layout-engine/painters/dom/src/features/rtl-paragraph/index.ts b/packages/layout-engine/painters/dom/src/features/rtl-paragraph/index.ts deleted file mode 100644 index 6407b5c1b2..0000000000 --- a/packages/layout-engine/painters/dom/src/features/rtl-paragraph/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * RTL Paragraph — rendering feature module - * - * Centralises all right-to-left paragraph logic used by DomPainter: - * - Detecting whether a paragraph is RTL - * - Applying dir="rtl" and the correct text-align to an element - * - Resolving text-align for RTL vs LTR (justify → right/left) - * - Deciding whether segment-based (absolute) positioning is safe - * - * @ooxml w:pPr/w:bidi — paragraph bidirectional flag - * @ooxml w:rPr/w:rtl — run-level right-to-left flag - * @spec ECMA-376 §17.3.1.1 (bidi), §17.3.2.30 (rtl) - */ - -export { applyRtlStyles, shouldUseSegmentPositioning } from './rtl-styles.js'; diff --git a/packages/layout-engine/painters/dom/src/renderer.ts b/packages/layout-engine/painters/dom/src/renderer.ts index a9903dde5e..1275d329a7 100644 --- a/packages/layout-engine/painters/dom/src/renderer.ts +++ b/packages/layout-engine/painters/dom/src/renderer.ts @@ -125,7 +125,7 @@ import { stampBetweenBorderDataset, type BetweenBorderInfo, } from './features/paragraph-borders/index.js'; -import { applyRtlStyles, shouldUseSegmentPositioning } from './features/rtl-paragraph/index.js'; +import { applyRtlStyles, shouldUseSegmentPositioning } from './features/inline-direction/index.js'; import { convertOmmlToMathml } from './features/math/index.js'; /**