Class: Pango::Font
- Inherits:
-
Object
- Object
- Pango::Font
- Defined in:
- (unknown)
Direct Known Subclasses
Class Method Summary collapse
-
.descriptions_free(descs, n_descs) ⇒ nil
Frees an array of font descriptions.
-
.deserialize(context, bytes) ⇒ Pango::Font
Loads data previously created via [methodPango.Font.serialize].
Instance Method Summary collapse
-
#describe ⇒ Pango::FontDescription
Returns a description of the font, with font size set in points.
-
#describe_with_absolute_size ⇒ Pango::FontDescription
Returns a description of the font, with absolute font size set in device units.
-
#face ⇒ Pango::FontFace
Gets the
PangoFontFaceto which font belongs. -
#font_map ⇒ Pango::FontMap
Gets the font map for which the font was created.
-
#get_coverage(language) ⇒ Pango::Coverage
Computes the coverage map for a given font and language tag.
-
#get_features(features, len, num_features) ⇒ nil
Obtain the OpenType features that are provided by the font.
-
#get_glyph_extents(glyph, ink_rect, logical_rect) ⇒ nil
Gets the logical and ink extents of a glyph within a font.
-
#get_metrics(language) ⇒ Pango::FontMetrics
Gets overall metric information for a font.
-
#has_char(wc) ⇒ Boolean
Returns whether the font provides a glyph for this character.
-
#hb_font ⇒ HarfBuzz::font_t
Get a
hb_font_tobject backing this font. -
#languages ⇒ Array<Pango::Language>
Returns the languages that are supported by font.
-
#serialize ⇒ GLib::Bytes
Serializes the font in a way that can be uniquely identified.
Class Method Details
.descriptions_free(descs, n_descs) ⇒ nil
Frees an array of font descriptions.
.deserialize(context, bytes) ⇒ Pango::Font
Loads data previously created via [methodPango.Font.serialize].
For a discussion of the supported format, see that function.
Note: to verify that the returned font is identical to the one that was serialized, you can compare bytes to the result of serializing the font again.
Instance Method Details
#describe ⇒ Pango::FontDescription
Returns a description of the font, with font size set in points.
Use [methodPango.Font.describe_with_absolute_size] if you want the font size in device units.
#describe_with_absolute_size ⇒ Pango::FontDescription
Returns a description of the font, with absolute font size set in device units.
Use [methodPango.Font.describe] if you want the font size in points.
#face ⇒ Pango::FontFace
Gets the PangoFontFace to which font belongs.
#font_map ⇒ Pango::FontMap
Gets the font map for which the font was created.
Note that the font maintains a weak 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 PangoContext holds a reference to the font map.
#get_coverage(language) ⇒ Pango::Coverage
Computes the coverage map for a given font and language tag.
#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.
#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.
#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.
#has_char(wc) ⇒ Boolean
Returns whether the font provides a glyph for this character.
#hb_font ⇒ HarfBuzz::font_t
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().
#languages ⇒ Array<Pango::Language>
Returns the languages that are supported by font.
If the font backend does not provide this information, nil is returned. For the fontconfig backend, this corresponds to the FC_LANG member of the FcPattern.
The returned array is only valid as long as the font and its fontmap are valid.
#serialize ⇒ GLib::Bytes
Serializes the font in a way that can be uniquely identified.
There are no guarantees about the format of the output across different versions of Pango.
The intended use of this function is testing, benchmarking and debugging. The format is not meant as a permanent storage format.
To recreate a font from its serialized form, use [funcPango.Font.deserialize].