CairoContext::setFontFace

(PECL cairo >= 0.1.0)
The setFontFace purpose
public void CairoContext::setFontFace ( CairoFontFace $fontface )

Object oriented style (method):

Procedural style:

void cairo_set_font_face ( CairoContext $context , CairoFontFace $fontface )

Sets the font-face for a given context.

Parameters:
context

A CairoContext object to change the font-face for.

fontface

A CairoFontFace object

Returns:

No value is returned

Examples:
Object oriented style
<?php
// New surface with white background
$s = new CairoImageSurface(CairoFormat::ARGB32, 300, 100);
$c = new CairoContext($s);
$c->setSourceRgb(1, 1, 1);
$c->paint();

// Draw some text
$c->setSourceRgb(0, 0, 0);
$c->moveTo(10, 60);
// Create a new font face
$f = new CairoToyFontFace("sans-serif", CairoFontSlant::NORMAL, CairoFontWeight::NORMAL);
$c->setFontFace($f);
$c->setFontSize(30);
$c->showText('Hello, World!');
$s->writeToPng(dirname(__FILE__) . '/setFontFace.png');
?>

Procedural style
<?php
/* ... */
?>

See also:

CairoContext::setFontSize() -

CairoContext::showText() -

doc_php
2016-02-24 15:59:04
Comments
Leave a Comment

Please login to continue.