Struct pango::GlyphString[][src]

pub struct GlyphString(_);
Expand description

The GlyphString structure is used to store strings of glyphs with geometry and visual attribute information. The storage for the glyph information is owned by the structure which simplifies memory management.

Implementations

Create a new GlyphString.

Returns

the newly allocated GlyphString, which should be freed with pango_glyph_string_free().

Compute the logical and ink extents of a glyph string. See the documentation for FontExt::glyph_extents() for details about the interpretation of the rectangles.

Examples of logical (red) and ink (green) rects:

font

a Font

Returns

ink_rect

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

logical_rect

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

Computes the extents of a sub-portion of a glyph string. The extents are relative to the start of the glyph string range (the origin of their coordinate system is at the start of the range, not at the start of the entire glyph string).

start

start index

end

end index (the range is the set of bytes with indices such that start <= index < end)

font

a Font

Returns

ink_rect

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

logical_rect

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

Computes the logical width of the glyph string as can also be computed using extents(). However, since this only computes the width, it’s much faster. This is in fact only a convenience function that computes the sum of geometry.width for each glyph in the self.

Returns

the logical width of the glyph string.

Converts from character position to x position. (X position is measured from the left edge of the run). Character positions are computed by dividing up each cluster into equal portions.

text

the text for the run

length

the number of bytes (not characters) in text.

analysis

the analysis information return from itemize()

index_

the byte index within text

trailing

whether we should compute the result for the beginning (false) or end (true) of the character.

Returns

x_pos

location to store result

Resize a glyph string to the given length.

new_len

the new length of the string.

Convert from x offset to character position. Character positions are computed by dividing up each cluster into equal portions. In scripts where positioning within a cluster is not allowed (such as Thai), the returned value may not be a valid cursor position; the caller must combine the result with the logical attributes for the text to compute the valid cursor position.

text

the text for the run

length

the number of bytes (not characters) in text.

analysis

the analysis information return from itemize()

x_pos

the x offset (in Pango units)

Returns

index_

location to store calculated byte index within text

trailing

location to store a boolean indicating whether the user clicked on the leading or trailing edge of the character.

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

Returns the “default value” for a type. 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.