ImageMagick unicode font installation on linux not working
I have ImageMagick installed on my CentOS linux server.
I am trying to get ImageMagick to convert unicode (non-roman) fonts to an image. I am able to do this with roman/Latin based fonts but not non-latin such as chinese.
EDIT* When I try to convert non-latin fonts they show up as garbage such as %$??W*??
I have installed unicode fonts on my system and update the ImageMagick type.xml file to reflect this (i have update my locate db as well).
when I run (in my shell):# identify -list Type
I can see that my fonts are installed and that ImageMagick sees them but they (non-latin fonts) still do not work when I run my text-to-image conversion php script
I have checked out another article relating to this : Make ImageMagick recognize a font
But after doing everything there I still have the same problem. Please help.
Thanks.
EDIT: This is the some code related to imagemagick initialization:
$font = 'UNICODE.TTF';
/* Create imagickdraw object */
$draw = new ImagickDraw();
$draw->setFont($font);
$draw->setStrokeAntialias(true);
$draw->setTextAntialias(true);
$draw->setFontSize开发者_运维技巧(100);
$draw->setTextEncoding("UTF-8");
//and than there is a bunch of code I use to manipulate the image shadow etc.
UPDATE Since receiving help via the comments to this post I have learned:
That ImageMagick is capable of converting unicode non-latin characters This was tested by passing a hebrew word to ImageMagick via the linux command line.
Therefore the problem is in the ImageMagick PHP module's ability to interpret unicode non-latin text.
The php file itself has all the necessary elements to support UTF-8 and does in fact create a file with a filename derived from the same text varible I am passing to ImageMagick for image creation. The filename is successfully saved on my server by the php in non-latin unicode text.
I have looked around on the net and cannot find any information on this issue when it comes to using the ImageMagick PHP modules to create and image from text in unicode non-latin font.
Could this be a ImageMagick bug? Any help would be appreciated. thanks.
The solution to this problem was found in a coding issue not seen here which occurs later in my PHP. Basically I split up the string into separate characters and needed to do so in a way that wont destroy 2-byte unicode characters.
I didn't think to show the rest of my code for people trying to help me solve this issue which was a big mistake on my part. lesson learned.
精彩评论