[][src]Struct wgpu_glyph::GlyphBrush

pub struct GlyphBrush<'font, Depth, H = DefaultSectionHasher> { /* fields omitted */ }

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, Depth, H: BuildHasher> GlyphBrush<'font, Depth, H>[src]

pub fn queue<'a, S>(&mut self, section: S) where
    S: Into<Cow<'a, VariedSection<'a>>>, 
[src]

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, VariedSection<'a>>>, 
[src]

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]

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]

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]

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 fonts(&self) -> &[Font][src]

Returns the available fonts.

The FontId corresponds to the index of the font data.

pub fn add_font_bytes<'a: 'font, B: Into<SharedBytes<'a>>>(
    &mut self,
    font_data: B
) -> FontId
[src]

Adds an additional font to the one(s) initially added on build.

Returns a new FontId to reference this font.

pub fn add_font<'a: 'font>(&mut self, font_data: Font<'a>) -> FontId[src]

Adds an additional font to the one(s) initially added on build.

Returns a new FontId to reference this font.

impl<'font, H: BuildHasher> GlyphBrush<'font, (), H>[src]

pub fn draw_queued(
    &mut self,
    device: &Device,
    encoder: &mut CommandEncoder,
    target: &TextureView,
    target_width: u32,
    target_height: u32
) -> Result<(), String>
[src]

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,
    encoder: &mut CommandEncoder,
    target: &TextureView,
    transform: [f32; 16]
) -> Result<(), String>
[src]

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,
    encoder: &mut CommandEncoder,
    target: &TextureView,
    transform: [f32; 16],
    region: Region
) -> Result<(), String>
[src]

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.

impl<'font, H: BuildHasher> GlyphBrush<'font, DepthStencilStateDescriptor, H>[src]

pub fn draw_queued(
    &mut self,
    device: &Device,
    encoder: &mut CommandEncoder,
    target: &TextureView,
    depth_stencil_attachment: RenderPassDepthStencilAttachmentDescriptor,
    target_width: u32,
    target_height: u32
) -> Result<(), String>
[src]

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,
    encoder: &mut CommandEncoder,
    target: &TextureView,
    depth_stencil_attachment: RenderPassDepthStencilAttachmentDescriptor,
    transform: [f32; 16]
) -> Result<(), String>
[src]

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,
    encoder: &mut CommandEncoder,
    target: &TextureView,
    depth_stencil_attachment: RenderPassDepthStencilAttachmentDescriptor,
    transform: [f32; 16],
    region: Region
) -> Result<(), String>
[src]

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

impl<'_, H> Debug for GlyphBrush<'_, H>[src]

impl<'font, D, H: BuildHasher> GlyphCruncher<'font> for GlyphBrush<'font, D, H>[src]

Auto Trait Implementations

impl<'font, Depth, H = RandomXxHashBuilder64> !RefUnwindSafe for GlyphBrush<'font, Depth, H>

impl<'font, Depth, H> Send for GlyphBrush<'font, Depth, H> where
    Depth: Send,
    H: Send

impl<'font, Depth, H> Sync for GlyphBrush<'font, Depth, H> where
    Depth: Sync,
    H: Sync

impl<'font, Depth, H> Unpin for GlyphBrush<'font, Depth, H> where
    Depth: Unpin,
    H: Unpin

impl<'font, Depth, H> UnwindSafe for GlyphBrush<'font, Depth, H> where
    Depth: UnwindSafe,
    H: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,