:right-sidebar: True FontMap =================================================================== .. currentmodule:: gi.repository.Pango .. class:: FontMap(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gio.ListModel` 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. Methods ------- .. rst-class:: interim-class .. class:: FontMap :no-index: .. method:: changed() -> None 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. .. versionadded:: 1.34 .. method:: create_context() -> ~gi.repository.Pango.Context Creates a ``PangoContext`` connected to ``fontmap``\. This is equivalent to :obj:`~gi.repository.Pango.Context.new` followed by :obj:`~gi.repository.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. .. versionadded:: 1.22 .. method:: do_changed(self) -> None .. method:: do_get_family(self, name: str) -> ~gi.repository.Pango.FontFamily :param name: .. method:: do_get_serial(self) -> int .. method:: do_list_families(self) -> list[~gi.repository.Pango.FontFamily] .. method:: do_load_font(self, context: ~gi.repository.Pango.Context, desc: ~gi.repository.Pango.FontDescription) -> ~gi.repository.Pango.Font | None :param context: :param desc: .. method:: do_load_fontset(self, context: ~gi.repository.Pango.Context, desc: ~gi.repository.Pango.FontDescription, language: ~gi.repository.Pango.Language) -> ~gi.repository.Pango.Fontset | None :param context: :param desc: :param language: .. method:: get_family(name: str) -> ~gi.repository.Pango.FontFamily Gets a font family by name. .. versionadded:: 1.46 :param name: a family name .. method:: get_serial() -> 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``\. .. versionadded:: 1.32.4 .. method:: list_families() -> list[~gi.repository.Pango.FontFamily] List all families for a fontmap. Note that the returned families are not in any particular order. ``PangoFontMap`` also implemented the :obj:`~gi.repository.Gio.ListModel` interface for enumerating families. .. method:: load_font(context: ~gi.repository.Pango.Context, desc: ~gi.repository.Pango.FontDescription) -> ~gi.repository.Pango.Font | None Load the font in the fontmap that is the closest match for ``desc``\. :param context: the ``PangoContext`` the font will be used with :param desc: a ``PangoFontDescription`` describing the font to load .. method:: load_fontset(context: ~gi.repository.Pango.Context, desc: ~gi.repository.Pango.FontDescription, language: ~gi.repository.Pango.Language) -> ~gi.repository.Pango.Fontset | None Load a set of fonts in the fontmap that can be used to render a font matching ``desc``\. :param context: the ``PangoContext`` the font will be used with :param desc: a ``PangoFontDescription`` describing the font to load :param language: a ``PangoLanguage`` the fonts will be used for .. method:: reload_font(font: ~gi.repository.Pango.Font, scale: float, context: ~gi.repository.Pango.Context | None = None, variations: str | None = None) -> ~gi.repository.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``\. .. versionadded:: 1.52 :param font: a font in ``fontmap`` :param scale: the scale factor to apply :param context: a ``PangoContext`` :param variations: font variations to use Properties ---------- .. rst-class:: interim-class .. class:: FontMap :no-index: .. attribute:: props.item_type :type: ~gobject.GType The type of the None singleton. .. attribute:: props.n_items :type: int The type of the None singleton. Virtual Methods --------------- .. rst-class:: interim-class .. class:: FontMap :no-index: .. method:: do_changed() -> None 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. .. versionadded:: 1.34 .. method:: do_get_family(name: str) -> ~gi.repository.Pango.FontFamily Gets a font family by name. .. versionadded:: 1.46 :param name: a family name .. method:: do_get_serial() -> 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``\. .. versionadded:: 1.32.4 .. method:: do_list_families() -> list[~gi.repository.Pango.FontFamily] List all families for a fontmap. Note that the returned families are not in any particular order. ``PangoFontMap`` also implemented the :obj:`~gi.repository.Gio.ListModel` interface for enumerating families. .. method:: do_load_font(context: ~gi.repository.Pango.Context, desc: ~gi.repository.Pango.FontDescription) -> ~gi.repository.Pango.Font | None Load the font in the fontmap that is the closest match for ``desc``\. :param context: the ``PangoContext`` the font will be used with :param desc: a ``PangoFontDescription`` describing the font to load .. method:: do_load_fontset(context: ~gi.repository.Pango.Context, desc: ~gi.repository.Pango.FontDescription, language: ~gi.repository.Pango.Language) -> ~gi.repository.Pango.Fontset | None Load a set of fonts in the fontmap that can be used to render a font matching ``desc``\. :param context: the ``PangoContext`` the font will be used with :param desc: a ``PangoFontDescription`` describing the font to load :param language: a ``PangoLanguage`` the fonts will be used for Fields ------ .. rst-class:: interim-class .. class:: FontMap :no-index: .. attribute:: parent_instance