From e86363837d8e3a6241a90cb5b895034f07106059 Mon Sep 17 00:00:00 2001 From: lufte Date: Fri, 18 Aug 2023 18:46:22 -0300 Subject: Make the style attribute available on Font --- core/src/font.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'core/src/font.rs') diff --git a/core/src/font.rs b/core/src/font.rs index bb425fd6..7f647847 100644 --- a/core/src/font.rs +++ b/core/src/font.rs @@ -10,6 +10,8 @@ pub struct Font { pub weight: Weight, /// The [`Stretch`] of the [`Font`]. pub stretch: Stretch, + /// The [`Style`] of the [`Font`]. + pub style: Style, /// Whether if the [`Font`] is monospaced or not. pub monospaced: bool, } @@ -20,6 +22,7 @@ impl Font { family: Family::SansSerif, weight: Weight::Normal, stretch: Stretch::Normal, + style: Style::Normal, monospaced: false, }; @@ -100,3 +103,13 @@ pub enum Stretch { ExtraExpanded, UltraExpanded, } + +/// The style of some text. +#[allow(missing_docs)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)] +pub enum Style { + #[default] + Normal, + Italic, + Oblique, +} -- cgit From 8eec0033dee816bfcc102fc4f511c8bfe08c14ee Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 18 Sep 2023 19:24:09 +0200 Subject: Remove unnecessary `monospaced` flag in `Font` --- core/src/font.rs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'core/src/font.rs') diff --git a/core/src/font.rs b/core/src/font.rs index 7f647847..2b68decf 100644 --- a/core/src/font.rs +++ b/core/src/font.rs @@ -12,8 +12,6 @@ pub struct Font { pub stretch: Stretch, /// The [`Style`] of the [`Font`]. pub style: Style, - /// Whether if the [`Font`] is monospaced or not. - pub monospaced: bool, } impl Font { @@ -23,13 +21,11 @@ impl Font { weight: Weight::Normal, stretch: Stretch::Normal, style: Style::Normal, - monospaced: false, }; /// A monospaced font with normal [`Weight`]. pub const MONOSPACE: Font = Font { family: Family::Monospace, - monospaced: true, ..Self::DEFAULT }; -- cgit