Skip to content

Pango.FontFamily

class — extends GObject.Object, Gio.ListModel

A PangoFontFamily is used to represent a family of related font faces.

The font faces in a family share a common design, but differ in slant, weight, width or other aspects.

Methods

get_face

def get_face(self, name: str | None = ...) -> FontFace | None

Gets the PangoFontFace of family with the given name.

Parameters:

  • name — the name of a face. If the name is None, the family's default face (fontconfig calls it "Regular") will be returned.

get_name

def get_name(self) -> str

Gets the name of the family.

The name is unique among all fonts for the font backend and can be used in a PangoFontDescription to specify that a face from this family is desired.

is_monospace

def is_monospace(self) -> bool

A monospace font is a font designed for text display where the the characters form a regular grid.

For Western languages this would mean that the advance width of all characters are the same, but this categorization also includes Asian fonts which include double-width characters: characters that occupy two grid cells. GLib.unichar_iswide returns a result that indicates whether a character is typically double-width in a monospace font.

The best way to find out the grid-cell size is to call FontMetrics.get_approximate_digit_width, since the results of FontMetrics.get_approximate_char_width may be affected by double-width characters.

is_variable

def is_variable(self) -> bool

A variable font is a font which has axes that can be modified to produce different faces.

Such axes are also known as variations; see FontDescription.set_variations for more information.

list_faces

def list_faces(self) -> list[FontFace]

Lists the different font faces that make up family.

The faces in a family share a common design, but differ in slant, weight, width and other aspects.

Note that the returned faces are not in any particular order, and multiple faces may have the same name or characteristics.

PangoFontFamily also implemented the Gio.ListModel interface for enumerating faces.

Virtual methods

do_get_face

def do_get_face(self, name: str | None = ...) -> FontFace | None

Gets the PangoFontFace of family with the given name.

Parameters:

  • name — the name of a face. If the name is None, the family's default face (fontconfig calls it "Regular") will be returned.

do_get_name

def do_get_name(self) -> str

Gets the name of the family.

The name is unique among all fonts for the font backend and can be used in a PangoFontDescription to specify that a face from this family is desired.

do_is_monospace

def do_is_monospace(self) -> bool

A monospace font is a font designed for text display where the the characters form a regular grid.

For Western languages this would mean that the advance width of all characters are the same, but this categorization also includes Asian fonts which include double-width characters: characters that occupy two grid cells. GLib.unichar_iswide returns a result that indicates whether a character is typically double-width in a monospace font.

The best way to find out the grid-cell size is to call FontMetrics.get_approximate_digit_width, since the results of FontMetrics.get_approximate_char_width may be affected by double-width characters.

do_is_variable

def do_is_variable(self) -> bool

A variable font is a font which has axes that can be modified to produce different faces.

Such axes are also known as variations; see FontDescription.set_variations for more information.

do_list_faces

def do_list_faces(self) -> list[FontFace]

Lists the different font faces that make up family.

The faces in a family share a common design, but differ in slant, weight, width and other aspects.

Note that the returned faces are not in any particular order, and multiple faces may have the same name or characteristics.

PangoFontFamily also implemented the Gio.ListModel interface for enumerating faces.

Properties

is_monospace

is_monospace: bool  # read-only

Is this a monospace font

is_variable

is_variable: bool  # read-only

Is this a variable font

item_type

item_type: type | GObject.Type  # read-only

The type of items contained in this list.

n_items

n_items: int  # read-only

The number of items contained in this list.

name

name: str  # read-only

The name of the family