glyphbrushdraw_cache crates.io

Documentation

Rasterization cache for abglyph used in glyphbrush.

```rust use glyphbrushdraw_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 (fontid, glyph) in glyphs { drawcache.queueglyph(fontid, glyph); }

// process everything in the queue, rasterizing & uploading as necessary drawcache.cachequeued(&fonts, |rect, texdata| updatetexture(rect, tex_data))?;

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

Example

See the drawcacheguts example to see how it works (run it from the top level).

cargo run --example draw_cache_guts