Annotate() not working for arabic text?

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
bikash00789
Posts: 5
Joined: 2016-04-05T12:09:53-07:00
Authentication code: 1151

Annotate() not working for arabic text?

Post by bikash00789 »

Why arabic is coming question mark? I have tried lot of things nothing worked

Code: Select all

$final_image = new Imagick();
$final_image->newImage( 800, 420, new ImagickPixel('#ffffff'));
$final_image->setImageFormat('jpg');

$draw = new ImagickDraw();
$draw->setFillColor('#000');
$draw->setFont('AvantGarde-Demi');
$draw->setFontSize( 30 );

//Message1 is Hello my name is
$message1= "مرحبا اسمي";
$final_image->annotateImage( $draw, 40, 20, 0, "$message1");

$final_image->annotateImage( $draw, 40, 80, 0, "this text is in english");
Below is the output,
screencapture-cdn-meaww-com-answerspictures-one_word_personality-20160811-19505031470919935-17-jpg-1470920421391.png
screencapture-cdn-meaww-com-answerspictures-one_word_personality-20160811-19505031470919935-17-jpg-1470920421391.png (32.42 KiB) Viewed 12294 times
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Annotate() not working for arabic text?

Post by fmw42 »

The message1 text must be UTF-8 compatible. So the font and the tool that creates it both must be UTF-8 compliant
Post Reply