summaryrefslogtreecommitdiffstats
path: root/native/src/renderer/text.rs
blob: 9234c5874e02ddffce084d296b2799c8b75af20c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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,
    pub size: f32,
    pub color: Color,
    pub font: Font,
    pub horizontal_alignment: alignment::Horizontal,
    pub vertical_alignment: alignment::Vertical,
}