Cairo::ScaledFont Class Reference

List of all members.

Detailed Description

A ScaledFont is a font scaled to a particular size and device resolution.

It is most useful for low-level font usage where a library or application wants to cache a reference to a scaled font to speed up the computation of metrics.


Public Types

typedef cairo_scaled_font_t cobject
 The underlying C cairo object type.

Public Member Functions

const cobject * cobj () const
 Provides acces to the underlying C cairo object.
cobject * cobj ()
 Provides acces to the underlying C cairo object.
void extents (FontExtents &extents) const
 Gets the metrics for a ScaledFont.
void get_ctm (Matrix &ctm) const
 Gets the CTM with which the ScaledFont was created.
RefPtr< FontFace > get_font_face () const
 The FontFace with which this ScaledFont was created.
void get_font_matrix (Matrix &font_matrix) const
 Gets the font matrix with which the ScaledFont was created.
void get_font_options (FontOptions &options) const
 Gets the FontOptions with which the ScaledFont was created.
FontType get_type () const
 Gets the type of scaled Font.
void glyph_extents (const std::vector< Glyph > &glyphs, TextExtents &extents)
 Gets the extents for an array of glyphs.
 ScaledFont (cobject *cobj, bool has_reference=false)
 Createa C++ wrapper object from the C instance.
void text_extents (const std::string &utf8, TextExtents &extents) const
 Gets the extents for a string of text.

Static Public Member Functions

static RefPtr< ScaledFont > create (FontFace &font_face, const Matrix &font_matrix, const Matrix &ctm, const FontOptions &options)
 Creates a ScaledFont object from a font face and matrices that describe the size of the font and the environment in which it will be used.

Protected Attributes

cobject * m_cobject
 The underlying C cairo object that is wrapped by this ScaledFont.


Member Typedef Documentation

typedef cairo_scaled_font_t Cairo::ScaledFont::cobject
 

The underlying C cairo object type.


Constructor & Destructor Documentation

Cairo::ScaledFont::ScaledFont (  cobject *  cobj,
bool  has_reference = false
)  [explicit]
 

Createa C++ wrapper object from the C instance.

This C++ object should then be given to a RefPtr.


Member Function Documentation

const cobject* Cairo::ScaledFont::cobj (   )  const [inline]
 

Provides acces to the underlying C cairo object.

cobject* Cairo::ScaledFont::cobj (   )  [inline]
 

Provides acces to the underlying C cairo object.

static RefPtr<ScaledFont> Cairo::ScaledFont::create (  FontFace &  font_face,
const Matrix &  font_matrix,
const Matrix &  ctm,
const FontOptions &  options
)  [static]
 

Creates a ScaledFont object from a font face and matrices that describe the size of the font and the environment in which it will be used.

Parameters:
font_face A font face.
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 Context::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.

void Cairo::ScaledFont::extents (  FontExtents &  extents  )  const
 

Gets the metrics for a ScaledFont.

void Cairo::ScaledFont::get_ctm (  Matrix &  ctm  )  const
 

Gets the CTM with which the ScaledFont was created.

Since:
1.2

RefPtr<FontFace> Cairo::ScaledFont::get_font_face (   )  const
 

The FontFace with which this ScaledFont was created.

Since:
1.2

void Cairo::ScaledFont::get_font_matrix (  Matrix &  font_matrix  )  const
 

Gets the font matrix with which the ScaledFont was created.

Since:
1.2

void Cairo::ScaledFont::get_font_options (  FontOptions &  options  )  const
 

Gets the FontOptions with which the ScaledFont was created.

Since:
1.2

FontType Cairo::ScaledFont::get_type (   )  const
 

Gets the type of scaled Font.

Since:
1.2

void Cairo::ScaledFont::glyph_extents (  const std::vector< Glyph > &  glyphs,
TextExtents &  extents
) 
 

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 Context::show_glyphs() if the cairo graphics state were set to the same font_face, font_matrix, ctm, and font_options as the ScaledFont object). Additionally, the x_advance and y_advance values indicate the amount by which the current point would be advanced by Context::show_glyphs().

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

Parameters:
glyphs A vector of glyphs to calculate the extents of
extents Returns the extents for the array of glyphs

void Cairo::ScaledFont::text_extents (  const std::string &  utf8,
TextExtents &  extents
)  const
 

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 Context::show_text() if the cairo graphics state were set to the same font_face, font_matrix, ctm, and font_options as the ScaledFont object). Additionally, the x_advance and y_advance values indicate the amount by which the current point would be advanced by Context::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.

Parameters:
utf8 a string of text, encoded in UTF-8
extents Returns the extents of the given string
Since:
1.2


Member Data Documentation

cobject* Cairo::ScaledFont::m_cobject [protected]
 

The underlying C cairo object that is wrapped by this ScaledFont.


The documentation for this class was generated from the following file:
Generated on Mon Aug 21 14:17:54 2006 for cairomm by  doxygen 1.4.6