[][src]Crate glyph_brush_draw_cache

Rasterization cache for ab_glyph. Manages a updates to a texture (e.g. one stored on a GPU) drawing new glyphs, reusing & reordering as necessary.

Example

use glyph_brush_draw_cache::DrawCache;

// build a cache with default settings
let mut draw_cache = DrawCache::builder().build();

// queue up some glyphs to store in the cache
for (font_id, glyph) in glyphs {
    draw_cache.queue_glyph(font_id, glyph);
}

// process everything in the queue, rasterizing & uploading as necessary
draw_cache.cache_queued(&fonts, |rect, tex_data| update_texture(rect, tex_data))?;

// access a given glyph's texture position & pixel position for the texture quad
match draw_cache.rect_for(font_id, &glyph) {
    Some((tex_coords, px_coords)) => {}
    None => {/* The glyph has no outline, or wasn't queued up to be cached */}
}

Modules

ab_glyph

Re-exported ab_glyph types.

Structs

DrawCache

Dynamic rasterization draw cache.

DrawCacheBuilder

Builder & rebuilder for DrawCache.

Rectangle

A rectangle, with top-left corner at min, and bottom-right corner at max.

Enums

CacheWriteErr

Returned from DrawCache::cache_queued.

CachedBy

Successful method of caching of the queue.

Type Definitions

TextureCoords

(Texture coordinates, pixel coordinates)