fn offset_horiz(&self, text_span: &TextSpan) -> Result<(u16, u16)> {
        debug!("offset_horiz '{}'", text_span.text);
        let rs = &text_span.state;
        let mut before = 0;
        let mut after = 0;
        let mut pspan = None;
        for span in self.spans.iter().filter(|s| rs.matches_span(&s.state)) {
            if let Some(ps) = pspan {
                let w = span.char_spacing_between(ps, self.fonts)?;
                if span.state.span_number <= rs.span_number {
                    before += w
                } else {
                    after += w
                }
                debug!("  spacing {} before {} after {}", w, before, after);
            }
            let w = span.width(self.fonts)?;
            if span.state.span_number < rs.span_number {
                before += w
            } else {
                after += w
            }
            debug!("  span '{}'  before {} after {}", span.text, before, after);
            pspan = Some(span);
        }
        if before + after <= rs.text_rectangle.w {
            Ok((before, after))
        } else {
            Err(SyntaxError::TextTooBig)
        }
    }
/// Calculate horizontal offsets of a span.
///
/// Returns a tuple of (before, after) widths of matching spans.
Calculate horizontal offsets of a span.
Returns a tuple of (before, after) widths of matching spans.
Calculate horizontal offsets of a span . Returns a tuple of ( before after ) widths of matching spans .
fn offset_horiz(&self, text_span: &TextSpan) -> Result<(u16, u16)> {
        debug!("offset_horiz '{}'", text_span.text);
        let rs = &text_span.state;
        let mut before = 0;
        let mut after = 0;
        let mut pspan = None;
        for span in self.spans.iter().filter(|s| rs.matches_span(&s.state)) {
            if let Some(ps) = pspan {
                let w = span.char_spacing_between(ps, self.fonts)?;
                if span.state.span_number <= rs.span_number {
                    before += w
                } else {
                    after += w
                }
                debug!("  spacing {} before {} after {}", w, before, after);
            }
            let w = span.width(self.fonts)?;
            if span.state.span_number < rs.span_number {
                before += w
            } else {
                after += w
            }
            debug!("  span '{}'  before {} after {}", span.text, before, after);
            pspan = Some(span);
        }
        if before + after <= rs.text_rectangle.w {
            Ok((before, after))
        } else {
            Err(SyntaxError::TextTooBig)
        }
    }
fn offset_horiz ( & self , text_span : & TextSpan ) -> Result < ( u16 , u16 ) > { debug ! ( " " text_span text ) ; let rs = & text_span . state ; let mut before = 0 ; let mut after = 0 ; let mut pspan = None ; for span in self . spans . iter ( ) . filter ( | s | rs . matches_span ( & s . state ) ) { if let Some ( ps ) = pspan { let w = span . char_spacing_between ( ps , self . fonts ) ? ; if span . state . span_number <= rs . span_number { before += w } else { after += w } debug ! ( " " w before after ) ; } let w = span . width ( self . fonts ) ? ; if span . state . span_number < rs . span_number { before += w } else { after += w } debug ! ( " " span text before after ) ; pspan = Some ( span ) ; } if before + after <= rs . text_rectangle . w { Ok ( ( before , after ) ) } else { Err ( SyntaxError :: TextTooBig ) } }
Calculate horizontal offsets of a span.
Calculate horizontal offsets of a span .
&self
text_span
&TextSpan