freya-core 0.4.0-rc.7

Reactivity runtime, tree management, accessibility integration, rendering pipeline and more, for Freya
Documentation
use freya_engine::prelude::Slant as SkSlant;

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Default)]
pub enum FontSlant {
    #[default]
    Upright = 0,
    Italic = 1,
    Oblique = 2,
}

impl FontSlant {
    pub fn pretty(&self) -> String {
        match self {
            Self::Upright => "Upright".to_string(),
            Self::Italic => "Italic".to_string(),
            Self::Oblique => "Oblique".to_string(),
        }
    }
}

impl From<FontSlant> for SkSlant {
    fn from(value: FontSlant) -> Self {
        match value {
            FontSlant::Italic => SkSlant::Italic,
            FontSlant::Oblique => SkSlant::Oblique,
            FontSlant::Upright => SkSlant::Upright,
        }
    }
}