PangoCairo.FontMap

g GObject.GInterface GObject.GInterface PangoCairo.FontMap PangoCairo.FontMap GObject.GInterface->PangoCairo.FontMap

Implementations:
 None

Methods

class get_default ()
class new ()
class new_for_font_type (fonttype)
  get_font_type ()
  get_resolution ()
  set_default ()
  set_resolution (dpi)

Virtual Methods

None

Properties

None

Signals

None

Fields

None

Class Details

class PangoCairo.FontMap
Bases:GObject.GInterface

PangoCairo.FontMap 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.

New in version 1.10.

classmethod get_default()[source]
Returns:the default PangoCairo fontmap for the current thread. This object is owned by Pango and must not be freed.
Return type:Pango.FontMap

Gets a default PangoCairo.FontMap to use with Cairo.

Note that the type of the returned object will depend on the particular font backend Cairo was compiled to use; You generally should only use the Pango.FontMap and PangoCairo.FontMap interfaces on the returned object.

The default Cairo fontmap can be changed by using PangoCairo.FontMap.set_default(). This can be used to change the Cairo font backend that the default fontmap uses for example.

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

New in version 1.10.

classmethod new()[source]
Returns:the newly allocated Pango.FontMap, which should be freed with GObject.Object.unref().
Return type:Pango.FontMap

Creates a new PangoCairo.FontMap object; 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 PangoCairo.FontMap.get_default() instead.

Note that the type of the returned object will depend on the particular font backend Cairo was compiled to use; You generally should only use the Pango.FontMap and PangoCairo.FontMap interfaces on the returned object.

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. If requested type is not available, None is returned. Ie. this is only useful for testing, when at least two backends are compiled in.

New in version 1.10.

classmethod new_for_font_type(fonttype)[source]
Parameters:fonttype (cairo.FontType) – desired cairo.FontType
Returns:the newly allocated Pango.FontMap of suitable type which should be freed with GObject.Object.unref(), or None if the requested cairo font backend is not supported / compiled in.
Return type:Pango.FontMap or None

Creates a new PangoCairo.FontMap object of the type suitable to be used with cairo font backend of type fonttype.

In most cases one should simply use pango_cairo_font_map_new(), or in fact in most of those cases, just use pango_cairo_font_map_get_default().

New in version 1.18.

get_font_type()[source]
Returns:the cairo.FontType cairo font backend type
Return type:cairo.FontType

Gets the type of Cairo font backend that self uses.

New in version 1.18.

get_resolution()[source]
Returns:the resolution in “dots per inch”
Return type:float

Gets the resolution for the fontmap. See PangoCairo.FontMap.set_resolution()

New in version 1.10.

set_default()[source]

Sets a default PangoCairo.FontMap 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 PangoCairo.FontMap.new().

A value of None for self will cause the current default font map to be released and a new default font map to be created on demand, using PangoCairo.FontMap.new().

New in version 1.22.

set_resolution(dpi)[source]
Parameters:dpi (float) – the resolution in “dots per inch”. (Physical inches aren’t actually involved; the terminology is conventional.)

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

New in version 1.10.