(PECL cairo >= 0.1.0)
CairoContext::fontExtents -- cairo_font_extents — Get the font extents
Estilo orientado à objeto (method):
Estilo procedural:
Gets the font extents for the currently selected font.
context
Description...
An array containing the font extents for the current font.
Exemplo #1 Estilo orientado à objeto
<?php
$sur = new CairoImageSurface(CairoFormat::ARGB32, 50, 50);
$con = new CairoContext($sur);
var_dump($con->fontExtents());
?>
O exemplo acima irá imprimir algo similar à:
array(5) { ["ascent"]=> float(10) ["descent"]=> float(3) ["height"]=> float(13.3125) ["max_x_advance"]=> float(26.65625) ["max_y_advance"]=> float(0) }
Exemplo #2 Estilo procedural
<?php
$sur = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 50, 50);
$con = cairo_create($sur);
var_dump(cairo_font_extents($con));
?>
O exemplo acima irá imprimir algo similar à:
array(5) { ["ascent"]=> float(10) ["descent"]=> float(3) ["height"]=> float(13.3125) ["max_x_advance"]=> float(26.65625) ["max_y_advance"]=> float(0) }