radiant-rs 0.15.0

Thread-safe Rust sprite rendering engine with a friendly API and custom shader support
Documentation
use crate::core::{FontInfo, Font};

/// A FontQueryBuilder builder, returned from Font::query().
#[must_use]
#[derive(Clone)]
pub struct FontQueryBuilder {
    info: FontInfo,
}

impl FontQueryBuilder {
    /// Sets a family for the Fonts.
    pub fn family(mut self: Self, family: &str) -> Self {
        self.info.family = family.to_string();
        self
    }
    /// Requires the fonts to support italic.
    pub fn italic(mut self: Self) -> Self {
        self.info.italic = true;
        self
    }
    /// Requires the fonts to support oblique.
    pub fn oblique(mut self: Self) -> Self {
        self.info.oblique = true;
        self
    }
    /// Requires the fonts to support monospace.
    pub fn monospace(mut self: Self) -> Self {
        self.info.monospace = true;
        self
    }
    /// Requires the fonts to support bold.
    pub fn bold(mut self: Self) -> Self {
        self.info.bold = true;
        self
    }
    /// Returns a vector of matching font families.
    pub fn fetch(self: Self) -> Vec<String> {
        Font::query_specific(self.info)
    }
    /// Creates a new FontQueryBuilder instance.
    pub(crate) fn new() -> FontQueryBuilder {
        FontQueryBuilder {
            info: FontInfo { ..FontInfo::default() },
        }
    }
}