Draft Font type and implement Text::font
This commit is contained in:
parent
f0b1e65ba4
commit
6857829dc3
10 changed files with 96 additions and 31 deletions
|
|
@ -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<u16>,
|
||||
pub color: Option<Color>,
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue