im using imagick api to generate bent texts. it works ok on some occasions, but with some of the fonts, the bending goes berserk. here is the code snippet:-
Code: Select all
$image = new Imagick();
$draw = new ImagickDraw();
$pixel = new ImagickPixel('gray');
$draw->setGravity(imagick::GRAVITY_CENTER);
$draw->setFont($this->font); //use any font here
$draw->setFillColor("#000000");
$draw->setFontSize(20);
$draw->setTextAntialias(false);
$metrics = $image->queryFontMetrics($draw, 'ANIMATIONS');
$bound_width = $metrics['textWidth'];
$bound_height = $metrics['textHeight'];
$image->newImage($bound_width,$bound_height,$pixel);
$image->annotateImage($draw, 0, 0, 0, 'ANIMATIONS');
$image->trimImage(0);
$image->paintTransparentImage('gray', 0.0, 10);
$txtCurve = array();
$txtCurve[] = (int)$this->curve;
$image->distortImage( Imagick::DISTORTION_ARC, 220, false );
$image->setImageFormat('png');
ob_start();
header("Content-type: image/png");
echo $image;
here is the output i get:-
can anyone point out what i am doing wrong here?
thanks..