pub fn new(font: &Arc<CanvasFontFace>, em_size: f32) -> CanvasFontLineLayout {
        // Gather font info
        let ttf_font            = font.ttf_font();
        let units_per_em        = ttf_font.units_per_em().unwrap_or(16385) as f32;

        // Generate the initial font metrics
        let scale_factor        = (em_size / units_per_em) as f64;
        let ascent              = ttf_font.ascender() as f64;
        let descent             = ttf_font.descender() as f64;
        let inner_bounds        = (Coord2(0.0, descent * scale_factor), Coord2(0.0, ascent * scale_factor));

        let initial_metrics     = TextLayoutMetrics {
            inner_bounds:   inner_bounds,
            pos:            Coord2(0.0, 0.0)
        };

        CanvasFontLineLayout {
            font:           Arc::clone(font),
            units_per_em:   units_per_em,
            metrics:        initial_metrics,
            x_off:          0.0,
            y_off:          0.0,
            em_size:        em_size,
            pending:        String::new(),
            layout:         vec![]
        }
    }
///
/// Creates a new line layout.
///
Creates a new line layout.
Creates a new line layout .
pub fn new(font: &Arc<CanvasFontFace>, em_size: f32) -> CanvasFontLineLayout {
        // Gather font info
        let ttf_font            = font.ttf_font();
        let units_per_em        = ttf_font.units_per_em().unwrap_or(16385) as f32;
        // Generate the initial font metrics
        let scale_factor        = (em_size / units_per_em) as f64;
        let ascent              = ttf_font.ascender() as f64;
        let descent             = ttf_font.descender() as f64;
        let inner_bounds        = (Coord2(0.0, descent * scale_factor), Coord2(0.0, ascent * scale_factor));
        let initial_metrics     = TextLayoutMetrics {
            inner_bounds:   inner_bounds,
            pos:            Coord2(0.0, 0.0)
        };
        CanvasFontLineLayout {
            font:           Arc::clone(font),
            units_per_em:   units_per_em,
            metrics:        initial_metrics,
            x_off:          0.0,
            y_off:          0.0,
            em_size:        em_size,
            pending:        String::new(),
            layout:         vec![]
        }
    }
pub fn new ( font : & Arc < CanvasFontFace > , em_size : f32 ) -> CanvasFontLineLayout { // Gather font info let ttf_font = font . ttf_font ( ) ; let units_per_em = ttf_font . units_per_em ( ) . unwrap_or ( 16385 ) as f32 ; // Generate the initial font metrics let scale_factor = ( em_size / units_per_em ) as f64 ; let ascent = ttf_font . ascender ( ) as f64 ; let descent = ttf_font . descender ( ) as f64 ; let inner_bounds = ( Coord2 ( 0.0 , descent * scale_factor ) , Coord2 ( 0.0 , ascent * scale_factor ) ) ; let initial_metrics = TextLayoutMetrics { inner_bounds : inner_bounds , pos : Coord2 ( 0.0 , 0.0 ) } ; CanvasFontLineLayout { font : Arc :: clone ( font ) , units_per_em : units_per_em , metrics : initial_metrics , x_off : 0.0 , y_off : 0.0 , em_size : em_size , pending : String :: new ( ) , layout : vec ! [ ] } }
Creates a new line layout.
Creates a new line layout .
font
&Arc<CanvasFontFace>
em_size
f32