Struct wgpu_glyph::GlyphBrush [−][src]
pub struct GlyphBrush<Depth, F = FontArc, H = DefaultSectionHasher> { /* fields omitted */ }
Expand description
Object allowing glyph drawing, containing cache state. Manages glyph positioning cacheing, glyph draw caching & efficient GPU texture cache updating and re-sizing on demand.
Build using a GlyphBrushBuilder
.
Implementations
Queues a section/layout to be drawn by the next call of
draw_queued
. Can be
called multiple times to queue multiple sections for drawing.
Benefits from caching, see caching behaviour.
pub fn queue_custom_layout<'a, S, G>(&mut self, section: S, custom_layout: &G) where
G: GlyphPositioner,
S: Into<Cow<'a, Section<'a>>>,
pub fn queue_custom_layout<'a, S, G>(&mut self, section: S, custom_layout: &G) where
G: GlyphPositioner,
S: Into<Cow<'a, Section<'a>>>,
Queues a section/layout to be drawn by the next call of
draw_queued
. Can be
called multiple times to queue multiple sections for drawing.
Used to provide custom GlyphPositioner
logic, if using built-in
Layout
simply use
queue
Benefits from caching, see caching behaviour.
pub fn queue_pre_positioned(
&mut self,
glyphs: Vec<SectionGlyph>,
extra: Vec<Extra>,
bounds: Rect
)
pub fn queue_pre_positioned(
&mut self,
glyphs: Vec<SectionGlyph>,
extra: Vec<Extra>,
bounds: Rect
)
Queues pre-positioned glyphs to be processed by the next call of
draw_queued
. Can be
called multiple times.
pub fn keep_cached_custom_layout<'a, S, G>(
&mut self,
section: S,
custom_layout: &G
) where
S: Into<Cow<'a, Section<'a>>>,
G: GlyphPositioner,
pub fn keep_cached_custom_layout<'a, S, G>(
&mut self,
section: S,
custom_layout: &G
) where
S: Into<Cow<'a, Section<'a>>>,
G: GlyphPositioner,
Retains the section in the cache as if it had been used in the last draw-frame.
Should not be necessary unless using multiple draws per frame with distinct transforms, see caching behaviour.
Retains the section in the cache as if it had been used in the last draw-frame.
Should not be necessary unless using multiple draws per frame with distinct transforms, see caching behaviour.
Returns the available fonts.
The FontId
corresponds to the index of the font data.
pub fn draw_queued(
&mut self,
device: &Device,
staging_belt: &mut StagingBelt,
encoder: &mut CommandEncoder,
target: &TextureView,
target_width: u32,
target_height: u32
) -> Result<(), String>
pub fn draw_queued(
&mut self,
device: &Device,
staging_belt: &mut StagingBelt,
encoder: &mut CommandEncoder,
target: &TextureView,
target_width: u32,
target_height: u32
) -> Result<(), String>
Draws all queued sections onto a render target.
See queue
.
It does not submit the encoder command buffer to the device queue.
Trims the cache, see caching behaviour.
Panics
Panics if the provided target
has a texture format that does not match
the render_format
provided on creation of the GlyphBrush
.
pub fn draw_queued_with_transform(
&mut self,
device: &Device,
staging_belt: &mut StagingBelt,
encoder: &mut CommandEncoder,
target: &TextureView,
transform: [f32; 16]
) -> Result<(), String>
pub fn draw_queued_with_transform(
&mut self,
device: &Device,
staging_belt: &mut StagingBelt,
encoder: &mut CommandEncoder,
target: &TextureView,
transform: [f32; 16]
) -> Result<(), String>
Draws all queued sections onto a render target, applying a position
transform (e.g. a projection).
See queue
.
It does not submit the encoder command buffer to the device queue.
Trims the cache, see caching behaviour.
Panics
Panics if the provided target
has a texture format that does not match
the render_format
provided on creation of the GlyphBrush
.
pub fn draw_queued_with_transform_and_scissoring(
&mut self,
device: &Device,
staging_belt: &mut StagingBelt,
encoder: &mut CommandEncoder,
target: &TextureView,
transform: [f32; 16],
region: Region
) -> Result<(), String>
pub fn draw_queued_with_transform_and_scissoring(
&mut self,
device: &Device,
staging_belt: &mut StagingBelt,
encoder: &mut CommandEncoder,
target: &TextureView,
transform: [f32; 16],
region: Region
) -> Result<(), String>
Draws all queued sections onto a render target, applying a position
transform (e.g. a projection) and a scissoring region.
See queue
.
It does not submit the encoder command buffer to the device queue.
Trims the cache, see caching behaviour.
Panics
Panics if the provided target
has a texture format that does not match
the render_format
provided on creation of the GlyphBrush
.
pub fn draw_queued(
&mut self,
device: &Device,
staging_belt: &mut StagingBelt,
encoder: &mut CommandEncoder,
target: &TextureView,
depth_stencil_attachment: RenderPassDepthStencilAttachment<'_>,
target_width: u32,
target_height: u32
) -> Result<(), String>
pub fn draw_queued(
&mut self,
device: &Device,
staging_belt: &mut StagingBelt,
encoder: &mut CommandEncoder,
target: &TextureView,
depth_stencil_attachment: RenderPassDepthStencilAttachment<'_>,
target_width: u32,
target_height: u32
) -> Result<(), String>
Draws all queued sections onto a render target.
See queue
.
It does not submit the encoder command buffer to the device queue.
Trims the cache, see caching behaviour.
Panics
Panics if the provided target
has a texture format that does not match
the render_format
provided on creation of the GlyphBrush
.
pub fn draw_queued_with_transform(
&mut self,
device: &Device,
staging_belt: &mut StagingBelt,
encoder: &mut CommandEncoder,
target: &TextureView,
depth_stencil_attachment: RenderPassDepthStencilAttachment<'_>,
transform: [f32; 16]
) -> Result<(), String>
pub fn draw_queued_with_transform(
&mut self,
device: &Device,
staging_belt: &mut StagingBelt,
encoder: &mut CommandEncoder,
target: &TextureView,
depth_stencil_attachment: RenderPassDepthStencilAttachment<'_>,
transform: [f32; 16]
) -> Result<(), String>
Draws all queued sections onto a render target, applying a position
transform (e.g. a projection).
See queue
.
It does not submit the encoder command buffer to the device queue.
Trims the cache, see caching behaviour.
Panics
Panics if the provided target
has a texture format that does not match
the render_format
provided on creation of the GlyphBrush
.
pub fn draw_queued_with_transform_and_scissoring(
&mut self,
device: &Device,
staging_belt: &mut StagingBelt,
encoder: &mut CommandEncoder,
target: &TextureView,
depth_stencil_attachment: RenderPassDepthStencilAttachment<'_>,
transform: [f32; 16],
region: Region
) -> Result<(), String>
pub fn draw_queued_with_transform_and_scissoring(
&mut self,
device: &Device,
staging_belt: &mut StagingBelt,
encoder: &mut CommandEncoder,
target: &TextureView,
depth_stencil_attachment: RenderPassDepthStencilAttachment<'_>,
transform: [f32; 16],
region: Region
) -> Result<(), String>
Draws all queued sections onto a render target, applying a position
transform (e.g. a projection) and a scissoring region.
See queue
.
It does not submit the encoder command buffer to the device queue.
Trims the cache, see caching behaviour.
Panics
Panics if the provided target
has a texture format that does not match
the render_format
provided on creation of the GlyphBrush
.
Trait Implementations
fn glyphs_custom_layout<'a, 'b, S, L>(
&'b mut self,
section: S,
custom_layout: &L
) -> SectionGlyphIter<'b> where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a>>>,
fn glyphs_custom_layout<'a, 'b, S, L>(
&'b mut self,
section: S,
custom_layout: &L
) -> SectionGlyphIter<'b> where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a>>>,
Returns an iterator over the PositionedGlyph
s of the given section with a custom layout. Read more
fn glyph_bounds_custom_layout<'a, S, L>(
&mut self,
section: S,
custom_layout: &L
) -> Option<Rect> where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a>>>,
fn glyph_bounds_custom_layout<'a, S, L>(
&mut self,
section: S,
custom_layout: &L
) -> Option<Rect> where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a>>>,
Returns a bounding box for the section glyphs calculated using each glyph’s vertical & horizontal metrics. Read more
Returns an iterator over the PositionedGlyph
s of the given section. Read more