use crate::core::{FontInfo, Font};
#[must_use]
#[derive(Clone)]
pub struct FontQueryBuilder {
info: FontInfo,
}
impl FontQueryBuilder {
pub fn family(mut self: Self, family: &str) -> Self {
self.info.family = family.to_string();
self
}
pub fn italic(mut self: Self) -> Self {
self.info.italic = true;
self
}
pub fn oblique(mut self: Self) -> Self {
self.info.oblique = true;
self
}
pub fn monospace(mut self: Self) -> Self {
self.info.monospace = true;
self
}
pub fn bold(mut self: Self) -> Self {
self.info.bold = true;
self
}
pub fn fetch(self: Self) -> Vec<String> {
Font::query_specific(self.info)
}
pub(crate) fn new() -> FontQueryBuilder {
FontQueryBuilder {
info: FontInfo { ..FontInfo::default() },
}
}
}