Zulko / moviepy

Video editing with Python
https://zulko.github.io/moviepy/
MIT License
12.57k stars 1.58k forks source link

[Feature] Support for RTL languages #1694

Open wallid opened 2 years ago

wallid commented 2 years ago

I've tried using generating text clips with Arabic text and it results in the letters come out separated and mirrored. Support for RTL languages would be highly appreciated.

naskio commented 2 years ago

You can use arabic-reshaper and python-bidi to display an Arabic text

import arabic_reshaper # pip install arabic-reshaper
from bidi.algorithm import get_display # pip install python-bidi

text = 'مهدي نسيم'
reshaped_text = arabic_reshaper.reshape(text)    # correct its shape
bidi_text = get_display(reshaped_text)           # correct its direction
print(bidi_text)
TextClip(bidi_text, font="Arial", fontsize=50, color='black')