summaryrefslogtreecommitdiff
path: root/src/font/variant.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/font/variant.rs')
-rw-r--r--src/font/variant.rs22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/font/variant.rs b/src/font/variant.rs
index 4eda80ad..9391aae1 100644
--- a/src/font/variant.rs
+++ b/src/font/variant.rs
@@ -2,7 +2,7 @@ use std::fmt::{self, Debug, Formatter};
use serde::{Deserialize, Serialize};
-use crate::eval::{cast_from_value, cast_to_value, Value};
+use crate::eval::{cast_from_value, cast_to_value, Cast, Value};
use crate::geom::Ratio;
/// Properties that distinguish a font from other fonts in the same family.
@@ -32,7 +32,7 @@ impl Debug for FontVariant {
/// The style of a font.
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
-#[derive(Serialize, Deserialize)]
+#[derive(Serialize, Deserialize, Cast)]
#[serde(rename_all = "kebab-case")]
pub enum FontStyle {
/// The default, typically upright style.
@@ -62,24 +62,6 @@ impl Default for FontStyle {
}
}
-cast_from_value! {
- FontStyle,
- /// The default, typically upright style.
- "normal" => Self::Normal,
- /// A cursive style with custom letterform.
- "italic" => Self::Italic,
- /// Just a slanted version of the normal style.
- "oblique" => Self::Oblique,
-}
-
-cast_to_value! {
- v: FontStyle => Value::from(match v {
- FontStyle::Normal => "normal",
- FontStyle::Italic => "italic",
- FontStyle::Oblique => "oblique",
- })
-}
-
/// The weight of a font.
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Serialize, Deserialize)]