©
Ce document utilise Manuel du site Web PHP chinois Libérer
(PECL cairo >= 0.1.0)
CairoContext::setFontFace -- cairo_set_font_face — The setFontFace purpose
面向对象风格 (method):
$fontface
)过程化风格:
$context
, CairoFontFace $fontface
)Sets the font-face for a given context.
context
A CairoContext object to change the font-face for.
fontface
A CairoFontFace object
No value is returned
Example #1 面向对象风格
<?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' );
?>
Example #2 过程化风格
<?php
?>