I am trying to make pangocairo to write text on the image. I followed several threads in StackOverflow and followed all. the criteria for this is to install
Pango Cairo gtk libpangocairo and I checked the already installed program and found that they are already installed.
yum list installed
cairo.x86_64 @base
pango.x86_64 @base
gtk2.x86_64 @base
so I did not install again. in that list other program are listed as installed but I think the only external program needs to be installed again I don't want to install the same program again if I can use the base program.
Any help will be great
and my PHP code is directly from Cairo site but I am getting internal server error. seems Pango/Cairo is not working
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
define("RADIUS", 150);
define("N_WORDS", 10);
define("FONT", "Sans Bold 27");
function draw_text($c) {
$c->translate(RADIUS, RADIUS);
$l = new PangoLayout($c);
$l->setText("Text");
$desc = new PangoFontDescription(FONT);
$l->setFontDescription($desc);
for($i = 0; $i < N_WORDS; $i++) {
$angle = 360.0 * $i / N_WORDS;
$red = (1 + cos (($angle - 60) * M_PI / 180)) / 2;
$c->save();
$c->setSourceRGB($red, 0, 1.0 - $red);
$c->rotate($angle * M_PI / 180.0);
$l->updateLayout($c);
$size = $l->getSize();
$c->moveTo( - ((double)$size['width'] / 2048), - RADIUS);
$l->showLayout();
$c->restore();
}
}
$s = new CairoImageSurface(CairoFormat::ARGB32, RADIUS *2, RADIUS *2);
$c = new CairoContext($s);
$c->setSourceRGB(1, 1, 1);
$c->paint();
draw_text($c);
$s->writeToPng('circle.png');
?>