[]Struct glyph_brush::GlyphCalculatorBuilder

pub struct GlyphCalculatorBuilder<'a, H = RandomXxHashBuilder64> { /* fields omitted */ }

Builder for a GlyphCalculator.

Example

use glyph_brush::GlyphCalculatorBuilder;

let dejavu: &[u8] = include_bytes!("../../fonts/DejaVuSans.ttf");
let mut glyphs = GlyphCalculatorBuilder::using_font_bytes(dejavu).build();

Methods

impl<'a> GlyphCalculatorBuilder<'a, RandomXxHashBuilder64>

pub fn using_font_bytes<B>(
    font_0_data: B
) -> GlyphCalculatorBuilder<'a, RandomXxHashBuilder64> where
    B: Into<SharedBytes<'a>>, 

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
) -> GlyphCalculatorBuilder<'a, RandomXxHashBuilder64> where
    B: Into<SharedBytes<'a>>,
    V: Into<Vec<B>>, 

pub fn using_font(
    font_0_data: Font<'a>
) -> GlyphCalculatorBuilder<'a, RandomXxHashBuilder64>

Specifies the default font used to render glyphs. Referenced with FontId(0), which is default.

pub fn using_fonts<V>(
    fonts: V
) -> GlyphCalculatorBuilder<'a, RandomXxHashBuilder64> where
    V: Into<Vec<Font<'a>>>, 

impl<'a, H> GlyphCalculatorBuilder<'a, H> where
    H: BuildHasher

pub fn add_font_bytes<B>(&mut self, font_data: B) -> FontId where
    B: Into<SharedBytes<'a>>, 

Adds additional fonts to the one added in using_font / using_font_bytes.

Returns a FontId to reference this font.

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.

pub fn section_hasher<T>(
    self,
    section_hasher: T
) -> GlyphCalculatorBuilder<'a, T> where
    T: BuildHasher

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.

pub fn build(self) -> GlyphCalculator<'a, H>

Builds a GlyphCalculator

Trait Implementations

impl<'a, H> Clone for GlyphCalculatorBuilder<'a, H> where
    H: Clone

impl<'a, H> Debug for GlyphCalculatorBuilder<'a, H> where
    H: Debug

Auto Trait Implementations

impl<'a, H> Send for GlyphCalculatorBuilder<'a, H> where
    H: Send

impl<'a, H> Unpin for GlyphCalculatorBuilder<'a, H> where
    H: Unpin

impl<'a, H> Sync for GlyphCalculatorBuilder<'a, H> where
    H: Sync

impl<'a, H> UnwindSafe for GlyphCalculatorBuilder<'a, H> where
    H: UnwindSafe

impl<'a, H> RefUnwindSafe for GlyphCalculatorBuilder<'a, H> where
    H: RefUnwindSafe

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,