Method Cairo.Context()->select_font_face()


Method select_font_face

void select_font_face(string family, int slant, int weight)

Note

The 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.

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. The resulting font face could then be used with scaled_font_create() and set_scaled_font().

If text is drawn without a call to select_font_face(), (nor set_font_face() nor set_scaled_font()), the default family is platform-specific, but is essentially "sans-serif". Default slant is FONT_SLANT_NORMAL, and default weight is FONT_WEIGHT_NORMAL.

This function is equivalent to a call to toy_font_face_create() followed by set_font_face().

Parameter family

a font family name

Parameter slant

the slant for the font

Parameter weight

the weight for the font