CairoContext::showText

cairo_show_text

(PECL cairo >= 0.1.0)

CairoContext::showText -- cairo_show_textThe showText purpose

Opis

Styl obiektowy (method):

public CairoContext::showText ( string $text ) : void

Styl proceduralny:

cairo_show_text ( CairoContext $context , string $text ) : void

Description here.

Ostrzeżenie

Ta funkcja jest obecnie nieudokumentowana, dostępna jest jedynie lista jej argumentów.

Parametry

context

Description...

text

Description...

Zwracane wartości

Description...

Przykłady

Przykład #1 Styl obiektowy

<?php
/* ... */
?>

Powyższy przykład wyświetli coś podobnego do:

...

Przykład #2 Styl proceduralny

<?php
/* ... */
?>

Powyższy przykład wyświetli coś podobnego do:

...

Zobacz też:

  • Classname::Method()

add a note add a note

User Contributed Notes 1 note

up
0
Volomike on Twitter
14 years ago
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;
To Top