note 96149 added to cairocontext.showtext
| From: | VolomikeonTwitter at osu1 dot php dot net | Date: | Thu, 11 Feb 2010 06:14:57 +0000 |
| Subject: | note 96149 added to cairocontext.showtext | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165858@lists.php.net to get a copy of this message | ||
This is an example of the showText() method for drawing text on a surface. Note that
selectFontFace() will select fonts that your OS recognizes and I didn't see a way in the
current API to select a font by filename.
<?php
$surface = new CairoImageSurface(CAIRO_FORMAT_ARGB32, 960, 250);
$ctx = new CairoContext($surface);
$ctx->selectFontFace('EuropaGroNr2SH-XBolCon');
$ctx->setFontSize(30);
$ctx->setAntialias(1);
$ctx->moveTo(0, 44);
$ctx->showText('Hello,');
$ctx->moveTo(30, 74);
$ctx->showText('world!');
$sName = tempnam('/tmp','hello');
$surface->writeToPng($sName);
$data = file_get_contents($sName);
unlink($sName);
header('Content-Type: image/png');
echo $data;
----
Server IP: 64.71.164.2
Probable Submitter: 68.238.127.6
----
Manual Page -- http://www.php.net/manual/en/cairocontext.showtext.php
Edit -- https://master.php.net/note/edit/96149
Del: integrated -- https://master.php.net/note/delete/96149/integrated
Del: useless -- https://master.php.net/note/delete/96149/useless
Del: bad code -- https://master.php.net/note/delete/96149/bad+code
Del: spam -- https://master.php.net/note/delete/96149/spam
Del: non-english -- https://master.php.net/note/delete/96149/non-english
Del: in docs -- https://master.php.net/note/delete/96149/in+docs
Del: other reasons-- https://master.php.net/note/delete/96149
Reject -- https://master.php.net/note/reject/96149
Search -- https://master.php.net/manage/user-notes.php