CairoContext::showText()
(PECL cairo >= 0.1.0)
The showText purpose
说明
面向对象风格(method):
public CairoContext::showText(string $text): void
过程化风格:
cairo_show_text(CairoContext$context,string $text): void
Description here.
Warning本函数还未编写文档,仅有参数列表。
参数
- $context
Description...
- $text
Description...
返回值
Description...
范例
Example #1 面向对象风格
<?php /* ... */ ?>
以上例程的输出类似于:
...
Example #2 过程化风格
<?php /* ... */ ?>
以上例程的输出类似于:
...
参见
- Classname::Method()
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;