![]() |
![]() |
![]() |
Cairo: A Vector Graphics Library | ![]() |
---|---|---|---|---|
cairo_glyph_t; enum cairo_font_slant_t; enum cairo_font_weight_t; void cairo_select_font_face (cairo_t *cr, const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight); void cairo_set_font_size (cairo_t *cr, double size); void cairo_set_font_matrix (cairo_t *cr, const cairo_matrix_t *matrix); void cairo_get_font_matrix (cairo_t *cr, cairo_matrix_t *matrix); void cairo_set_font_options (cairo_t *cr, const cairo_font_options_t *options); void cairo_get_font_options (cairo_t *cr, cairo_font_options_t *options); void cairo_show_text (cairo_t *cr, const char *utf8); void cairo_show_glyphs (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs); cairo_font_face_t* cairo_get_font_face (cairo_t *cr); void cairo_font_extents (cairo_t *cr, cairo_font_extents_t *extents); void cairo_set_font_face (cairo_t *cr, cairo_font_face_t *font_face); void cairo_set_scaled_font (cairo_t *cr, const cairo_scaled_font_t *scaled_font); void cairo_text_extents (cairo_t *cr, const char *utf8, cairo_text_extents_t *extents); void cairo_glyph_extents (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs, cairo_text_extents_t *extents);
typedef struct { unsigned long index; double x; double y; } cairo_glyph_t;
The cairo_glyph_t structure holds information about a single glyph when drawing or measuring text. A font is (in simple terms) a collection of shapes used to draw text. A glyph is one of these shapes. There can be multiple glyphs for a single character (alternates to be used in different contexts, for example), or a glyph can be a ligature of multiple characters. Cairo doesn't expose any way of converting input text into glyphs, so in order to use the Cairo interfaces that take arrays of glyphs, you must directly access the appropriate underlying font system.
Note that the offsets given by x
and y
are not cumulative. When
drawing or measuring text, each glyph is individually positioned
with respect to the overall origin
unsigned long index ; |
glyph index in the font. The exact interpretation of the glyph index depends on the font technology being used. |
double x ; |
the offset in the X direction between the origin used for drawing or measuring the string and the origin of this glyph. |
double y ; |
the offset in the Y direction between the origin used for drawing or measuring the string and the origin of this glyph. |
typedef enum _cairo_font_slant { CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_SLANT_OBLIQUE } cairo_font_slant_t;
typedef enum _cairo_font_weight { CAIRO_FONT_WEIGHT_NORMAL, CAIRO_FONT_WEIGHT_BOLD } cairo_font_weight_t;
void cairo_select_font_face (cairo_t *cr, const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight);
void cairo_set_font_options (cairo_t *cr, const cairo_font_options_t *options);
void cairo_set_scaled_font (cairo_t *cr, const cairo_scaled_font_t *scaled_font);
Since 1.2
void cairo_text_extents (cairo_t *cr, const char *utf8, cairo_text_extents_t *extents);
void cairo_glyph_extents (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs, cairo_text_extents_t *extents);