Method Cairo.Context()->glyph_extents()


Method glyph_extents

TextExtents glyph_extents(array(Glyph|array(int|float)) glyphs)

Description

Gets the extents for an array of glyphs. The extents describe a user-space rectangle that encloses the "inked" portion of the glyphs, (as they would be drawn by show_glyphs(). Additionally, the x_advance and y_advance values indicate the amount by which the current point would be advanced by show_glyphs().

Note that whitespace glyphs do not contribute to the size of the rectangle (TextExtents->width and TextExtents->height).

Parameter glyphs

an array of glyph IDs with X and Y offsets, with each glyph being represented either as a Glyph object or as an array having the following format:

Array
int 0

glyph index in the font. The exact interpretation of the glyph index depends on the font technology being used.

float|int 1

the offset in the X direction between the origin used for drawing the string and the origin of this glyph

float|int 2

the offset in the Y direction between the origin used for drawing the string and the origin of this glyph

Returns

a TextExtents object which stores the results.