Next: , Previous: cairo_font_face_t, Up: Top


7 Scaled Fonts

Caching metrics for a particular font size

7.1 Overview

7.2 Usage

— Function: cairo-scaled-font-create (font-face <cairo-font-face-t>) (font-matrix <cairo-matrix-t>) (ctm <cairo-matrix-t>) (options <cairo-font-options-t>) =>  (ret <cairo-scaled-font-t>)

Creates a <cairo-scaled-font-t> object from a font face and matrices that describe the size of the font and the environment in which it will be used.

font-face
a <cairo-font-face-t>
font-matrix
font space to user space transformation matrix for the font. In the simplest case of a N point font, this matrix is just a scale by N, but it can also be used to shear the font or stretch it unequally along the two axes. See cairo-set-font-matrix.
ctm
user to device transformation matrix with which the font will be used.
options
options to use when getting metrics for the font and rendering with it.
ret
a newly created <cairo-scaled-font-t>. Destroy with cairo-scaled-font-destroy
— Function: cairo-scaled-font-extents (scaled-font <cairo-scaled-font-t>) (extents <cairo-font-extents-t>)

Gets the metrics for a <cairo-scaled-font-t>.

scaled-font
a <cairo-scaled-font-t>
extents
a <cairo-font-extents-t> which to store the retrieved extents.
— Function: cairo-scaled-font-text-extents (scaled-font <cairo-scaled-font-t>) (utf8 <char>) (extents <cairo-text-extents-t>)

Gets the extents for a string of text. The extents describe a user-space rectangle that encloses the "inked" portion of the text drawn at the origin (0,0) (as it would be drawn by cairo-show-text if the cairo graphics state were set to the same font_face, font_matrix, ctm, and font_options as scaled-font). Additionally, the x_advance and y_advance values indicate the amount by which the current point would be advanced by cairo-show-text.

Note that whitespace characters do not directly contribute to the size of the rectangle (extents.width and extents.height). They do contribute indirectly by changing the position of non-whitespace characters. In particular, trailing whitespace characters are likely to not affect the size of the rectangle, though they will affect the x_advance and y_advance values.

scaled-font
a <cairo-scaled-font-t>
utf8
a string of text, encoded in UTF-8
extents
a <cairo-text-extents-t> which to store the retrieved extents.

Since 1.2

— Function: cairo-scaled-font-glyph-extents (scaled-font <cairo-scaled-font-t>) (glyphs <cairo-glyph-t>) (num-glyphs <int>) (extents <cairo-text-extents-t>)

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 cairo-show-glyphs if the cairo graphics state were set to the same font_face, font_matrix, ctm, and font_options as scaled-font). Additionally, the x_advance and y_advance values indicate the amount by which the current point would be advanced by cairo_show_glyphs.

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

scaled-font
a <cairo-scaled-font-t>
glyphs
an array of glyph IDs with X and Y offsets.
num-glyphs
the number of glyphs in the glyphs array
extents
a <cairo-text-extents-t> which to store the retrieved extents.
— Function: cairo-scaled-font-get-font-face (scaled-font <cairo-scaled-font-t>) =>  (ret <cairo-font-face-t>)

Gets the font face that this scaled font was created for.

scaled-font
a <cairo-scaled-font-t>
ret
The <cairo-font-face-t> with which scaled-font was created.

Since 1.2

— Function: cairo-scaled-font-get-font-options (scaled-font <cairo-scaled-font-t>) (options <cairo-font-options-t>)

Stores the font options with which scaled-font was created into options.

scaled-font
a <cairo-scaled-font-t>
options
return value for the font options

Since 1.2

— Function: cairo-scaled-font-get-font-matrix (scaled-font <cairo-scaled-font-t>) (font-matrix <cairo-matrix-t>)

Stores the font matrix with which scaled-font was created into matrix.

scaled-font
a <cairo-scaled-font-t>
font-matrix
return value for the matrix

Since 1.2

— Function: cairo-scaled-font-get-ctm (scaled-font <cairo-scaled-font-t>) (ctm <cairo-matrix-t>)

Stores the CTM with which scaled-font was created into ctm.

scaled-font
a <cairo-scaled-font-t>
ctm
return value for the CTM

Since 1.2

— Function: cairo-scaled-font-get-type (scaled-font <cairo-scaled-font-t>) =>  (ret <cairo-font-type-t>)

This function returns the type of the backend used to create a scaled font. See <cairo-font-type-t> for available types.

scaled-font
a <cairo-scaled-font-t>
ret
The type of scaled-font.

Since 1.2