summaryrefslogtreecommitdiffstats
path: root/wgpu/src/widget/canvas/text.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-10 06:12:06 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-10 06:12:06 +0100
commite4fbca59b4b9478c9c5fa5eec9ebe31dc93412ad (patch)
tree237d2e5dd29c2d0f05f2b68f829425bb480b8ce7 /wgpu/src/widget/canvas/text.rs
parent6151c528241d0a6ece88e6e664df1b50f8174ecb (diff)
parent5a91b52ef4066701d82a897b44a3f90412f210d2 (diff)
downloadiced-e4fbca59b4b9478c9c5fa5eec9ebe31dc93412ad.tar.gz
iced-e4fbca59b4b9478c9c5fa5eec9ebe31dc93412ad.tar.bz2
iced-e4fbca59b4b9478c9c5fa5eec9ebe31dc93412ad.zip
Merge branch 'master' into feature/panes-widget
Diffstat (limited to 'wgpu/src/widget/canvas/text.rs')
-rw-r--r--wgpu/src/widget/canvas/text.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/wgpu/src/widget/canvas/text.rs b/wgpu/src/widget/canvas/text.rs
new file mode 100644
index 00000000..d1cf1a0f
--- /dev/null
+++ b/wgpu/src/widget/canvas/text.rs
@@ -0,0 +1,34 @@
+use iced_native::{Color, Font, HorizontalAlignment, Point, VerticalAlignment};
+
+/// A bunch of text that can be drawn to a canvas
+#[derive(Debug, Clone)]
+pub struct Text {
+ /// The contents of the text
+ pub content: String,
+ /// The position where to begin drawing the text (top-left corner coordinates)
+ pub position: Point,
+ /// The color of the text
+ pub color: Color,
+ /// The size of the text
+ pub size: f32,
+ /// The font of the text
+ pub font: Font,
+ /// The horizontal alignment of the text
+ pub horizontal_alignment: HorizontalAlignment,
+ /// The vertical alignment of the text
+ pub vertical_alignment: VerticalAlignment,
+}
+
+impl Default for Text {
+ fn default() -> Text {
+ Text {
+ content: String::new(),
+ position: Point::ORIGIN,
+ color: Color::BLACK,
+ size: 16.0,
+ font: Font::Default,
+ horizontal_alignment: HorizontalAlignment::Left,
+ vertical_alignment: VerticalAlignment::Top,
+ }
+ }
+}