diff options
author | 2021-10-14 16:59:19 +0700 | |
---|---|---|
committer | 2021-10-14 17:00:38 +0700 | |
commit | 3a0c503db99eb3d45ac971132904df419ee566b6 (patch) | |
tree | 7995e09ef75fb89f7146f4f490582b23193fdcd9 /native/src/renderer/text.rs | |
parent | 03b34931383e701c39c653a7662a616fe21a0947 (diff) | |
download | iced-3a0c503db99eb3d45ac971132904df419ee566b6.tar.gz iced-3a0c503db99eb3d45ac971132904df419ee566b6.tar.bz2 iced-3a0c503db99eb3d45ac971132904df419ee566b6.zip |
Implement `Widget::draw` for `Text`
Diffstat (limited to 'native/src/renderer/text.rs')
-rw-r--r-- | native/src/renderer/text.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/native/src/renderer/text.rs b/native/src/renderer/text.rs new file mode 100644 index 00000000..5c189d89 --- /dev/null +++ b/native/src/renderer/text.rs @@ -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, +} |