Implement Widget::draw for Text
This commit is contained in:
parent
03b3493138
commit
3a0c503db9
11 changed files with 128 additions and 32 deletions
20
native/src/renderer/text.rs
Normal file
20
native/src/renderer/text.rs
Normal file
|
|
@ -0,0 +1,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: Option<f32>,
|
||||
pub color: Option<Color>,
|
||||
pub font: Font,
|
||||
pub horizontal_alignment: alignment::Horizontal,
|
||||
pub vertical_alignment: alignment::Vertical,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue