Class: Pango::FontMap

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Overview

The PangoFontMapClass structure holds the virtual functions for
a particular PangoFontMap implementation.

Direct Known Subclasses

PangoFc::FontMap

Instance Method Summary collapse

Instance Method Details

#add_font_file(filename) ⇒ Boolean

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.

Parameters:

  • filename (Pango::filename) —

    Path to the font file

Returns:

  • (Boolean) —

    True if the font file is successfully loaded
    into the fontmap, false if an error occurred.

#changed ⇒ nil

Forces a change in the fontmap, 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
fontmap and such data is changed.

Returns:

  • (nil)

#create_context ⇒ Pango::Context

Creates a PangoContext connected to fontmap.

This is equivalent to [ctorPango.Context.new] followed by
[methodPango.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.

Returns:

  • (Pango::Context) —

    the newly allocated PangoContext,
    which should be freed with g_object_unref().

#get_family(name) ⇒ Pango::FontFamily

Gets a font family by name.

Parameters:

  • name (String) —

    a family name

Returns:

#item_type ⇒ GLib::Type

The type of items contained in this list.

Returns:

  • (GLib::Type) —

    item-type

#item_type=(item_type) ⇒ GLib::Type

The type of items contained in this list.

Parameters:

  • item_type (GLib::Type)

Returns:

  • (GLib::Type) —

    item-type

  • (GLib::Type) —

    item-type

#list_families(families, n_families) ⇒ nil

List all families for a fontmap.

Note that the returned families are not in any particular order.

PangoFontMap also implemented the [ifaceGio.ListModel] interface
for enumerating families.

Parameters:

  • families (Array<Pango::FontFamily>) —

    location to
    store a pointer to an array of PangoFontFamily *.
    This array should be freed with g_free().

  • n_families (Integer) —

    location to store the number of elements in families

Returns:

  • (nil)

#load_font(context, desc) ⇒ Pango::Font

Load the font in the fontmap that is the closest match for desc.

Parameters:

Returns:

  • (Pango::Font) —

    the newly allocated PangoFont
    loaded, or nil if no font matched.

#load_fontset(context, desc, language) ⇒ Pango::Fontset

Load a set of fonts in the fontmap that can be used to render
a font matching desc.

Parameters:

Returns:

  • (Pango::Fontset) —

    the newly allocated
    PangoFontset loaded, or nil if no font matched.

#n_items ⇒ Integer

The number of items contained in this list.

Returns:

  • (Integer) —

    n-items

#n_items=(n_items) ⇒ Integer

The number of items contained in this list.

Parameters:

  • n_items (Integer)

Returns:

  • (Integer) —

    n-items

  • (Integer) —

    n-items

#reload_font(font, scale, context, variations) ⇒ Pango::Font

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.

Parameters:

  • font (Pango::Font) —

    a font in fontmap

  • scale (Float) —

    the scale factor to apply

  • context (Pango::Context) —

    a PangoContext

  • variations (String) —

    font variations to use

Returns:

#serial ⇒ Integer

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.

Returns:

  • (Integer) —

    The current serial number of fontmap.