INNER CODE UNIT · Rust

draw_text

plotters-rs/plotters · plotters-backend/src/lib.rs:221

    fn draw_text<TStyle: BackendTextStyle>(
        &mut self,
        text: &str,
        style: &TStyle,
        pos: BackendCoord,
    ) -> Result<(), DrawingErrorKind<Self::ErrorType>> {
        let color = style.color();
        if color.alpha == 0.0 {
            return Ok(());
        }

        let layout = style
            .layout_box(text)
            .map_err(|e| DrawingErrorKind::FontError(Box::new(e)))?;
        let ((min_x, min_y), (max_x, max_y)) = layout;
        let width = max_x - min_x;
        let height = max_y - min_y;
        let dx = match style.anchor().h_pos {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…