Struct gfx_glyph::GlyphBrushBuilder
[−]
[src]
pub struct GlyphBrushBuilder<'a> { /* fields omitted */ }
Builder for a GlyphBrush
.
Example
extern crate gfx_glyph; use gfx_glyph::GlyphBrushBuilder; let arial: &[u8] = include_bytes!("../examples/Arial Unicode.ttf"); let mut glyph_brush = GlyphBrushBuilder::using_font(arial) .build(gfx_factory.clone());
Methods
impl<'a> GlyphBrushBuilder<'a>
[src]
fn using_font<B: Into<SharedBytes<'a>>>(font_0_data: B) -> Self
[src]
Specifies the default font data used to render glyphs.
Referenced with FontId(0)
, which is default.
fn add_font<B: Into<SharedBytes<'a>>>(&mut self, font_data: B) -> FontId
[src]
Adds additional fonts to the one added in using_font
.
Returns a FontId
to reference this font.
fn initial_cache_size(self, size: (u32, u32)) -> Self
[src]
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)
fn gpu_cache_scale_tolerance(self, tolerance: f32) -> Self
[src]
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 rusttype docs for rusttype::gpu_cache::Cache
fn gpu_cache_position_tolerance(self, tolerance: f32) -> Self
[src]
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 rusttype docs for rusttype::gpu_cache::Cache
fn cache_glyph_positioning(self, cache: bool) -> Self
[src]
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_glyph_drawing
.
Defaults to true
fn cache_glyph_drawing(self, cache: bool) -> Self
[src]
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
fn depth_test(self, depth_test: Depth) -> Self
[src]
Sets the depth test to use on the text section z values.
Defaults to: Always pass the depth test, never write to the depth buffer write
Example
GlyphBrushBuilder::using_font(some_font) .depth_test(gfx::preset::depth::LESS_EQUAL_WRITE) // ...
fn build<R, F>(self, factory: F) -> GlyphBrush<'a, R, F> where
R: Resources,
F: Factory<R>,
[src]
R: Resources,
F: Factory<R>,
Builds a GlyphBrush
using the input gfx factory