use crate::{Data, FontFamily, FontStyle, FontWeight};
#[derive(Debug, Data, Clone, PartialEq)]
pub struct FontDescriptor {
pub family: FontFamily,
pub size: f64,
pub weight: FontWeight,
pub style: FontStyle,
}
impl FontDescriptor {
pub const fn new(family: FontFamily) -> Self {
FontDescriptor {
family,
size: crate::piet::util::DEFAULT_FONT_SIZE,
weight: FontWeight::REGULAR,
style: FontStyle::Regular,
}
}
pub const fn with_size(mut self, size: f64) -> Self {
self.size = size;
self
}
pub const fn with_weight(mut self, weight: FontWeight) -> Self {
self.weight = weight;
self
}
pub const fn with_style(mut self, style: FontStyle) -> Self {
self.style = style;
self
}
}
impl Default for FontDescriptor {
fn default() -> Self {
FontDescriptor {
family: Default::default(),
weight: Default::default(),
style: Default::default(),
size: crate::piet::util::DEFAULT_FONT_SIZE,
}
}
}