diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-07-29 12:21:55 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-07-29 12:28:54 +0200 |
| commit | 7d15dc634b3be1b6e284bb6b2450e3736d3e6e8d (patch) | |
| tree | f1dc308528515ccfc90e047fe3cb75bd171b3f8c /src/font.rs | |
| parent | 853361338bd756c23992041511b1836a2cd0647f (diff) | |
Move font family and refactor alignment
Diffstat (limited to 'src/font.rs')
| -rw-r--r-- | src/font.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/font.rs b/src/font.rs index 93c21441..911bd2f1 100644 --- a/src/font.rs +++ b/src/font.rs @@ -334,6 +334,26 @@ impl FaceId { } } +/// A generic or named font family. +#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] +pub enum FontFamily { + Serif, + SansSerif, + Monospace, + Named(String), +} + +impl Display for FontFamily { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { + f.pad(match self { + Self::Serif => "serif", + Self::SansSerif => "sans-serif", + Self::Monospace => "monospace", + Self::Named(s) => s, + }) + } +} + /// Properties of a single font face. #[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] pub struct FaceInfo { |
