pub struct VisualTextLine { /* private fields */ }Expand description
Maps logical grapheme boundaries to the advances of a shaped visual line.
Implementations§
Source§impl VisualTextLine
impl VisualTextLine
Sourcepub fn new(text: &str, glyphs: impl IntoIterator<Item = (usize, f32)>) -> Self
pub fn new(text: &str, glyphs: impl IntoIterator<Item = (usize, f32)>) -> Self
Each glyph supplies its source byte index and horizontal advance in drawing order.
pub fn width(&self) -> f32
pub fn is_rtl(&self) -> bool
pub fn graphemes(&self) -> &[VisualGrapheme]
pub fn caret_x(&self, position: TextPosition) -> f32
pub fn hit(&self, x: f32) -> TextPosition
pub fn edge(&self, right: bool) -> TextPosition
pub fn step(&self, position: TextPosition, right: bool) -> Option<TextPosition>
Sourcepub fn word_step(
&self,
text: &str,
position: TextPosition,
right: bool,
) -> Option<TextPosition>
pub fn word_step( &self, text: &str, position: TextPosition, right: bool, ) -> Option<TextPosition>
Seek the edge of the next Unicode word in visual order.
pub fn selection_edge( &self, bytes: Range<usize>, right: bool, ) -> Option<TextPosition>
pub fn selection_spans(&self, bytes: Range<usize>) -> Vec<Range<f32>>
Trait Implementations§
Source§impl Clone for VisualTextLine
impl Clone for VisualTextLine
Source§impl Debug for VisualTextLine
impl Debug for VisualTextLine
Source§impl PartialEq for VisualTextLine
impl PartialEq for VisualTextLine
impl StructuralPartialEq for VisualTextLine
Auto Trait Implementations§
impl Forget for VisualTextLine
impl Freeze for VisualTextLine
impl Move for VisualTextLine
impl RefUnwindSafe for VisualTextLine
impl Send for VisualTextLine
impl Sync for VisualTextLine
impl Unpin for VisualTextLine
impl UnsafeUnpin for VisualTextLine
impl UnwindSafe for VisualTextLine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more