[]Struct pango::LayoutLine

pub struct LayoutLine(_);

The LayoutLine structure represents one of the lines resulting from laying out a paragraph via Layout. LayoutLine structures are obtained by calling Layout::get_line and are only valid until the text, attributes, or settings of the parent Layout are modified.

Routines for rendering PangoLayout objects are provided in code specific to each rendering system.

Implementations

impl LayoutLine[src]

pub fn get_extents(&self) -> (Rectangle, Rectangle)[src]

Computes the logical and ink extents of a layout line. See FontExt::get_glyph_extents for details about the interpretation of the rectangles.

ink_rect

rectangle used to store the extents of the glyph string as drawn, or None

logical_rect

rectangle used to store the logical extents of the glyph string, or None

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

Computes the height of the line, ie the distance between this and the previous lines baseline.

Feature: v1_44

height

return location for the line height

pub fn get_pixel_extents(&self) -> (Rectangle, Rectangle)[src]

Computes the logical and ink extents of self in device units. This function just calls LayoutLine::get_extents followed by two pango_extents_to_pixels calls, rounding ink_rect and logical_rect such that the rounded rectangles fully contain the unrounded one (that is, passes them as first argument to pango_extents_to_pixels).

ink_rect

rectangle used to store the extents of the glyph string as drawn, or None

logical_rect

rectangle used to store the logical extents of the glyph string, or None

pub fn get_x_ranges(&self, start_index: i32, end_index: i32) -> Vec<i32>[src]

Gets a list of visual ranges corresponding to a given logical range. This list is not necessarily minimal - there may be consecutive ranges which are adjacent. The ranges will be sorted from left to right. The ranges are with respect to the left edge of the entire layout, not with respect to the line.

start_index

Start byte index of the logical range. If this value is less than the start index for the line, then the first range will extend all the way to the leading edge of the layout. Otherwise it will start at the leading edge of the first character.

end_index

Ending byte index of the logical range. If this value is greater than the end index for the line, then the last range will extend all the way to the trailing edge of the layout. Otherwise, it will end at the trailing edge of the last character.

ranges

location to store a pointer to an array of ranges. The array will be of length <literal>2*n_ranges</literal>, with each range starting at <literal>(ranges)[2n]</literal> and of width <literal>(ranges)[2n + 1] - (ranges)[2n]</literal>. This array must be freed with g_free. The coordinates are relative to the layout and are in Pango units.

n_ranges

The number of ranges stored in ranges.

pub fn index_to_x(&self, index_: i32, trailing: bool) -> i32[src]

Converts an index within a line to a X position.

index_

byte offset of a grapheme within the layout

trailing

an integer indicating the edge of the grapheme to retrieve the position of. If > 0, the trailing edge of the grapheme, if 0, the leading of the grapheme.

x_pos

location to store the x_offset (in Pango unit)

pub fn x_to_index(&self, x_pos: i32) -> Option<(i32, i32)>[src]

Converts from x offset to the byte index of the corresponding character within the text of the layout. If x_pos is outside the line, index_ and trailing will point to the very first or very last position in the line. This determination is based on the resolved direction of the paragraph; for example, if the resolved direction is right-to-left, then an X position to the right of the line (after it) results in 0 being stored in index_ and trailing. An X position to the left of the line results in index_ pointing to the (logical) last grapheme in the line and trailing being set to the number of characters in that grapheme. The reverse is true for a left-to-right line.

x_pos

the X offset (in Pango units) from the left edge of the line.

index_

location to store calculated byte index for the grapheme in which the user clicked.

trailing

location to store an integer indicating where in the grapheme the user clicked. It will either be zero, or the number of characters in the grapheme. 0 represents the leading edge of the grapheme.

Returns

false if x_pos was outside the line, true if inside

Trait Implementations

impl Clone for LayoutLine

impl Debug for LayoutLine[src]

impl Eq for LayoutLine[src]

impl Hash for LayoutLine[src]

impl Ord for LayoutLine[src]

impl PartialEq<LayoutLine> for LayoutLine[src]

impl PartialOrd<LayoutLine> for LayoutLine[src]

impl StaticType for LayoutLine

impl StructuralEq for LayoutLine[src]

impl StructuralPartialEq for LayoutLine[src]

Auto Trait Implementations

impl RefUnwindSafe for LayoutLine

impl !Send for LayoutLine

impl !Sync for LayoutLine

impl Unpin for LayoutLine

impl UnwindSafe for LayoutLine

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<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

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

type Owned = T

The resulting type after obtaining ownership.

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

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.