Struct glyph_brush::GlyphCalculatorBuilder
source · pub struct GlyphCalculatorBuilder<'a, H = DefaultSectionHasher> { /* private fields */ }
Expand description
Builder for a GlyphCalculator
.
Example
extern crate glyph_brush;
use glyph_brush::GlyphCalculatorBuilder;
let dejavu: &[u8] = include_bytes!("../../fonts/DejaVuSans.ttf");
let mut glyphs = GlyphCalculatorBuilder::using_font_bytes(dejavu).build();
Implementations
sourceimpl<'a> GlyphCalculatorBuilder<'a>
impl<'a> GlyphCalculatorBuilder<'a>
sourcepub fn using_font_bytes<B: Into<SharedBytes<'a>>>(font_0_data: B) -> Self
pub fn using_font_bytes<B: Into<SharedBytes<'a>>>(font_0_data: B) -> Self
Specifies the default font data used to render glyphs.
Referenced with FontId(0)
, which is default.
pub fn using_fonts_bytes<B, V>(font_data: V) -> Selfwhere
B: Into<SharedBytes<'a>>,
V: Into<Vec<B>>,
sourcepub fn using_font(font_0_data: Font<'a>) -> Self
pub fn using_font(font_0_data: Font<'a>) -> Self
Specifies the default font used to render glyphs.
Referenced with FontId(0)
, which is default.
pub fn using_fonts<V: Into<Vec<Font<'a>>>>(fonts: V) -> Self
sourceimpl<'a, H: BuildHasher> GlyphCalculatorBuilder<'a, H>
impl<'a, H: BuildHasher> GlyphCalculatorBuilder<'a, H>
sourcepub fn add_font_bytes<B: Into<SharedBytes<'a>>>(
&mut self,
font_data: B
) -> FontId
pub fn add_font_bytes<B: Into<SharedBytes<'a>>>(
&mut self,
font_data: B
) -> FontId
Adds additional fonts to the one added in using_font
/
using_font_bytes
.
Returns a FontId
to reference this font.
sourcepub fn add_font(&mut self, font_data: Font<'a>) -> FontId
pub fn add_font(&mut self, font_data: Font<'a>) -> FontId
Adds additional fonts to the one added in using_font
/
using_font_bytes
.
Returns a FontId
to reference this font.
sourcepub fn section_hasher<T: BuildHasher>(
self,
section_hasher: T
) -> GlyphCalculatorBuilder<'a, T>
pub fn section_hasher<T: BuildHasher>(
self,
section_hasher: T
) -> GlyphCalculatorBuilder<'a, 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 seahash.
sourcepub fn build(self) -> GlyphCalculator<'a, H>
pub fn build(self) -> GlyphCalculator<'a, H>
Builds a GlyphCalculator
Auto Trait Implementations
impl<'a, H> RefUnwindSafe for GlyphCalculatorBuilder<'a, H>where
H: RefUnwindSafe,
impl<'a, H> Send for GlyphCalculatorBuilder<'a, H>where
H: Send,
impl<'a, H> Sync for GlyphCalculatorBuilder<'a, H>where
H: Sync,
impl<'a, H> Unpin for GlyphCalculatorBuilder<'a, H>where
H: Unpin,
impl<'a, H> UnwindSafe for GlyphCalculatorBuilder<'a, H>where
H: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more