Skip to content

Warn against pre-processing text with arabic_reshaper and python-bidi on Raqm builds - #10408

Closed
SudiptoKumar wants to merge 1 commit into
python-pillow:mainfrom
SudiptoKumar:docs/raqm-preprocessing-warning
Closed

SudiptoKumar wants to merge 1 commit into
python-pillow:mainfrom
SudiptoKumar:docs/raqm-preprocessing-warning

Conversation

@SudiptoKumar

Copy link
Copy Markdown

Adds the warning proposed in #9907 to the libraqm bullet in the building-from-source docs, where the bidirectional/shaping sentence quoted in the issue lives.

On a Raqm build, Pillow already performs bidirectional reordering (FriBiDi) and shaping (HarfBuzz). The widely-copied recipe of pre-applying arabic_reshaper and python-bidi — still necessary on builds without Raqm — therefore processes the text twice: it renders incorrectly, and the reshape step itself rewrites the string (lam-alef merged into a single presentation form, diacritics dropped). The new bullet states this and points readers at the conditional form:

if not features.check("raqm"):
    text = get_display(arabic_reshaper.reshape(text))

Docs-only change, one bullet added, no other files touched. Happy to move or reword the note if another location (e.g. the features reference or the text-drawing docs) is preferred.

@akx

akx commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

How does this relate to #9907?

@SudiptoKumar

Copy link
Copy Markdown
Author

#9907 asks for a short docs note warning that pre-applying arabic_reshaper + python-bidi corrupts text on a Raqm build, because Raqm already performs the shaping (HarfBuzz) and bidirectional reordering (FriBiDi) itself — so the widely-copied recipe processes the text twice.

This PR adds that warning as one bullet in docs/installation/building-from-source.rst, directly under the libraqm passage #9907 quotes ("libraqm provides bidirectional text support (using FriBiDi), shaping (using HarfBuzz)"). The bullet covers the points the issue raises:

  • the recipe is only needed on builds without Raqm; with Raqm the text renders incorrectly,
  • reshaping also rewrites the string itself — lam-alef merged into a single presentation form, diacritics dropped,
  • the conditional form, guarded by features.check("raqm"), is the safe way to keep the recipe.

Happy to move or reword the note if you'd rather see it on a different page (e.g. the text-drawing or features docs).

@akx

akx commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Sorry, I meant #9925.

@SudiptoKumar

Copy link
Copy Markdown
Author

You're right to flag it — it doesn't add anything over #9925. That PR, from the author of #9907, already covers this warning (and goes further, with the run-time warning), and it predates this one; #9914 covering the same ground was already closed as well.

I checked open issues for maintainer-scoped work before opening this and missed that a PR for #9907 was already in flight. Closing this as a duplicate — #9925 is the right vehicle for the fix. Apologies for the noise.

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.

2 participants