[]Struct pango::GlyphItem

pub struct GlyphItem(_);

A GlyphItem is a pair of a Item and the glyphs resulting from shaping the text corresponding to an item. As an example of the usage of GlyphItem, the results of shaping text with Layout is a list of LayoutLine, each of which contains a list of GlyphItem.


impl GlyphItem[src]

pub fn apply_attrs(&mut self, text: &str, list: &AttrList) -> Vec<GlyphItem>[src]

Splits a shaped item (PangoGlyphItem) into multiple items based on an attribute list. The idea is that if you have attributes that don't affect shaping, such as color or underline, to avoid affecting shaping, you filter them out (AttrList::filter), apply the shaping process and then reapply them to the result using this function.

All attributes that start or end inside a cluster are applied to that cluster; for instance, if half of a cluster is underlined and the other-half strikethrough, then the cluster will end up with both underline and strikethrough attributes. In these cases, it may happen that item->extra_attrs for some of the result items can have multiple attributes of the same type.

This function takes ownership of self; it will be reused as one of the elements in the list.


text that list applies to


a AttrList


a list of glyph items resulting from splitting self. Free the elements using GlyphItem::free, the list using glib::SList::free.

pub fn split(&mut self, text: &str, split_index: i32) -> Option<GlyphItem>[src]

Modifies self to cover only the text after split_index, and returns a new item that covers the text before split_index that used to be in self. You can think of split_index as the length of the returned item. split_index may not be 0, and it may not be greater than or equal to the length of self (that is, there must be at least one byte assigned to each item, you can't create a zero-length item).

This function is similar in function to Item::split (and uses it internally.)


text to which positions in self apply


byte index of position to split item, relative to the start of the item


the newly allocated item representing text before split_index, which should be freed with GlyphItem::free.

impl GlyphItem[src]

pub fn item(&self) -> Item[src]

pub fn glyph_string(&self) -> GlyphString[src]

Trait Implementations

impl Clone for GlyphItem

impl Debug for GlyphItem[src]

impl Eq for GlyphItem[src]

impl Hash for GlyphItem[src]

impl Ord for GlyphItem[src]

impl PartialEq<GlyphItem> for GlyphItem[src]

impl PartialOrd<GlyphItem> for GlyphItem[src]

impl StaticType for GlyphItem

impl StructuralEq for GlyphItem[src]

impl StructuralPartialEq for GlyphItem[src]

Auto Trait Implementations

impl RefUnwindSafe for GlyphItem

impl !Send for GlyphItem

impl !Sync for GlyphItem

impl Unpin for GlyphItem

impl UnwindSafe for GlyphItem

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

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>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.