Pango.FontMap

g GObject.GInterface GObject.GInterface Gio.ListModel Gio.ListModel GObject.GInterface->Gio.ListModel GObject.Object GObject.Object Pango.FontMap Pango.FontMap GObject.Object->Pango.FontMap Gio.ListModel->Pango.FontMap

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.ListModel (4)

Structs:

GObject.ObjectClass (5)

changed ()

create_context ()

get_family (name)

get_serial ()

list_families ()

load_font (context, desc)

load_fontset (context, desc, language)

reload_font (font, scale, context, variations)

Virtual Methods

Inherited:

GObject.Object (7), Gio.ListModel (3)

do_changed ()

do_get_family (name)

do_get_serial ()

do_list_families ()

do_load_font (context, desc)

do_load_fontset (context, desc, language)

Properties

Name

Type

Flags

Short Description

item-type

GObject.GType

r

n-items

int

r

Signals

Inherited:

GObject.Object (1), Gio.ListModel (1)

Fields

Inherited:

GObject.Object (1), Gio.ListModel (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Pango.FontMap(**kwargs)
Bases:

GObject.Object, Gio.ListModel

Abstract:

Yes

Structure:

Pango.FontMapClass

A PangoFontMap represents the set of fonts available for a particular rendering system.

This is a virtual object with implementations being specific to particular rendering systems.

changed()[source]

Forces a change in the context, which will cause any PangoContext using this fontmap to change.

This function is only useful when implementing a new backend for Pango, something applications won’t do. Backends should call this function if they have attached extra data to the context and such data is changed.

New in version 1.34.

create_context()[source]
Returns:

the newly allocated PangoContext, which should be freed with GObject.Object.unref().

Return type:

Pango.Context

Creates a PangoContext connected to self.

This is equivalent to [ctor`Pango`.Context.new] followed by [method`Pango`.Context.set_font_map].

If you are using Pango as part of a higher-level system, that system may have it’s own way of create a PangoContext. For instance, the GTK toolkit has, among others, gtk_widget_get_pango_context(). Use those instead.

New in version 1.22.

get_family(name)[source]
Parameters:

name (str) – a family name

Returns:

the PangoFontFamily

Return type:

Pango.FontFamily

Gets a font family by name.

New in version 1.46.

get_serial()[source]
Returns:

The current serial number of self.

Return type:

int

Returns the current serial number of self.

The serial number is initialized to an small number larger than zero when a new fontmap is created and is increased whenever the fontmap is changed. It may wrap, but will never have the value 0. Since it can wrap, never compare it with “less than”, always use “not equals”.

The fontmap can only be changed using backend-specific API, like changing fontmap resolution.

This can be used to automatically detect changes to a PangoFontMap, like in PangoContext.

New in version 1.32.4.

list_families()[source]
Returns:

location to store a pointer to an array of PangoFontFamily *. This array should be freed with GLib.free().

Return type:

families: [Pango.FontFamily]

List all families for a fontmap.

Note that the returned families are not in any particular order.

PangoFontMap also implemented the [iface`Gio`.ListModel] interface for enumerating families.

load_font(context, desc)[source]
Parameters:
Returns:

the newly allocated PangoFont loaded, or None if no font matched.

Return type:

Pango.Font or None

Load the font in the fontmap that is the closest match for desc.

load_fontset(context, desc, language)[source]
Parameters:
Returns:

the newly allocated PangoFontset loaded, or None if no font matched.

Return type:

Pango.Fontset or None

Load a set of fonts in the fontmap that can be used to render a font matching desc.

reload_font(font, scale, context, variations)[source]
Parameters:
Returns:

the modified font

Return type:

Pango.Font

Returns a new font that is like font, except that its size is multiplied by scale, its backend-dependent configuration (e.g. cairo font options) is replaced by the one in context, and its variations are replaced by variations.

New in version 1.52.

do_changed() virtual

Forces a change in the context, which will cause any PangoContext using this fontmap to change.

This function is only useful when implementing a new backend for Pango, something applications won’t do. Backends should call this function if they have attached extra data to the context and such data is changed.

New in version 1.34.

do_get_family(name) virtual
Parameters:

name (str) – a family name

Returns:

the PangoFontFamily

Return type:

Pango.FontFamily

Gets a font family by name.

New in version 1.46.

do_get_serial() virtual
Returns:

The current serial number of fontmap.

Return type:

int

Returns the current serial number of fontmap.

The serial number is initialized to an small number larger than zero when a new fontmap is created and is increased whenever the fontmap is changed. It may wrap, but will never have the value 0. Since it can wrap, never compare it with “less than”, always use “not equals”.

The fontmap can only be changed using backend-specific API, like changing fontmap resolution.

This can be used to automatically detect changes to a PangoFontMap, like in PangoContext.

New in version 1.32.4.

do_list_families() virtual
Returns:

location to store a pointer to an array of PangoFontFamily *. This array should be freed with GLib.free().

Return type:

families: [Pango.FontFamily]

List all families for a fontmap.

Note that the returned families are not in any particular order.

PangoFontMap also implemented the [iface`Gio`.ListModel] interface for enumerating families.

do_load_font(context, desc) virtual
Parameters:
Returns:

the newly allocated PangoFont loaded, or None if no font matched.

Return type:

Pango.Font or None

Load the font in the fontmap that is the closest match for desc.

do_load_fontset(context, desc, language) virtual
Parameters:
Returns:

the newly allocated PangoFontset loaded, or None if no font matched.

Return type:

Pango.Fontset or None

Load a set of fonts in the fontmap that can be used to render a font matching desc.

Property Details

Pango.FontMap.props.item_type
Name:

item-type

Type:

GObject.GType

Default Value:

<GType GObject>

Flags:

READABLE

The type of items contained in this list.

Pango.FontMap.props.n_items
Name:

n-items

Type:

int

Default Value:

0

Flags:

READABLE

The number of items contained in this list.