Struct wgpu_glyph::GlyphBrushBuilder [−][src]
pub struct GlyphBrushBuilder<D, F, H = DefaultSectionHasher> { /* fields omitted */ }
Expand description
Builder for a GlyphBrush
.
Implementations
Specifies the default font used to render glyphs.
Referenced with FontId(0)
, which is default.
Adds additional fonts to the one added in using_font
.
Returns a FontId
to reference this font.
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)
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
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
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
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
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
When multiple CPU cores are available spread rasterization work across all cores.
Significantly reduces worst case latency in multicore environments.
By default, this feature is enabled.
Platform-specific behaviour
This option has no effect on wasm32.
Sets the texture filtering method.
Sets the section hasher. GlyphBrush
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 depth_stencil_state(
self,
depth_stencil_state: DepthStencilState
) -> GlyphBrushBuilder<DepthStencilState, F, H>
pub fn depth_stencil_state(
self,
depth_stencil_state: DepthStencilState
) -> GlyphBrushBuilder<DepthStencilState, F, H>
Sets the depth stencil.
Builds a GlyphBrush
using the given wgpu::Device
that can render
text for texture views with the given render_format
.
pub fn build(
self,
device: &Device,
render_format: TextureFormat
) -> GlyphBrush<DepthStencilState, F, H>
pub fn build(
self,
device: &Device,
render_format: TextureFormat
) -> GlyphBrush<DepthStencilState, F, H>
Builds a GlyphBrush
using the given wgpu::Device
that can render
text for texture views with the given render_format
.
Trait Implementations
Performs the conversion.