[−][src]Struct rusttyper::RunBuffer
Implementations
impl<'text, P> RunBuffer<'text, P> where
P: 'text,
[src]
P: 'text,
pub fn new() -> Self
[src]
pub fn push_run<I>(&mut self, layout: Layout<P>, it: I) where
I: Iterator<Item = Text<'text>>,
[src]
I: Iterator<Item = Text<'text>>,
pub fn push<T>(&mut self, layout: Layout<P>, t: T) where
T: Into<Text<'text>>,
[src]
T: Into<Text<'text>>,
pub fn write<S>(&mut self, pos: P, width: u32, text: S) where
S: Into<Cow<'text, str>>,
[src]
S: Into<Cow<'text, str>>,
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]
&mut self,
render: &'fonts mut Render
) -> (Point<f32>, &mut Layout<P>)
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]
F: for<'x, 'y> FnMut(&'x Text<'y>, &P, Rect<i32>, Rect<f32>) -> FlowControl,
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
Auto Trait Implementations
impl<'text, P> RefUnwindSafe for RunBuffer<'text, P> where
P: RefUnwindSafe,
P: RefUnwindSafe,
impl<'text, P> Send for RunBuffer<'text, P> where
P: Send,
P: Send,
impl<'text, P> Sync for RunBuffer<'text, P> where
P: Sync,
P: Sync,
impl<'text, P> Unpin for RunBuffer<'text, P> where
P: Unpin,
P: Unpin,
impl<'text, P> UnwindSafe for RunBuffer<'text, P> where
P: UnwindSafe,
P: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,