CairoContext::fontExtents

cairo_font_extents

Get the font extents

Description

Object oriented style (method):

public array CairoContext::fontExtents ( void )

Procedural style:

array cairo_font_extents ( CairoContext $context )

Gets the font extents for the currently selected font.

Parameters

context

Description...

Return Values

An array containing the font extents for the current font.

Examples

Example #1 Object oriented style

<?php

$sur 
= new CairoImageSurface(CairoFormat::ARGB325050);
$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)
}

Example #2 Procedural style

<?php

$sur 
cairo_image_surface_create(CAIRO_FORMAT_ARGB325050);
$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)
}

See Also

  • Classname::Method