fn span_x_center(&self, span: &TextSpan) -> Result<u16> {
        let left = span.state.text_rectangle.x - 1;
        let w = span.state.text_rectangle.w;
        let (before, after) = self.offset_horiz(span)?;
        let offset = (w - before - after) / 2; // offset for centering
        let x = left + offset + before;
        let cw = self.default_state.char_width();
        // Truncate to character-width boundary
        Ok((x / cw) * cw)
    }
/// Get the X position of a center-justified text span.
Get the X position of a center-justified text span.
Get the X position of a center - justified text span .
fn span_x_center(&self, span: &TextSpan) -> Result<u16> {
        let left = span.state.text_rectangle.x - 1;
        let w = span.state.text_rectangle.w;
        let (before, after) = self.offset_horiz(span)?;
        let offset = (w - before - after) / 2; // offset for centering
        let x = left + offset + before;
        let cw = self.default_state.char_width();
        // Truncate to character-width boundary
        Ok((x / cw) * cw)
    }
fn span_x_center ( & self , span : & TextSpan ) -> Result < u16 > { let left = span . state . text_rectangle . x - 1 ; let w = span . state . text_rectangle . w ; let ( before , after ) = self . offset_horiz ( span ) ? ; let offset = ( w - before - after ) / 2 ; // offset for centering let x = left + offset + before ; let cw = self . default_state . char_width ( ) ; // Truncate to character-width boundary Ok ( ( x / cw ) * cw ) }
Get the X position of a center-justified text span.
Get the X position of a center - justified text span .
&self
span
&TextSpan