FontFamily

class FontFamily(**properties: Any)

Superclasses: Object

Implemented Interfaces: 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

class FontFamily
get_face(name: str | None = None) FontFace | None

Gets the PangoFontFace of family with the given name.

Added in version 1.46.

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() 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() 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. 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 get_approximate_digit_width, since the results of get_approximate_char_width may be affected by double-width characters.

Added in version 1.4.

is_variable() 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 set_variations for more information.

Added in version 1.44.

list_faces() 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 ListModel interface for enumerating faces.

Properties

class FontFamily
props.is_monospace: bool

Is this a monospace font

Added in version 1.52.

props.is_variable: bool

Is this a variable font

Added in version 1.52.

props.item_type: type

The type of items contained in this list.

props.n_items: int

The number of items contained in this list.

props.name: str

The name of the family

Added in version 1.52.

Virtual Methods

class FontFamily
do_get_face(name: str | None = None) FontFace | None

Gets the PangoFontFace of family with the given name.

Added in version 1.46.

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() 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() 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. 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 get_approximate_digit_width, since the results of get_approximate_char_width may be affected by double-width characters.

Added in version 1.4.

do_is_variable() 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 set_variations for more information.

Added in version 1.44.

do_list_faces() 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 ListModel interface for enumerating faces.

Fields

class FontFamily
parent_instance