Crate glyph_brush[][src]

extern crate glyph_brush;

use glyph_brush::{BrushAction, BrushError, GlyphBrushBuilder, Section};

let dejavu: &[u8] = include_bytes!("../../examples/DejaVuSans.ttf");
let mut glyph_brush = GlyphBrushBuilder::using_font_bytes(dejavu).build();

glyph_brush.queue(Section {
    text: "Hello glyph_brush",
    ..Section::default()
});
glyph_brush.queue(some_other_section);

match glyph_brush.process_queued(
    screen_dimensions,
    |rect, tex_data| update_texture(rect, tex_data),
    |vertex_data| into_vertex(vertex_data),
) {
    Ok(BrushAction::Draw(vertices)) => {
        // Draw new vertices.
    }
    Ok(BrushAction::ReDraw) => {
        // Re-draw last frame's vertices unmodified.
    }
    Err(BrushError::TextureTooSmall { suggested, .. }) => {
        // Enlarge texture + glyph_brush texture cache and retry.
    }
}

Re-exports

pub use glyph_brush_layout::*;

Macros

delegate_glyph_brush_builder_fns

Macro to delegate builder methods to an inner glyph_brush::GlyphBrushBuilder

Structs

GlyphBrush

Object allowing glyph drawing, containing cache state. Manages glyph positioning cacheing, glyph draw caching & efficient GPU texture cache updating.

GlyphBrushBuilder

Builder for a GlyphBrush.

GlyphCalculator

Cut down version of a GlyphBrush that can calculate pixel bounds, but is unable to actually render anything.

GlyphCalculatorBuilder

Builder for a GlyphCalculator.

GlyphCalculatorGuard

GlyphCalculator scoped cache lock.

GlyphVertex

Data used to generate vertex information for a single glyph

GlyphedSection
OwnedSectionText
OwnedVariedSection
Section

An object that contains all the info to render a section of text.

VariedSection

An object that contains all the info to render a varied section of text. That is one including many parts with differing fonts/scales/colors bowing to a single layout.

Enums

BrushAction

Actions that should be taken after processing queue data

BrushError

Traits

GlyphCruncher

Common glyph layout logic.

Type Definitions

PositionedGlyphIter

PositionedGlyph iterator.