[]Struct pango::GlyphString

pub struct GlyphString(_);

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

impl GlyphString[src]

pub fn new() -> GlyphString[src]

Create a new GlyphString.

Returns

the newly allocated GlyphString, which should be freed with GlyphString::free.

pub fn extents<P: IsA<Font>>(&mut self, font: &P) -> (Rectangle, Rectangle)[src]

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

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

font

a Font

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.

pub fn extents_range<P: IsA<Font>>(
    &mut self,
    start: i32,
    end: i32,
    font: &P
) -> (Rectangle, Rectangle)
[src]

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

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.

pub fn get_width(&mut self) -> i32[src]

Computes the logical width of the glyph string as can also be computed using GlyphString::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.

pub fn index_to_x(
    &mut self,
    text: &str,
    analysis: &mut Analysis,
    index_: i32,
    trailing: bool
) -> i32
[src]

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 pango_itemize

index_

the byte index within text

trailing

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

x_pos

location to store result

pub fn set_size(&mut self, new_len: i32)[src]

Resize a glyph string to the given length.

new_len

the new length of the string.

pub fn x_to_index(
    &mut self,
    text: &str,
    analysis: &mut Analysis,
    x_pos: i32
) -> (i32, i32)
[src]

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 pango_itemize

x_pos

the x offset (in Pango units)

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.

impl GlyphString[src]

pub fn num_glyphs(&self) -> i32[src]

pub fn glyph_info(&self) -> Vec<GlyphInfo>[src]

Trait Implementations

impl Clone for GlyphString

impl Debug for GlyphString[src]

impl Default for GlyphString[src]

impl Eq for GlyphString[src]

impl Hash for GlyphString[src]

impl Ord for GlyphString[src]

impl PartialEq<GlyphString> for GlyphString[src]

impl PartialOrd<GlyphString> for GlyphString[src]

impl StaticType for GlyphString

impl StructuralEq for GlyphString[src]

impl StructuralPartialEq for GlyphString[src]

Auto Trait Implementations

impl RefUnwindSafe for GlyphString

impl !Send for GlyphString

impl !Sync for GlyphString

impl Unpin for GlyphString

impl UnwindSafe for GlyphString

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.