From 6857829dc3171fd68065498b6cd29f0ef02a8d43 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 13 Nov 2019 07:22:21 +0100 Subject: Draft `Font` type and implement `Text::font` --- core/src/widget/text.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'core/src/widget') diff --git a/core/src/widget/text.rs b/core/src/widget/text.rs index 427d9471..0996e7ff 100644 --- a/core/src/widget/text.rs +++ b/core/src/widget/text.rs @@ -1,5 +1,5 @@ //! Write some text for your users to read. -use crate::{Color, Length}; +use crate::{Color, Font, Length}; /// A paragraph of text. /// @@ -16,6 +16,7 @@ pub struct Text { pub content: String, pub size: Option, pub color: Option, + pub font: Font, pub width: Length, pub height: Length, pub horizontal_alignment: HorizontalAlignment, @@ -31,6 +32,7 @@ impl Text { content: String::from(label), size: None, color: None, + font: Font::Default, width: Length::Fill, height: Length::Shrink, horizontal_alignment: HorizontalAlignment::Left, @@ -54,6 +56,11 @@ impl Text { self } + pub fn font(mut self, font: Font) -> Self { + self.font = font; + self + } + /// Sets the width of the [`Text`] boundaries. /// /// [`Text`]: struct.Text.html -- cgit