Struct glium_glyph::GlyphBrushBuilder
source · pub struct GlyphBrushBuilder<'a, F: Font, H = DefaultSectionHasher> { /* private fields */ }
Implementations§
source§impl<'a, F: Font> GlyphBrushBuilder<'a, F>
impl<'a, F: Font> GlyphBrushBuilder<'a, F>
sourcepub fn using_font(font_0: F) -> Self
pub fn using_font(font_0: F) -> Self
Specifies the default font used to render glyphs.
Referenced with FontId(0)
, which is default.
pub fn using_fonts<V: Into<Vec<F>>>(fonts: V) -> Self
source§impl<'a, F: Font, H: BuildHasher> GlyphBrushBuilder<'a, F, H>
impl<'a, F: Font, H: BuildHasher> GlyphBrushBuilder<'a, F, H>
sourcepub fn add_font(&mut self, font_data: F) -> FontId
pub fn add_font(&mut self, font_data: F) -> FontId
Adds additional fonts to the one added in using_font
.
Returns a FontId
to reference this font.
sourcepub fn initial_cache_size(self, size: (u32, u32)) -> Self
pub fn initial_cache_size(self, size: (u32, u32)) -> Self
Initial size of 2D texture used as a gpu cache, pixels (width, height). The GPU cache will dynamically quadruple in size whenever the current size is insufficient.
Defaults to (256, 256)
sourcepub fn draw_cache_scale_tolerance(self, tolerance: f32) -> Self
pub fn draw_cache_scale_tolerance(self, tolerance: f32) -> Self
Sets the maximum allowed difference in scale used for judging whether to reuse an existing glyph in the GPU cache.
Defaults to 0.5
See docs for glyph_brush_draw_cache::DrawCache
sourcepub fn draw_cache_position_tolerance(self, tolerance: f32) -> Self
pub fn draw_cache_position_tolerance(self, tolerance: f32) -> Self
Sets the maximum allowed difference in subpixel position used for judging whether to reuse an existing glyph in the GPU cache. Anything greater than or equal to 1.0 means “don’t care”.
Defaults to 0.1
See docs for glyph_brush_draw_cache::DrawCache
sourcepub fn draw_cache_align_4x4(self, b: bool) -> Self
pub fn draw_cache_align_4x4(self, b: bool) -> Self
Align glyphs in texture cache to 4x4 texel boundaries.
If your backend requires texture updates to be aligned to 4x4 texel
boundaries (e.g. WebGL), this should be set to true
.
Defaults to false
See docs for glyph_brush_draw_cache::DrawCache
sourcepub fn cache_glyph_positioning(self, cache: bool) -> Self
pub fn cache_glyph_positioning(self, cache: bool) -> Self
Sets whether perform the calculation of glyph positioning according to the layout
every time, or use a cached result if the input Section
and GlyphPositioner
are the
same hash as a previous call.
Improves performance. Should only disable if using a custom GlyphPositioner that is
impure according to it’s inputs, so caching a previous call is not desired. Disabling
also disables cache_redraws
.
Defaults to true
sourcepub fn cache_redraws(self, cache: bool) -> Self
pub fn cache_redraws(self, cache: bool) -> Self
Sets optimising drawing by reusing the last draw requesting an identical draw queue.
Improves performance. Is disabled if
cache_glyph_positioning
is disabled.
Defaults to true
pub fn section_hasher<T: BuildHasher>(
self,
section_hasher: T
) -> GlyphBrushBuilder<'a, F, T>
pub fn params(self, params: DrawParameters<'a>) -> GlyphBrushBuilder<'a, F, H>
sourcepub fn build<C: Facade>(self, facade: &C) -> GlyphBrush<'a, F, H>
pub fn build<C: Facade>(self, facade: &C) -> GlyphBrush<'a, F, H>
Builds a GlyphBrush
using the input glium facade