Module: PangoCairo::FontMap

Defined in:
(unknown)

Overview

PangoCairoFontMap 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_contextPango::Context

Create a PangoContext for the given fontmap.

Returns:

  • (Pango::Context)

    the newly created context; free with g_object_unref().

#font_typecairo::FontType

Gets the type of Cairo font backend that fontmap uses.

Returns:

  • (cairo::FontType)

    the cairo_font_type_t cairo font backend type

#resolutionFloat

Gets the resolution for the fontmap.

See [methodPangoCairo.FontMap.set_resolution].

Returns:

  • (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 PangoFontDescription and Cairo units. The default value is 96, meaning that a 10 point font will be 13 units high. (10 * 96. / 72. = 13.3).

Parameters:

  • dpi (Float)

    the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.)

Returns:

  • (nil)

#set_defaultnil

Sets a default PangoCairoFontMap 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 existing threads are not changed. Default fontmaps of any new threads will still be created using [funcPangoCairo.FontMap.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 [funcPangoCairo.FontMap.new].

Returns:

  • (nil)