I would like to draw Arabic text into bitmap (bmp or png) with command line interface.
I have tried imagemagick and RMagick, but I have problem with RTL language issue. all my rendering are left to right. And google is not helping.
require:
./render "لوحة المفاتيح" out.png
would give a bitmap:
لوحة المفاتيح
Anyone can give me some successful results?
Anyone can give me some successful results?
I can. I use convert
from ImageMagick:
echo لوحة المفاتيح > text.txt && \
convert -size 300x200 \
-background white \
-fill black \
-font /usr/share/fonts/truetype/droid/DroidNaskh-Regular.ttf \
-pointsize 24 \
-gravity Center \
label:@text.txt \
text.png
This is the result:
Some notes:
UPDATE I didn't notice the RTL part of the question; I think I got better results using pango (reference):
# On Ubuntu
sudo apt-get install libpango1.0-dev
echo -n لوحة المفاتيح > text.txt
pango-view text.txt --no-display --output text.png
Result: