Note: The cairo_select_font_face() function call is part of what the cairo designers call the "toy" text API. It is convenient for short demos and simple programs, but it is not expected to be adequate for serious text-using applications.

cairo_select_font_face(cr, family, slant, weight)

Arguments

cr

[cairo_t *] a #cairo_t

family

[char *] a font family name, encoded in UTF-8

slant

[int] the slant for the font

weight

[int] the weight for the font

Details

Selects a family and style of font from a simplified description as a family name, slant and weight. Cairo provides no operation to list available family names on the system (this is a "toy", remember), but the standard CSS2 generic family names, ("serif", "sans-serif", "cursive", "fantasy", "monospace"), are likely to work as expected.

If family starts with the string "cairo:", or if no native font backends are compiled in, cairo will use an internal font family. The internal font family recognizes many modifiers in the family string, most notably, it recognizes the string "monospace". That is, the family name "cairo:monospace" will use the monospace version of the internal font family.

For "real" font selection, see the font-backend-specific font_face_create functions for the font backend you are using. (For example, if you are using the freetype-based cairo-ft font backend, see cairo_ft_font_face_create_for_ft_face() or cairo_ft_font_face_create_for_pattern().) The resulting font face could then be used with cairo_scaled_font_create() and cairo_set_scaled_font().

Similarly, when using the "real" font support, you can call directly into the underlying font system, (such as fontconfig or freetype), for operations such as listing available fonts, etc.

It is expected that most applications will need to use a more comprehensive font handling and text layout library, (for example, pango), in conjunction with cairo.

If text is drawn without a call to cairo_select_font_face(), (nor cairo_set_font_face() nor cairo_set_scaled_font()), the default family is platform-specific, but is essentially "sans-serif". Default slant is %CAIRO_FONT_SLANT_NORMAL, and default weight is %CAIRO_FONT_WEIGHT_NORMAL.

This function is equivalent to a call to cairo_toy_font_face_create() followed by cairo_set_font_face().

Since: 1.0

C function prototype: void cairo_select_font_face (cairo_t *cr, const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight)

See also

Other cairo--: cairo_append_path(), cairo_arc_negative(), cairo_arc(), cairo_clip_extents(), cairo_clip_preserve(), cairo_clip(), cairo_close_path(), cairo_copy_page(), cairo_copy_path_flat(), cairo_copy_path(), cairo_create(), cairo_curve_to(), cairo_device_to_user_distance(), cairo_device_to_user(), cairo_fill_extents(), cairo_fill_preserve(), cairo_fill(), cairo_font_extents(), cairo_get_antialias(), cairo_get_current_point(), cairo_get_dash_count(), cairo_get_dash(), cairo_get_fill_rule(), cairo_get_font_face(), cairo_get_font_matrix(), cairo_get_group_target(), cairo_get_line_cap(), cairo_get_line_join(), cairo_get_line_width(), cairo_get_matrix(), cairo_get_miter_limit(), cairo_get_operator(), cairo_get_source(), cairo_get_target(), cairo_get_tolerance(), cairo_has_current_point(), cairo_identity_matrix(), cairo_in_clip(), cairo_in_fill(), cairo_in_stroke(), cairo_line_to(), cairo_mask_surface(), cairo_mask(), cairo_move_to(), cairo_new_path(), cairo_new_sub_path(), cairo_paint_with_alpha(), cairo_paint(), cairo_path_extents(), cairo_pop_group_to_source(), cairo_pop_group(), cairo_push_group_with_content(), cairo_push_group(), cairo_rectangle(), cairo_rel_curve_to(), cairo_rel_line_to(), cairo_rel_move_to(), cairo_reset_clip(), cairo_restore(), cairo_rotate(), cairo_save(), cairo_scale(), cairo_set_antialias(), cairo_set_dash(), cairo_set_fill_rule(), cairo_set_font_face(), cairo_set_font_matrix(), cairo_set_font_size(), cairo_set_line_cap(), cairo_set_line_join(), cairo_set_line_width(), cairo_set_matrix(), cairo_set_miter_limit(), cairo_set_operator(), cairo_set_source_rgba(), cairo_set_source_rgb(), cairo_set_source_surface(), cairo_set_source(), cairo_set_tolerance(), cairo_show_page(), cairo_show_text(), cairo_status(), cairo_stroke_extents(), cairo_stroke_preserve(), cairo_stroke(), cairo_tag_begin(), cairo_tag_end(), cairo_text_extents(), cairo_text_path(), cairo_transform(), cairo_translate(), cairo_user_to_device_distance(), cairo_user_to_device()