INNER CODE UNIT · Rust
estimate_text_size
plotters-rs/plotters · plotters-backend/src/lib.rs:273
fn estimate_text_size<TStyle: BackendTextStyle>(
&self,
text: &str,
style: &TStyle,
) -> Result<(u32, u32), DrawingErrorKind<Self::ErrorType>> {
let layout = style
.layout_box(text)
.map_err(|e| DrawingErrorKind::FontError(Box::new(e)))?;
Ok((
((layout.1).0 - (layout.0).0) as u32,
((layout.1).1 - (layout.0).1) as u32,
))
}
/// Blit a bitmap on to the backend.
///
/// - `text`: pos the left upper conner of the bitmap to blit
/// - `src`: The source of the image