Struct gfx_glyph::GlyphBrush [] [src]

pub struct GlyphBrush<'a, 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 calculated 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]

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.

If the section is empty or would result in no drawn glyphs will return None.

Benefits from caching, see caching behaviour.

[src]

Returns the pixel bounding box for the input section. The box is a conservative whole number pixel rectangle that can contain the section.

If the section is empty or would result in no drawn glyphs will return None.

Benefits from caching, see caching behaviour.

[src]

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

Benefits from caching, see caching behaviour.

[src]

Returns an iterator over the PositionedGlyphs of the given section.

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.

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.