2021-10-14 16:59:19 +07:00
|
|
|
use crate::alignment;
|
|
|
|
|
use crate::{Color, Rectangle, Renderer};
|
|
|
|
|
|
|
|
|
|
pub trait Text: Renderer {
|
|
|
|
|
/// The font type used.
|
|
|
|
|
type Font: Default + Copy;
|
|
|
|
|
|
|
|
|
|
fn fill_text(&mut self, section: Section<'_, Self::Font>);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Copy)]
|
|
|
|
|
pub struct Section<'a, Font> {
|
|
|
|
|
pub content: &'a str,
|
|
|
|
|
pub bounds: Rectangle,
|
2021-10-18 15:19:04 +07:00
|
|
|
pub size: f32,
|
|
|
|
|
pub color: Color,
|
2021-10-14 16:59:19 +07:00
|
|
|
pub font: Font,
|
|
|
|
|
pub horizontal_alignment: alignment::Horizontal,
|
|
|
|
|
pub vertical_alignment: alignment::Vertical,
|
|
|
|
|
}
|