Module Cairo_pango.Font_map

Interacting with Pango.font_map.

type t = [ `pangofontmap | `cairo ] Gobject.obj

A PangoCairoFontMap.

val get_default : unit -> Pango.font_map

get_default() gets a default Cairo fontmap to use with Cairo. The default Cairo fontmap can be changed by using set_default. This can be used to change the Cairo font backend that the default fontmap uses for example.

Note that the default fontmap is per-thread. Each thread gets its own default fontmap. In this way, Pango-Cairo can be used safely from multiple threads.

val set_default : t -> unit

set_default fm sets fm as the default fontmap to use with Cairo. The default fontmap is per-thread.

val create : unit -> Pango.font_map

Creates a new fontmap; a fontmap is used to cache information about available fonts, and holds certain global parameters such as the resolution. In most cases, you can use get_default instead.

Note that the type of the returned value will depend on the particular font backend Cairo was compiled to use. You can override the type of backend returned by using an environment variable PANGOCAIRO_BACKEND. Supported types, based on your build, are fc (fontconfig), win32, and coretext.

val create_for_font_type : Cairo.font_type -> Pango.font_map

create_for_font_type fonttype creates a new fontmap object of the type suitable to be used with cairo font backend of type fonttype. In most cases one should simply use create, or in fact in most of those cases, just use get_default.

val get_font_type : t -> Cairo.font_type

Gets the type of Cairo font backend that fontmap uses.

val set_resolution : t -> float -> unit

Sets the resolution for the fontmap. This is a scale factor between points specified in a Pango.font_description and Cairo units. The default value is 96, meaning that a 10 point font will be 13 units high. (10 * 96. / 72. = 13.3).

val get_resolution : t -> float

Gets the resolution for the fontmap. See set_resolution.

val create_context : Pango.font_map -> Pango.context

create_context fm creates a Pango context connected to the fontmap fm.