pub use rusttype::Font;
use super::{Colour, Draw, DrawShared, Pass};
use crate::geom::Rect;
use crate::Align;
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
pub struct FontId(pub usize);
#[derive(Copy, Clone, Debug, Default, PartialEq)]
pub struct TextProperties {
pub font: FontId,
pub scale: f32,
pub col: Colour,
pub align: (Align, Align),
pub line_wrap: bool,
}
pub trait DrawTextShared: DrawShared {
fn load_font(&mut self, font: Font<'static>) -> FontId;
}
pub trait DrawText: Draw {
fn text(&mut self, pass: Pass, rect: Rect, text: &str, props: TextProperties);
fn text_bound(
&mut self,
text: &str,
font_id: FontId,
font_scale: f32,
bounds: (f32, f32),
line_wrap: bool,
) -> (f32, f32);
}