use crate::{
draw_target::DrawTarget, geometry::Point, pixelcolor::PixelColor, primitives::Rectangle,
text::Baseline,
};
mod character_style;
pub use character_style::CharacterStyle;
pub trait TextRenderer {
type Color: PixelColor;
fn draw_string<D>(
&self,
text: &str,
position: Point,
baseline: Baseline,
target: &mut D,
) -> Result<Point, D::Error>
where
D: DrawTarget<Color = Self::Color>;
fn draw_whitespace<D>(
&self,
width: u32,
position: Point,
baseline: Baseline,
target: &mut D,
) -> Result<Point, D::Error>
where
D: DrawTarget<Color = Self::Color>;
fn measure_string(&self, text: &str, position: Point, baseline: Baseline) -> TextMetrics;
fn line_height(&self) -> u32;
}
#[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "defmt", derive(::defmt::Format))]
pub struct TextMetrics {
pub bounding_box: Rectangle,
pub next_position: Point,
}