Files
Mouhand Kaddo 1d0b311b4a Preserve Arabic cell direction and RTL sheet layout in PDF exports (#955)
**Stacked on #940.** It contains all of #940 (Arabic shaping in PDF) and adds cell direction and right-to-left sheet geometry (`M12.AR5`). Review the [diff against #940's branch](https://github.com/Mouhand-Kaddo/gridcraft/compare/fix/arabic-pdf-text...fix/arabic-pdf-reading-direction); once #940 merges, this PR is up to date with it.

## Summary

PDF export now honors cell Context, Left-to-Right and Right-to-Left settings. Wrapped lines keep their paragraph direction. Right-to-left sheets place columns, repeated headings, merged cells and objects in the same order as the grid, and explicit Left and Right alignment stay on the side the grid shows them.

```diff
 PDF export
- infer each line separately; place every sheet left to right
+ preserve cell direction across lines; mirror RTL sheet positions
+ reject oversized text before appending an incomplete PDF block
```

Depends on #940 (Arabic PDF glyphs). The cell reading direction it reads landed with #947.

## Evidence

- **Before:** PDF ignored explicit reading order and RTL sheet layout. A public size-limit probe returned a PDF with an unmatched marked-content block.
  **After:** Direction, wrapped paragraphs, numeric brackets, RTL columns, headings, objects, clipping and sparklines have focused regressions. The same size-limit probe returns an error; its regression failed before the fix and passes afterward.
- At the current head, with Noto Sans Arabic installed and no `CRAFT_FONTS_DIR`: the `gridcraft-pdf` and `gridcraft-engine` tests, workspace clippy and fmt pass. The full `cargo xtask ci` with the craft-fonts bundle relies on the hosted gate.
- Poppler rendering inspected for LTR and RTL sheets. Bounding boxes confirm reversed column positions; logical Arabic strings remain searchable. No physical printer test.

## Merge Danger

**Door:** Two-way. Revert the commit to restore prior export behavior.

**Blast Radius:** PDF. Explicit cell direction is shared with XLSX persistence. Latin text retains the standard-font path, including forced RTL numeric text without an Arabic font.
2026-11-15 17:55:04 +01:00
..