CairoContext::fontExtents

(PECL cairo >= 0.1.0)
Get the font extents
public array CairoContext::fontExtents ( void )

Object oriented style (method):

Procedural style:

array cairo_font_extents ( CairoContext $context )

Gets the font extents for the currently selected font.

Parameters:
context

Description...

Returns:

An array containing the font extents for the current font.

Examples:
Object oriented style
<?php

$sur = new CairoImageSurface(CairoFormat::ARGB32, 50, 50);
$con = new CairoContext($sur);

var_dump($con->fontExtents());

?>

The above example will output something similar to:

array(5) {
  ["ascent"]=>
  float(10)
  ["descent"]=>
  float(3)
  ["height"]=>
  float(13.3125)
  ["max_x_advance"]=>
  float(26.65625)
  ["max_y_advance"]=>
  float(0)
}
Procedural style
<?php

$sur = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 50, 50);
$con = cairo_create($sur);

var_dump(cairo_font_extents($con));

?>

The above example will output something similar to:

array(5) {
  ["ascent"]=>
  float(10)
  ["descent"]=>
  float(3)
  ["height"]=>
  float(13.3125)
  ["max_x_advance"]=>
  float(26.65625)
  ["max_y_advance"]=>
  float(0)
}
doc_php
2016-02-24 15:58:56
Comments
Leave a Comment

Please login to continue.