Package: cairo

Function cairo:select-font-face

Lambda List

cairo:select-font-face (cr family &key slant weight)

Arguments

cr -- a cairo:context-t instance
family -- a string for the font family name, encoded in UTF-8
slant -- a cairo:font-slant-t value for the slant, default value is :normal
weight -- a cairo:font-weight-t value for the weight, default value is :normal

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.

If text is drawn without a call to the cairo:select-font-face function, nor the cairo:font-face function nor the cairo:scaled-font function, the default family is platform-specific, but is essentially "sans-serif". Default slant is :normal, and default weight is :normal.

This function is equivalent to a call to the cairo:toy-font-face-create function followed by the cairo:font-face function.

Notes

The cairo:select-font-face function 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. 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.
 

See also

2025-1-29