pub fn cutoff(&self, text: &str, text_size: f32, space: f32) -> (usize, f32) {
        let mut index = 0;
        let mut width = 0.0;

        let mut prev = (0, 0.0);

        let iter = PlacementIter::new(text, &self.font, Scale::uniform(text_size), Vec2::ZERO);
        for PlacementInfo { caret, str_index, .. } in iter.clone() {
            if caret.x > space {
                break;
            } else {
                prev = (index, width);
                index = str_index;
                width = caret.x;
            }
        }

        prev
    }
/// Calculates the index of the last completly visible character, and the width of the total
/// visible text (Not including partially visible characters) if the text where to be drawn in
/// a constrained space.
///
/// Not tested for multiline strings!
Calculates the index of the last completly visible character, and the width of the total
visible text (Not including partially visible characters) if the text where to be drawn in
a constrained space.

Not tested for multiline strings!
Calculates the index of the last completly visible character and the width of the total visible text ( Not including partially visible characters ) if the text where to be drawn in a constrained space . Not tested for multiline strings!
pub fn cutoff(&self, text: &str, text_size: f32, space: f32) -> (usize, f32) {
        let mut index = 0;
        let mut width = 0.0;
        let mut prev = (0, 0.0);
        let iter = PlacementIter::new(text, &self.font, Scale::uniform(text_size), Vec2::ZERO);
        for PlacementInfo { caret, str_index, .. } in iter.clone() {
            if caret.x > space {
                break;
            } else {
                prev = (index, width);
                index = str_index;
                width = caret.x;
            }
        }
        prev
    }
pub fn cutoff ( & self , text : & str , text_size : f32 , space : f32 ) -> ( usize , f32 ) { let mut index = 0 ; let mut width = 0.0 ; let mut prev = ( 0 , 0.0 ) ; let iter = PlacementIter :: new ( text , & self . font , Scale :: uniform ( text_size ) , Vec2 :: ZERO ) ; for PlacementInfo { caret , str_index , .. } in iter . clone ( ) { if caret . x > space { break ; } else { prev = ( index , width ) ; index = str_index ; width = caret . x ; } } prev }
Calculates the index of the last completly visible character, and the width of the total
visible text (Not including partially visible characters) if the text where to be drawn in
a constrained space.
Calculates the index of the last completly visible character and the width of the total visible text ( Not including partially visible characters ) if the text where to be drawn in a constrained space .
&self
text
&str
text_size
f32
space
f32
&self
text
&str
text_size
f32
space
f32