[−][src]Struct wgpu_glyph::GlyphBrush
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
.
Methods
impl<'font, H: BuildHasher> GlyphBrush<'font, H>
[src]
pub fn queue<'a, S>(&mut self, section: S) where
S: Into<Cow<'a, VariedSection<'a>>>,
[src]
S: Into<Cow<'a, VariedSection<'a>>>,
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, VariedSection<'a>>>,
[src]
G: GlyphPositioner,
S: Into<Cow<'a, VariedSection<'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<(PositionedGlyph<'font>, Color, FontId)>,
bounds: Rect<f32>,
z: f32
)
[src]
&mut self,
glyphs: Vec<(PositionedGlyph<'font>, Color, FontId)>,
bounds: Rect<f32>,
z: f32
)
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, VariedSection<'a>>>,
G: GlyphPositioner,
[src]
&mut self,
section: S,
custom_layout: &G
) where
S: Into<Cow<'a, VariedSection<'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.
pub fn keep_cached<'a, S>(&mut self, section: S) where
S: Into<Cow<'a, VariedSection<'a>>>,
[src]
S: Into<Cow<'a, VariedSection<'a>>>,
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.
pub fn draw_queued(
&mut self,
device: &mut Device,
encoder: &mut CommandEncoder,
target: &TextureView,
target_width: u32,
target_height: u32
) -> Result<(), String>
[src]
&mut self,
device: &mut Device,
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,
transform: [f32; 16],
device: &mut Device,
encoder: &mut CommandEncoder,
target: &TextureView
) -> Result<(), String>
[src]
&mut self,
transform: [f32; 16],
device: &mut Device,
encoder: &mut CommandEncoder,
target: &TextureView
) -> 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 fonts(&self) -> &[Font]
[src]
Returns the available fonts.
The FontId
corresponds to the index of the font data.
Trait Implementations
impl<H, '_> Debug for GlyphBrush<'_, H>
[src]
impl<'font, H: BuildHasher> GlyphCruncher<'font> for GlyphBrush<'font, H>
[src]
fn pixel_bounds_custom_layout<'a, S, L>(
&mut self,
section: S,
custom_layout: &L
) -> Option<Rect<i32>> where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, VariedSection<'a>>>,
[src]
&mut self,
section: S,
custom_layout: &L
) -> Option<Rect<i32>> where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, VariedSection<'a>>>,
fn glyphs_custom_layout<'a, 'b, S, L>(
&'b mut self,
section: S,
custom_layout: &L
) -> PositionedGlyphIter<'b, 'font> where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, VariedSection<'a>>>,
[src]
&'b mut self,
section: S,
custom_layout: &L
) -> PositionedGlyphIter<'b, 'font> where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, VariedSection<'a>>>,
fn fonts(&self) -> &[Font<'font>]
[src]
fn pixel_bounds<'a, S>(&mut self, section: S) -> Option<Rect<i32>> where
S: Into<Cow<'a, VariedSection<'a>>>,
[src]
S: Into<Cow<'a, VariedSection<'a>>>,
Returns the pixel bounding box for the input section. The box is a conservative whole number pixel rectangle that can contain the section. Read more
fn glyphs<'a, S>(
&'b mut self,
section: S
) -> Map<Iter<'b, (PositionedGlyph<'font>, [f32; 4], FontId)>, fn(&'b (PositionedGlyph<'font>, [f32; 4], FontId)) -> &'b PositionedGlyph<'font>> where
S: Into<Cow<'a, VariedSection<'a>>>,
[src]
&'b mut self,
section: S
) -> Map<Iter<'b, (PositionedGlyph<'font>, [f32; 4], FontId)>, fn(&'b (PositionedGlyph<'font>, [f32; 4], FontId)) -> &'b PositionedGlyph<'font>> where
S: Into<Cow<'a, VariedSection<'a>>>,
Returns an iterator over the PositionedGlyph
s of the given section. Read more
Auto Trait Implementations
impl<'font, H = RandomXxHashBuilder> !Send for GlyphBrush<'font, H>
impl<'font, H = RandomXxHashBuilder> !Sync for GlyphBrush<'font, H>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,