ScaledFont

cairo_scaled_font_t represents a realization of a font face at a particular size and transformation and a certain set of font options.

Constructors

this
this(cairo_scaled_font_t* cairo_scaled_font)

Sets our main struct and passes it to the parent class

Members

Functions

destroy
void destroy()

Decreases the reference count on font by one. If the result is zero, then font and all associated resources are freed. See ScaledFont.reference. Since 1.0

extents
void extents(cairo_font_extents_t* extents)

Gets the metrics for a cairo_scaled_font_t. Since 1.0

getCtm
void getCtm(Matrix ctm)

Stores the CTM with which scaled_font was created into ctm. Note that the translation offsets (x0, y0) of the CTM are ignored by ScaledFont.create. So, the matrix this function returns always has 0,0 as x0,y0. Since 1.2

getFontFace
FontFace getFontFace()

Gets the font face that this scaled font uses. This might be the font face passed to ScaledFont.create, but this does not hold true for all possible cases. Since 1.2

getFontMatrix
void getFontMatrix(Matrix fontMatrix)

Stores the font matrix with which scaled_font was created into matrix. Since 1.2

getFontOptions
void getFontOptions(FontOption options)

Stores the font options with which scaled_font was created into options. Since 1.2

getReferenceCount
uint getReferenceCount()

Returns the current reference count of scaled_font. Since 1.4

getScaleMatrix
void getScaleMatrix(Matrix scaleMatrix)

Stores the scale matrix of scaled_font into matrix. The scale matrix is product of the font matrix and the ctm associated with the scaled font, and hence is the matrix mapping from font space to device space. Since 1.8

getScaledFontStruct
cairo_scaled_font_t* getScaledFontStruct()

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
cairo_font_type_t getType()

This function returns the type of the backend used to create a scaled font. See cairo_font_type_t for available types. However, this function never returns CAIRO_FONT_TYPE_TOY. Since 1.2

getUserData
void* getUserData(cairo_user_data_key_t* key)

Return user data previously attached to scaled_font using the specified key. If no user data has been attached with the given key this function returns NULL. Since 1.4

glyphExtents
void glyphExtents(cairo_glyph_t* glyphs, int numGlyphs, cairo_text_extents_t* 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 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). Since 1.0

reference
ScaledFont reference()

Increases the reference count on scaled_font by one. This prevents scaled_font from being destroyed until a matching call to ScaledFont.destroy is made. The number of references to a cairo_scaled_font_t can be get using ScaledFont.getReferenceCount. Since 1.0

setUserData
cairo_status_t setUserData(cairo_user_data_key_t* key, void* userData, cairo_destroy_func_t destroy)

Attach user data to scaled_font. To remove user data from a surface, call this function with the key that was used to set it and NULL for data. Since 1.4

status
cairo_status_t status()

Checks whether an error has previously occurred for this scaled_font. Since 1.0

textExtents
void textExtents(string utf8, cairo_text_extents_t* extents)

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. Since 1.2

textToGlyphs
cairo_status_t textToGlyphs(double x, double y, string utf8, int utf8_Len, cairo_glyph_t[] glyphs, cairo_text_cluster_t[] clusters, cairo_text_cluster_flags_t clusterFlags)

Converts UTF-8 text to an array of glyphs, optionally with cluster mapping, that can be used to render later using scaled_font. If glyphs initially points to a non-NULL value, that array is used as a glyph buffer, and num_glyphs should point to the number of glyph entries available there. If the provided glyph array is too short for the conversion, a new glyph array is allocated using cairo_glyph_allocate() and placed in glyphs. Upon return, num_glyphs always contains the number of generated glyphs. If the value glyphs points to has changed after the call, the user is responsible for freeing the allocated glyph array using cairo_glyph_free(). This may happen even if the provided array was large enough. If clusters is not NULL, num_clusters and cluster_flags should not be NULL, and cluster mapping will be computed. The semantics of how cluster array allocation works is similar to the glyph array. That is, if clusters initially points to a non-NULL value, that array is used as a cluster buffer, and num_clusters should point to the number of cluster entries available there. If the provided cluster array is too short for the conversion, a new cluster array is allocated using cairo_text_cluster_allocate() and placed in clusters. Upon return, num_clusters always contains the number of generated clusters. If the value clusters points at has changed after the call, the user is responsible for freeing the allocated cluster array using cairo_text_cluster_free(). This may happen even if the provided array was large enough. In the simplest case, glyphs and clusters can point to NULL initially Since 1.8

Static functions

create
ScaledFont create(FontFace fontFace, Matrix fontMatrix, Matrix ctm, FontOption options)

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. Since 1.0

Variables

cairo_scaled_font
cairo_scaled_font_t* cairo_scaled_font;

the main Gtk struct