Struct gfx_glyph::GlyphBrush [] [src]

pub struct GlyphBrush<'font, R: Resources, F: Factory<R>> { /* 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.

Example

extern crate gfx_glyph;
use gfx_glyph::Section;


let section = Section {
    text: "Hello gfx_glyph",
    ..Section::default()
};

glyph_brush.queue(section);
glyph_brush.queue(some_other_section);

glyph_brush.draw_queued(&mut gfx_encoder, &gfx_color, &gfx_depth).unwrap();

Caching behaviour

Calls to GlyphBrush::queue, GlyphBrush::pixel_bounds, GlyphBrush::glyphs calculate the positioned glyphs for a section. This is cached so future calls to any of the methods for the same section are much cheaper. In the case of GlyphBrush::queue the calculations will also be used for actual drawing.

The cache for a section will be cleared after a GlyphBrush::draw_queued call when that section has not been used since the previous draw call.

Methods

impl<'font, R: Resources, F: Factory<R>> GlyphBrush<'font, R, F>
[src]

[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.

[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.

[src]

Draws all queued sections onto a render target, applying a position transform (e.g. a projection). See queue.

Trims the cache, see caching behaviour.

[src]

Draws all queued sections onto a render target, applying a position transform (e.g. a projection). See queue.

Trims the cache, see caching behaviour.

[src]

Returns FontId -> Font map of available fonts.

Trait Implementations

impl<'font, R: Resources, F: Factory<R>> Debug for GlyphBrush<'font, R, F>
[src]

[src]

Formats the value using the given formatter. Read more

impl<'font, R: Resources, F: Factory<R>> GlyphCruncher<'font> for GlyphBrush<'font, R, F>
[src]

[src]

Returns the pixel bounding box for the input section using a custom layout. The box is a conservative whole number pixel rectangle that can contain the section. Read more

[src]

Returns an iterator over the PositionedGlyphs of the given section with a custom layout. Read more

[src]

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

[src]

Returns an iterator over the PositionedGlyphs of the given section. Read more

Auto Trait Implementations

impl<'font, R, F> Send for GlyphBrush<'font, R, F> where
    F: Send,
    <R as Resources>::Buffer: Send + Sync,
    <R as Resources>::DepthStencilView: Send + Sync,
    <R as Resources>::Mapping: Send,
    <R as Resources>::PipelineStateObject: Send + Sync,
    <R as Resources>::Program: Send + Sync,
    <R as Resources>::RenderTargetView: Send + Sync,
    <R as Resources>::Sampler: Send + Sync,
    <R as Resources>::ShaderResourceView: Send + Sync,
    <R as Resources>::Texture: Send + Sync

impl<'font, R, F> Sync for GlyphBrush<'font, R, F> where
    F: Sync,
    <R as Resources>::Buffer: Send + Sync,
    <R as Resources>::DepthStencilView: Send + Sync,
    <R as Resources>::Mapping: Send,
    <R as Resources>::PipelineStateObject: Send + Sync,
    <R as Resources>::Program: Send + Sync,
    <R as Resources>::RenderTargetView: Send + Sync,
    <R as Resources>::Sampler: Send + Sync,
    <R as Resources>::ShaderResourceView: Send + Sync,
    <R as Resources>::Texture: Send + Sync