Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTL Language Rendering Problem #14

Open
ihuomtia opened this issue Apr 29, 2024 · 0 comments
Open

RTL Language Rendering Problem #14

ihuomtia opened this issue Apr 29, 2024 · 0 comments

Comments

@ihuomtia
Copy link

ihuomtia commented Apr 29, 2024

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:

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:

image

Actual Behavior:

The Arabic text is rendered in LTR direction, causing the text to appear incorrectly and affecting readability.

image

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

No branches or pull requests

1 participant