Struct glyph_brush::GlyphCalculatorBuilder
source · pub struct GlyphCalculatorBuilder<F = FontArc, H = DefaultSectionHasher> { /* private fields */ }
Expand description
Builder for a GlyphCalculator
.
Example
use glyph_brush::{ab_glyph::FontArc, GlyphCalculator, GlyphCalculatorBuilder};
let dejavu = FontArc::try_from_slice(include_bytes!("../../fonts/DejaVuSans.ttf")).unwrap();
let mut glyphs: GlyphCalculator = GlyphCalculatorBuilder::using_font(dejavu).build();
Implementations§
source§impl<F: Font> GlyphCalculatorBuilder<F>
impl<F: Font> GlyphCalculatorBuilder<F>
sourcepub fn using_font(font: F) -> Self
pub fn using_font(font: F) -> Self
Specifies the default font used to render glyphs.
Referenced with FontId(0)
, which is default.
pub fn using_fonts(fonts: Vec<F>) -> Self
source§impl<F: Font, H: BuildHasher> GlyphCalculatorBuilder<F, H>
impl<F: Font, H: BuildHasher> GlyphCalculatorBuilder<F, H>
sourcepub fn add_font<I: Into<F>>(&mut self, font_data: I) -> FontId
pub fn add_font<I: Into<F>>(&mut self, font_data: I) -> FontId
Adds additional fonts to the one added in using_font
.
Returns a FontId
to reference this font.
sourcepub fn section_hasher<T: BuildHasher>(
self,
section_hasher: T
) -> GlyphCalculatorBuilder<F, T>
pub fn section_hasher<T: BuildHasher>( self, section_hasher: T ) -> GlyphCalculatorBuilder<F, T>
Sets the section hasher. GlyphCalculator
cannot handle absolute section hash collisions
so use a good hash algorithm.
This hasher is used to distinguish sections, rather than for hashmap internal use.
Defaults to xxHash.
sourcepub fn build<X>(self) -> GlyphCalculator<F, X, H>
pub fn build<X>(self) -> GlyphCalculator<F, X, H>
Builds a GlyphCalculator