Module: PangoCairo::FontMap

Defined in:


Pango::CairoFontMap is an interface exported by font maps for use with Cairo. The actual type of the font map will depend on the particular font technology Cairo was compiled to use.

Instance Method Summary collapse

Instance Method Details


Create a Pango::Context for the given fontmap.


  • (Pango::Context)

    the newly created context; free with g_object_unref().


Gets the type of Cairo font backend that fontmap uses.


  • (cairo::FontType)

    the #cairo_font_type_t cairo font backend type


Gets the resolution for the fontmap. See pango_cairo_font_map_set_resolution()


  • (Float)

    the resolution in “dots per inch”

#resolution=(dpi) ⇒ nil

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


  • dpi (Float)

    the resolution in “dots per inch”. (Physical inches aren’t actually involved; the terminology is conventional.)


  • (nil)


Sets a default Pango::CairoFontMap to use with Cairo.

This can be used to change the Cairo font backend that the default fontmap uses for example. The old default font map is unreffed and the new font map referenced.

Note that since Pango 1.32.6, the default fontmap is per-thread. This function only changes the default fontmap for the current thread. Default fontmaps of exisiting threads are not changed. Default fontmaps of any new threads will still be created using pango_cairo_font_map_new().

A value of nil for fontmap will cause the current default font map to be released and a new default font map to be created on demand, using pango_cairo_font_map_new().


  • (nil)