summaryrefslogtreecommitdiffstats
path: root/native/src/text.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-10-31 16:13:03 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-10-31 16:14:38 +0700
commitb3a01973c6c726e6539be959659f4306ef3234c6 (patch)
tree06e6ce43b5e47eb78f2707eb2c6177a2f9af91f4 /native/src/text.rs
parent0aafcde0ef1533c9eeba0379de8c0082e30c7504 (diff)
downloadiced-b3a01973c6c726e6539be959659f4306ef3234c6.tar.gz
iced-b3a01973c6c726e6539be959659f4306ef3234c6.tar.bz2
iced-b3a01973c6c726e6539be959659f4306ef3234c6.zip
Introduce first-class `text` module in `iced_native`
Diffstat (limited to '')
-rw-r--r--native/src/text.rs (renamed from native/src/renderer/text.rs)30
1 files changed, 15 insertions, 15 deletions
diff --git a/native/src/renderer/text.rs b/native/src/text.rs
index fc1a2c66..f112a8f3 100644
--- a/native/src/renderer/text.rs
+++ b/native/src/text.rs
@@ -1,9 +1,20 @@
use crate::alignment;
-use crate::{Color, Point, Rectangle, Renderer, Size};
+use crate::{Color, Point, Rectangle, Size};
-pub use crate::widget::text::Hit;
+pub use iced_core::text::Hit;
-pub trait Text: Renderer {
+#[derive(Debug, Clone, Copy)]
+pub struct Text<'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,
+}
+
+pub trait Renderer: crate::Renderer {
/// The font type used.
type Font: Default + Copy;
@@ -56,16 +67,5 @@ pub trait Text: Renderer {
nearest_only: bool,
) -> Option<Hit>;
- 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,
+ fn fill_text(&mut self, text: Text<'_, Self::Font>);
}