diff --git a/docs/reference/ImageDraw.rst b/docs/reference/ImageDraw.rst index f81bb7fac93..ff8039c4573 100644 --- a/docs/reference/ImageDraw.rst +++ b/docs/reference/ImageDraw.rst @@ -482,6 +482,20 @@ Methods .. versionadded:: 6.0.0 + .. note:: **Complex scripts.** When libraqm is available, Pillow + performs shaping and applies the bidirectional algorithm itself, so + do not pre-process text with ``arabic_reshaper`` and ``python-bidi`` + first: the text would be shaped and reordered twice, and the result + is incorrect. ``arabic_reshaper`` also drops diacritics. This + pre-processing is only needed on builds without libraqm, so check + ``PIL.features.check("raqm")`` at runtime, in the environment doing + the rendering, to decide whether it is needed:: + + from PIL import features + + if not features.check("raqm"): + text = get_display(arabic_reshaper.reshape(text)) + :param stroke_width: The width of the text stroke. .. versionadded:: 6.2.0