Enum glow_glyph::GlyphBrush
source · pub enum GlyphBrush<F = FontArc, H = DefaultSectionHasher> {
Core {
pipeline: Pipeline,
glyph_brush: GlyphBrush<Instance, Extra, F, H>,
},
Compatibility {
pipeline: Pipeline,
glyph_brush: GlyphBrush<[Vertex; 4], Extra, F, H>,
},
}
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
.
Variants§
Implementations§
source§impl<F: Font, H: BuildHasher> GlyphBrush<F, H>
impl<F: Font, H: BuildHasher> GlyphBrush<F, H>
sourcepub fn queue<'a, S>(&mut self, section: S)
pub fn queue<'a, S>(&mut self, section: S)
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.
sourcepub fn queue_custom_layout<'a, S, G>(&mut self, section: S, custom_layout: &G)
pub fn queue_custom_layout<'a, S, G>(&mut self, section: S, custom_layout: &G)
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.
sourcepub 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.
sourcepub fn keep_cached_custom_layout<'a, S, G>(
&mut self,
section: S,
custom_layout: &G
)
pub fn keep_cached_custom_layout<'a, S, G>( &mut self, section: S, custom_layout: &G )
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.
sourcepub fn keep_cached<'a, S>(&mut self, section: S)
pub fn keep_cached<'a, S>(&mut self, section: S)
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.
source§impl<F: Font + Sync, H: BuildHasher> GlyphBrush<F, H>
impl<F: Font + Sync, H: BuildHasher> GlyphBrush<F, H>
sourcepub fn draw_queued(
&mut self,
context: &Context,
target_width: u32,
target_height: u32
) -> Result<(), String>
pub fn draw_queued( &mut self, context: &Context, target_width: u32, target_height: u32 ) -> Result<(), String>
Draws all queued sections onto a render target.
See 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
.
sourcepub fn draw_queued_with_transform(
&mut self,
context: &Context,
transform: [f32; 16]
) -> Result<(), String>
pub fn draw_queued_with_transform( &mut self, context: &Context, transform: [f32; 16] ) -> Result<(), String>
Draws all queued sections onto a render target, applying a position
transform (e.g. a projection).
See 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
.
sourcepub fn draw_queued_with_transform_and_scissoring(
&mut self,
context: &Context,
transform: [f32; 16],
region: Region
) -> Result<(), String>
pub fn draw_queued_with_transform_and_scissoring( &mut self, context: &Context, 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
.
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§
source§impl<F, H> Debug for GlyphBrush<F, H>
impl<F, H> Debug for GlyphBrush<F, H>
source§impl<F: Font, H: BuildHasher> GlyphCruncher<F> for GlyphBrush<F, H>
impl<F: Font, H: BuildHasher> GlyphCruncher<F> for GlyphBrush<F, H>
source§fn glyphs_custom_layout<'a, 'b, S, L>(
&'b mut self,
section: S,
custom_layout: &L
) -> SectionGlyphIter<'b>
fn glyphs_custom_layout<'a, 'b, S, L>( &'b mut self, section: S, custom_layout: &L ) -> SectionGlyphIter<'b>
PositionedGlyph
s of the given section with a custom layout. Read moresource§fn glyph_bounds_custom_layout<'a, S, L>(
&mut self,
section: S,
custom_layout: &L
) -> Option<Rect>
fn glyph_bounds_custom_layout<'a, S, L>( &mut self, section: S, custom_layout: &L ) -> Option<Rect>
Auto Trait Implementations§
impl<F, H> Freeze for GlyphBrush<F, H>where
H: Freeze,
impl<F, H> RefUnwindSafe for GlyphBrush<F, H>where
H: RefUnwindSafe,
F: RefUnwindSafe,
impl<F, H> Send for GlyphBrush<F, H>
impl<F, H> Sync for GlyphBrush<F, H>
impl<F, H> Unpin for GlyphBrush<F, H>
impl<F, H> UnwindSafe for GlyphBrush<F, H>where
H: UnwindSafe,
F: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more