pub fn hovered_char(&self, text: &str, text_size: f32, pos: f32) -> Option<usize> {
        let iter = PlacementIter::new(text, &self.font, Scale::uniform(text_size), Vec2::ZERO);
        for PlacementInfo { caret, glyph, str_index } in iter {
            let width = glyph.unpositioned().h_metrics().advance_width;
            if caret.x + width/2.0 >= pos {
                return Some(str_index);
            }
        }
        None
    }
/// Finds the index of the character that would be under the cursor if the cursor is at the
/// given x-offset (`pos`) from the start of where the text is drawn. The returned index is
/// a byte index to the given piece of text.
Finds the index of the character that would be under the cursor if the cursor is at the
given x-offset (`pos`) from the start of where the text is drawn. The returned index is
a byte index to the given piece of text.
Finds the index of the character that would be under the cursor if the cursor is at the given x - offset ( ` pos ` ) from the start of where the text is drawn . The returned index is a byte index to the given piece of text .
pub fn hovered_char(&self, text: &str, text_size: f32, pos: f32) -> Option<usize> {
        let iter = PlacementIter::new(text, &self.font, Scale::uniform(text_size), Vec2::ZERO);
        for PlacementInfo { caret, glyph, str_index } in iter {
            let width = glyph.unpositioned().h_metrics().advance_width;
            if caret.x + width/2.0 >= pos {
                return Some(str_index);
            }
        }
        None
    }
pub fn hovered_char ( & self , text : & str , text_size : f32 , pos : f32 ) -> Option < usize > { let iter = PlacementIter :: new ( text , & self . font , Scale :: uniform ( text_size ) , Vec2 :: ZERO ) ; for PlacementInfo { caret , glyph , str_index } in iter { let width = glyph . unpositioned ( ) . h_metrics ( ) . advance_width ; if caret . x + width / 2.0 >= pos { return Some ( str_index ) ; } } None }
Finds the index of the character that would be under the cursor if the cursor is at the
given x-offset (`pos`) from the start of where the text is drawn.
Finds the index of the character that would be under the cursor if the cursor is at the given x - offset ( ` pos ` ) from the start of where the text is drawn .
&self
text
&str
text_size
f32
pos
f32
&self
text
&str
text_size
f32
pos
f32