php教程

CairoContext::fontExtents

cairo_font_extents

(PECL cairo >= 0.1.0)

CairoContext::fontExtents -- cairo_font_extentsGet the font extents

说明

面向对象风格 (method):

public CairoContext::fontExtents ( void ) : array

过程化风格:

cairo_font_extents ( CairoContext $context ) : array

Gets the font extents for the currently selected font.

参数

context

Description...

返回值

An array containing the font extents for the current font.

范例

Example #1 面向对象风格

<?php

$sur 
= new CairoImageSurface(CairoFormat::ARGB325050);
$con = new CairoContext($sur);

var_dump($con->fontExtents());

?>

以上例程的输出类似于:

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 过程化风格

<?php

$sur 
cairo_image_surface_create(CAIRO_FORMAT_ARGB325050);
$con cairo_create($sur);

var_dump(cairo_font_extents($con));

?>

以上例程的输出类似于:

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

参见

  • Classname::Method()

User Contributed Notes

There are no user contributed notes for this page.

CopyRight © 2008-2022 verySource.Com All Rights reserved. 京ICP备17048824号-1 京公网安备:11010502034788