Trait pango::prelude::FontExt[][src]

pub trait FontExt: 'static {
    fn describe(&self) -> Option<FontDescription>;
fn describe_with_absolute_size(&self) -> Option<FontDescription>;
fn coverage(&self, language: &Language) -> Option<Coverage>;
fn face(&self) -> Option<FontFace>;
fn font_map(&self) -> Option<FontMap>;
fn glyph_extents(&self, glyph: Glyph) -> (Rectangle, Rectangle);
fn metrics(&self, language: Option<&Language>) -> Option<FontMetrics>;
fn has_char(&self, wc: char) -> bool; }
Expand description

Trait containing all Font methods.

Implementors

Font

Required methods

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

Returns

a newly-allocated FontDescription object.

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

Returns

a newly-allocated FontDescription object.

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

language

the language tag

Returns

a newly-allocated Coverage object.

This is supported on crate feature v1_46 only.

Gets the FontFace to which self belongs.

Returns

the FontFace

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 None. 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 Context holds a reference to the font map.

Returns

the FontMap for the font, or None if self is None.

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 self is None, this function gracefully sets some sane values in the output variables and returns.

glyph

the glyph index

Returns

ink_rect

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

logical_rect

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

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 self is None, this function gracefully sets some sane values in the output variables and returns.

language

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

Returns

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

This is supported on crate feature v1_44 only.

Returns whether the font provides a glyph for this character.

Returns true if self can render wc

wc

a Unicode character

Implementors