Struct pango::FontMetrics[][src]

pub struct FontMetrics(_);
Expand description

A FontMetrics structure holds the overall metric information for a font (possibly restricted to a script). The fields of this structure are private to implementations of a font backend. See the documentation of the corresponding getters for documentation of their meaning.

Implementations

Gets the approximate character width for a font metrics structure. This is merely a representative value useful, for example, for determining the initial size for a window. Actual characters in text will be wider and narrower than this.

Returns

the character width, in Pango units.

Gets the approximate digit width for a font metrics structure. This is merely a representative value useful, for example, for determining the initial size for a window. Actual digits in text can be wider or narrower than this, though this value is generally somewhat more accurate than the result of approximate_char_width() for digits.

Returns

the digit width, in Pango units.

Gets the ascent from a font metrics structure. The ascent is the distance from the baseline to the logical top of a line of text. (The logical top may be above or below the top of the actual drawn ink. It is necessary to lay out the text to figure where the ink will be.)

Returns

the ascent, in Pango units.

Gets the descent from a font metrics structure. The descent is the distance from the baseline to the logical bottom of a line of text. (The logical bottom may be above or below the bottom of the actual drawn ink. It is necessary to lay out the text to figure where the ink will be.)

Returns

the descent, in Pango units.

This is supported on crate feature v1_44 only.

Gets the line height from a font metrics structure. The line height is the distance between successive baselines in wrapped text.

If the line height is not available, 0 is returned.

Returns

the height, in Pango units

Gets the suggested position to draw the strikethrough. The value returned is the distance <emphasis>above</emphasis> the baseline of the top of the strikethrough.

Returns

the suggested strikethrough position, in Pango units.

Gets the suggested thickness to draw for the strikethrough.

Returns

the suggested strikethrough thickness, in Pango units.

Gets the suggested position to draw the underline. The value returned is the distance <emphasis>above</emphasis> the baseline of the top of the underline. Since most fonts have underline positions beneath the baseline, this value is typically negative.

Returns

the suggested underline position, in Pango units.

Gets the suggested thickness to draw for the underline.

Returns

the suggested underline thickness, in Pango units.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.