Introduce Weight enum to font

This commit is contained in:
Héctor Ramón Jiménez 2023-02-05 18:26:09 +01:00
parent eb3cd3a321
commit 32309f0140
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
3 changed files with 18 additions and 2 deletions

View file

@ -1,3 +1,4 @@
//! Load and use fonts.
use std::hash::Hash; use std::hash::Hash;
/// A font. /// A font.
@ -27,3 +28,18 @@ pub enum Font {
/// fixed width. /// fixed width.
Monospace, Monospace,
} }
/// The weight of some text.
#[allow(missing_docs)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Weight {
Thin,
ExtraLight,
Light,
Normal,
Medium,
Semibold,
Bold,
ExtraBold,
Black,
}

View file

@ -25,6 +25,7 @@
#![forbid(unsafe_code, rust_2018_idioms)] #![forbid(unsafe_code, rust_2018_idioms)]
#![allow(clippy::inherent_to_string, clippy::type_complexity)] #![allow(clippy::inherent_to_string, clippy::type_complexity)]
pub mod alignment; pub mod alignment;
pub mod font;
pub mod keyboard; pub mod keyboard;
pub mod mouse; pub mod mouse;
pub mod time; pub mod time;
@ -32,7 +33,6 @@ pub mod time;
mod background; mod background;
mod color; mod color;
mod content_fit; mod content_fit;
mod font;
mod length; mod length;
mod padding; mod padding;
mod pixels; mod pixels;

View file

@ -1,5 +1,5 @@
//! Load and use fonts. //! Load and use fonts.
pub use iced_core::Font; pub use iced_core::font::*;
use crate::command::{self, Command}; use crate::command::{self, Command};
use std::borrow::Cow; use std::borrow::Cow;