[][src]Trait kas::text::TextApiExt

pub trait TextApiExt: TextApi {
    pub fn update_env<F>(&mut self, f: F) -> Vec2
    where
        F: FnOnce(&mut UpdateEnv<'_>)
, { ... }
pub fn required_action(&self) -> Action { ... }
pub fn num_lines(&self) -> usize { ... }
pub fn find_line(&self, index: usize) -> Option<(usize, Range<usize>)> { ... }
pub fn line_range(&self, line: usize) -> Option<Range<usize>> { ... }
pub fn line_is_ltr(&self, line: usize) -> bool { ... }
pub fn line_is_rtl(&self, line: usize) -> bool { ... }
pub fn text_index_nearest(&self, pos: Vec2) -> usize { ... }
pub fn line_index_nearest(&self, line: usize, x: f32) -> Option<usize> { ... }
pub fn text_glyph_pos(&self, index: usize) -> MarkerPosIter

Notable traits for MarkerPosIter

impl Iterator for MarkerPosIter type Item = MarkerPos;
{ ... }
pub fn num_glyphs(&self) -> usize { ... }
pub fn glyphs<F>(&self, f: F)
    where
        F: FnMut(FontId, f32, f32, Glyph)
, { ... }
pub fn glyphs_with_effects<X, F, G>(
        &self,
        effects: &[Effect<X>],
        f: F,
        g: G
    )
    where
        F: FnMut(FontId, f32, f32, Glyph, usize, X),
        G: FnMut(f32, f32, f32, f32, usize, X),
        X: Copy + Default
, { ... }
pub fn highlight_lines(
        &self,
        range: Range<usize>
    ) -> Vec<(Vec2, Vec2), Global> { ... }
pub fn highlight_runs(
        &self,
        range: Range<usize>
    ) -> Vec<(Vec2, Vec2), Global> { ... } }

Extension trait over TextApi

Provided methods

pub fn update_env<F>(&mut self, f: F) -> Vec2 where
    F: FnOnce(&mut UpdateEnv<'_>), 
[src]

Update the environment and prepare, returning required size

This prepares text as necessary. It always performs line-wrapping.

pub fn required_action(&self) -> Action[src]

Get required action

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

Get the number of lines

Wraps TextDisplay::num_lines.

pub fn find_line(&self, index: usize) -> Option<(usize, Range<usize>)>[src]

Find the line containing text index

Wraps TextDisplay::find_line.

pub fn line_range(&self, line: usize) -> Option<Range<usize>>[src]

Get the range of a line, by line number

Wraps TextDisplay::line_range.

pub fn line_is_ltr(&self, line: usize) -> bool[src]

Get the directionality of the current line

Wraps TextDisplay::line_is_ltr.

pub fn line_is_rtl(&self, line: usize) -> bool[src]

Get the directionality of the current line

Wraps TextDisplay::line_is_rtl.

pub fn text_index_nearest(&self, pos: Vec2) -> usize[src]

Find the text index for the glyph nearest the given pos

Wraps TextDisplay::text_index_nearest.

pub fn line_index_nearest(&self, line: usize, x: f32) -> Option<usize>[src]

Find the text index nearest horizontal-coordinate x on line

Wraps TextDisplay::line_index_nearest.

pub fn text_glyph_pos(&self, index: usize) -> MarkerPosIter

Notable traits for MarkerPosIter

impl Iterator for MarkerPosIter type Item = MarkerPos;
[src]

Find the starting position (top-left) of the glyph at the given index

Wraps TextDisplay::text_glyph_pos.

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

Get the number of glyphs

Wraps TextDisplay::num_glyphs.

pub fn glyphs<F>(&self, f: F) where
    F: FnMut(FontId, f32, f32, Glyph), 
[src]

Yield a sequence of positioned glyphs

Wraps TextDisplay::glyphs.

pub fn glyphs_with_effects<X, F, G>(&self, effects: &[Effect<X>], f: F, g: G) where
    F: FnMut(FontId, f32, f32, Glyph, usize, X),
    G: FnMut(f32, f32, f32, f32, usize, X),
    X: Copy + Default
[src]

Like TextDisplay::glyphs but with added effects

Wraps TextDisplay::glyphs_with_effects.

pub fn highlight_lines(&self, range: Range<usize>) -> Vec<(Vec2, Vec2), Global>[src]

Yield a sequence of rectangles to highlight a given range, by lines

Wraps TextDisplay::highlight_lines.

pub fn highlight_runs(&self, range: Range<usize>) -> Vec<(Vec2, Vec2), Global>[src]

Yield a sequence of rectangles to highlight a given range, by runs

Wraps TextDisplay::highlight_runs.

Loading content...

Implementors

impl<T> TextApiExt for T where
    T: TextApi + ?Sized
[src]

Loading content...