Pango.FontMap - Classes - Pango 1.0 (original) (raw)
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:
add_font_file (filename) |
---|
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:
Abstract:
Yes
Structure:
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.
add_font_file(filename)[source]¶
Parameters:
filename (str) – Path to the font file
Raises:
Returns:
True if the font file is successfully loaded into the fontmap, false if an error occurred.
Return type:
Loads a font file with one or more fonts into the PangoFontMap
.
The added fonts will take precedence over preexisting fonts with the same name.
New in version 1.56.
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.
Returns:
the newly allocated PangoContext
, which should be freed with GObject.Object.unref().
Return type:
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.
Parameters:
name (str) – a family name
Returns:
the PangoFontFamily
Return type:
Gets a font family by name.
New in version 1.46.
Returns:
The current serial number of self.
Return type:
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.
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:
- context (Pango.Context) – the
PangoContext
the font will be used with - desc (Pango.FontDescription) – a
PangoFontDescription
describing the font to load
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:
- context (Pango.Context) – the
PangoContext
the font will be used with - desc (Pango.FontDescription) – a
PangoFontDescription
describing the font to load - language (Pango.Language) – a
PangoLanguage
the fonts will be used for
Returns:
the newly allocatedPangoFontset
loaded, or None if no font matched.
Return type:
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:
- font (Pango.Font) – a font in self
- scale (float) – the scale factor to apply
- context (Pango.Context or None) – a
PangoContext
- variations (str or None) – font variations to use
Returns:
the modified font
Return type:
Returns a new font that is like font, except that it is scaled 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.
Note that the scaling here is meant to be linear, so this scaling can be used to render a font on a hi-dpi display without changing its optical size.
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:
Gets a font family by name.
New in version 1.46.
do_get_serial() virtual¶
Returns:
The current serial number of fontmap.
Return type:
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:
- context (Pango.Context) – the
PangoContext
the font will be used with - desc (Pango.FontDescription) – a
PangoFontDescription
describing the font to load
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:
- context (Pango.Context) – the
PangoContext
the font will be used with - desc (Pango.FontDescription) – a
PangoFontDescription
describing the font to load - language (Pango.Language) – a
PangoLanguage
the fonts will be used for
Returns:
the newly allocatedPangoFontset
loaded, or None if no font matched.
Return type:
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:
Default Value:
<GType GObject>
Flags:
The type of items contained in this list.
Pango.FontMap.props.n_items¶
Name:
n-items
Type:
Default Value:
0
Flags:
The number of items contained in this list.