/// Calculates the bounds for text.
Calculates the bounds for text.
Calculates the bounds for text .
pub fn text_bounds(&mut self, text: &str, size: u32, max_width: Option<f32>) -> LocalRect {
        self.setup_layout(text, size, max_width);
        let mut min = LocalPoint::new(f32::MAX, f32::MAX);
        let mut max = LocalPoint::new(f32::MIN, f32::MIN);
        let scale = self.device_px_ratio;
        for glyph in self.layout.glyphs() {
            min = min.min([glyph.x / scale, glyph.y / scale].into());
            max = max.max(
                [
                    (glyph.x + glyph.width as f32) / scale,
                    (glyph.y + glyph.height as f32) / scale,
                ]
                .into(),
            );
        }
        LocalRect::new(min, (max - min).into())
    }
pub fn text_bounds ( & mut self , text : & str , size : u32 , max_width : Option < f32 > ) -> LocalRect { self . setup_layout ( text , size , max_width ) ; let mut min = LocalPoint :: new ( f32 :: MAX , f32 :: MAX ) ; let mut max = LocalPoint :: new ( f32 :: MIN , f32 :: MIN ) ; let scale = self . device_px_ratio ; for glyph in self . layout . glyphs ( ) { min = min . min ( [ glyph . x / scale , glyph . y / scale ] . into ( ) ) ; max = max . max ( [ ( glyph . x + glyph . width as f32 ) / scale , ( glyph . y + glyph . height as f32 ) / scale , ] . into ( ) , ) ; } LocalRect :: new ( min , ( max - min ) . into ( ) ) }
Calculates the bounds for text.
Calculates the bounds for text .
&mut self
text
&str
size
u32
max_width
Option<f32>