[][src]Struct rusttyper::RunBuffer

pub struct RunBuffer<'text, P> { /* fields omitted */ }

Implementations

impl<'text, P> RunBuffer<'text, P> where
    P: 'text, 
[src]

pub fn new() -> Self[src]

pub fn push_run<I>(&mut self, layout: Layout<P>, it: I) where
    I: Iterator<Item = Text<'text>>, 
[src]

pub fn push<T>(&mut self, layout: Layout<P>, t: T) where
    T: Into<Text<'text>>, 
[src]

pub fn write<S>(&mut self, pos: P, width: u32, text: S) where
    S: Into<Cow<'text, str>>, 
[src]

pub fn reset(&mut self)[src]

pub fn glyph_estimate(&self) -> usize[src]

Returns an estimate of how many glyphs are in the buffer. This may be inaccurate due to eg ligatures and normalization.

pub fn measure_area<'fonts>(
    &mut self,
    render: &'fonts mut Render
) -> (Point<f32>, &mut Layout<P>)
[src]

Runs the layout algorithm on the most recently added run, and returns the amount of space used, and its Layout object.

pub fn build<F>(&mut self, render: &mut Render, write_glyph: F) where
    F: for<'x, 'y> FnMut(&'x Text<'y>, &P, Rect<i32>, Rect<f32>) -> FlowControl
[src]

Runs the layout algorithm, and uploads glyphs to the cache.

write_glyph is called with each positioned glyph. You can use this to build your vertex buffer.

The first parameter holds the Text and Style. The second parameter is the origin, &P. The third parameter specifies the rectangle the glyph occupises, relative to the origin. For example, if P is a point in a 2D UI, then the glyph is simply positioned at origin + offset. The fourth parameter is UV coordinates.

Trait Implementations

impl<'text, P: Default> Default for RunBuffer<'text, P>[src]

Auto Trait Implementations

impl<'text, P> RefUnwindSafe for RunBuffer<'text, P> where
    P: RefUnwindSafe

impl<'text, P> Send for RunBuffer<'text, P> where
    P: Send

impl<'text, P> Sync for RunBuffer<'text, P> where
    P: Sync

impl<'text, P> Unpin for RunBuffer<'text, P> where
    P: Unpin

impl<'text, P> UnwindSafe for RunBuffer<'text, P> where
    P: UnwindSafe

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