FontMap

class FontMap(**properties: Any)

Superclasses: FontMap, Object

Implemented Interfaces: ListModel

PangoFcFontMap is a base class for font map implementations using the Fontconfig and FreeType libraries.

It is used in the Xft and FreeType backends shipped with Pango, but can also be used when creating new backends. Any backend deriving from this base class will take advantage of the wide range of shapers implemented using FreeType that come with Pango.

Methods

class FontMap
cache_clear() None

Clear all cached information and fontsets for this font map.

This should be called whenever there is a change in the output of the default_substitute() virtual function of the font map, or if fontconfig has been reinitialized to new configuration.

Added in version 1.4.

config_changed() None

Informs font map that the fontconfig configuration (i.e., FcConfig object) used by this font map has changed.

This currently calls cache_clear which ensures that list of fonts, etc will be regenerated using the updated configuration.

Added in version 1.38.

create_context() Context

Creates a new context for this fontmap.

This function is intended only for backend implementations deriving from PangoFcFontMap; it is possible that a backend will store additional information needed for correct operation on the PangoContext after calling this function.

Added in version 1.4.

Deprecated since version 1.22: Use create_context() instead.

find_decoder(pattern: Pattern) Decoder | None

Finds the decoder to use for pattern.

Decoders can be added to a font map using add_decoder_find_func.

Added in version 1.26.

Parameters:

pattern – The FcPattern to find the decoder for.

set_default_substitute(func: Callable[[...], None], *data: Any) None

Sets a function that will be called to do final configuration substitution on a FcPattern before it is used to load the font.

This function can be used to do things like set hinting and antialiasing options.

Added in version 1.48.

Parameters:
  • func – function to call to to do final config tweaking on FcPattern objects

  • data – data to pass to func

shutdown() None

Clears all cached information for the fontmap and marks all fonts open for the fontmap as dead.

See the shutdown() virtual function of PangoFcFont.

This function might be used by a backend when the underlying windowing system for the font map exits. This function is only intended to be called only for backend implementations deriving from PangoFcFontMap.

Added in version 1.4.

substitute_changed() None

Call this function any time the results of the default substitution function set with set_default_substitute change.

That is, if your substitution function will return different results for the same input pattern, you must call this function.

Added in version 1.48.