The library is currently unable to properly render text in RTL (Right-to-Left) languages such as Arabic. When attempting to add text in Arabic, for example, the text is rendered in LTR (Left-to-Right) direction, which results in incorrect display and readability issues.
Steps to Reproduce:
from imagetext_py import *
from PIL import Image
FontDB.LoadFromDir("/path/to/fonts")
# using this font: https://fonts.google.com/noto/specimen/Noto+Kufi+Arabic
font = FontDB.Query("NotoKufiArabic-VariableFont_wght")
cv = Canvas(512, 512, (255, 255, 255, 255))
black = Paint.Color((0, 0, 0, 255))
text = "السلام عليكم"
draw_text_wrapped(canvas=cv, text=text, x=256, y=256, ax=0.5, ay=0.5, size=67, width=500, fill=black, align=TextAlign.Center, stroke=2.0, stroke_color=black, font=font)
im = cv.to_image()
im.show()
Expected Behavior:
The Arabic text should be rendered correctly in RTL direction, maintaining the correct reading order and alignment, as shown in the following picture:
Actual Behavior:
The Arabic text is rendered in LTR direction, causing the text to appear incorrectly and affecting readability.
Hi @ihuomtia, there is currently no support for RTL text rendering. It is a really complicated task and I currently don't have the time to add support for it. PR's are welcome however :-)
Description
The library is currently unable to properly render text in RTL (Right-to-Left) languages such as Arabic. When attempting to add text in Arabic, for example, the text is rendered in LTR (Left-to-Right) direction, which results in incorrect display and readability issues.
Steps to Reproduce:
Expected Behavior:
The Arabic text should be rendered correctly in RTL direction, maintaining the correct reading order and alignment, as shown in the following picture:
Actual Behavior:
The Arabic text is rendered in LTR direction, causing the text to appear incorrectly and affecting readability.