use super::*;
impl Default for NativeSystemFont {
fn default() -> Self {
Self::deterministic()
}
}
impl NativeSystemFont {
#[must_use]
pub fn system() -> Self {
Self {
info: probe_system_font(),
deterministic_only: false,
}
}
#[must_use]
pub fn deterministic() -> Self {
Self {
info: SystemFontInfo::new(
FontRenderBackend::DeterministicBitmap,
FONT_FAMILY_DETERMINISTIC.to_string(),
true,
false,
),
deterministic_only: true,
}
}
}
impl SystemFontProvider for NativeSystemFont {
fn font_info(&self) -> SystemFontInfo {
self.get_info().clone()
}
fn rasterize(&self, key: GlyphKey) -> Option<RasterizedGlyph> {
if !self.get_deterministic_only()
&& let Some(native_glyph) = rasterize_native_glyph(key)
{
return Some(native_glyph);
}
Some(rasterize_glyph(key))
}
}