PHP 7.0.6 Released

CairoContext::setFontFace

cairo_set_font_face

(PECL cairo >= 0.1.0)

CairoContext::setFontFace -- cairo_set_font_faceThe setFontFace purpose

Description

Object oriented style (method):

public void CairoContext::setFontFace ( CairoFontFace $fontface )

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

Return Values

No value is returned

Examples

Example #1 Object oriented style

<?php
// New surface with white background
$s = new CairoImageSurface(CairoFormat::ARGB32300100);
$c = new CairoContext($s);
$c->setSourceRgb(111);
$c->paint();

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

Example #2 Procedural style

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

See Also

User Contributed Notes

There are no user contributed notes for this page.
To Top