Class: Pango::Font

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

Instance Method Summary collapse

Instance Method Details

#describePango::FontDescription

Returns a description of the font, with font size set in points. Use pango_font_describe_with_absolute_size() if you want the font size in device units.

Returns:

  • (Pango::FontDescription)

    a newly-allocated Pango::FontDescription object.

#describe_with_absolute_sizePango::FontDescription

Returns a description of the font, with absolute font size set (in device units). Use pango_font_describe() if you want the font size in points.

Returns:

  • (Pango::FontDescription)

    a newly-allocated Pango::FontDescription object.

#find_shaper(language, ch) ⇒ Pango::EngineShape

Finds the best matching shaper for a font for a particular language tag and character point.

Parameters:

  • language (Pango::Language)

    the language tag

  • ch (Integer)

    a Unicode character.

Returns:

#font_mapPango::FontMap

Gets the font map for which the font was created.

Note that the font maintains a <firstterm>weak</firstterm> reference to the font map, so if all references to font map are dropped, the font map will be finalized even if there are fonts created with the font map that are still alive. In that case this function will return nil. It is the responsibility of the user to ensure that the font map is kept alive. In most uses this is not an issue as a Pango::Context holds a reference to the font map.

Returns:

  • (Pango::FontMap)

    the Pango::FontMap for the font, or nil if font is nil.

#get_coverage(language) ⇒ Pango::Coverage

Computes the coverage map for a given font and language tag.

Parameters:

  • language (Pango::Language)

    the language tag

Returns:

#get_features(features, len, num_features) ⇒ nil

Obtain the OpenType features that are provided by the font. These are passed to the rendering system, together with features that have been explicitly set via attributes.

Note that this does not include OpenType features which the rendering system enables by default.

Parameters:

  • features (Array<Pango::>)

    Array to features in

  • len (Integer)

    the length of features

  • num_features (Integer)

    the number of used items in features

Returns:

  • (nil)

#get_glyph_extents(glyph, ink_rect, logical_rect) ⇒ nil

Gets the logical and ink extents of a glyph within a font. The coordinate system for each rectangle has its origin at the base line and horizontal origin of the character with increasing coordinates extending to the right and down. The macros PANGO_ASCENT(), PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING() can be used to convert from the extents rectangle to more traditional font metrics. The units of the rectangles are in 1/PANGO_SCALE of a device unit.

If font is nil, this function gracefully sets some sane values in the output variables and returns.

Parameters:

  • glyph (Pango::Glyph)

    the glyph index

  • ink_rect (Pango::Rectangle)

    rectangle used to store the extents of the glyph as drawn or nil to indicate that the result is not needed.

  • logical_rect (Pango::Rectangle)

    rectangle used to store the logical extents of the glyph or nil to indicate that the result is not needed.

Returns:

  • (nil)

#get_metrics(language) ⇒ Pango::FontMetrics

Gets overall metric information for a font. Since the metrics may be substantially different for different scripts, a language tag can be provided to indicate that the metrics should be retrieved that correspond to the script(s) used by that language.

If font is nil, this function gracefully sets some sane values in the output variables and returns.

Parameters:

  • language (Pango::Language)

    language tag used to determine which script to get the metrics for, or nil to indicate to get the metrics for the entire font.

Returns:

  • (Pango::FontMetrics)

    a Pango::FontMetrics object. The caller must call pango_font_metrics_unref() when finished using the object.

#has_char(wc) ⇒ TrueClass

Returns whether the font provides a glyph for this character.

Returns true if font can render wc

Parameters:

  • wc (String)

    a Unicode character

Returns:

  • (TrueClass)

#hb_fontPango::

Get a hb_font_t object backing this font.

Note that the objects returned by this function are cached and immutable. If you need to make changes to the hb_font_t, use hb_font_create_sub_font().

Returns:

  • (Pango::)

    the hb_font_t object backing the font, or nil if the font does not have one