gfx_glyph

Fast GPU cached text rendering using gfx-rs & rusttype.

Makes use of three kinds of caching to optimise frame performance.

```rust extern crate gfxglyph; use gfxglyph::{Section, Layout, GlyphBrushBuilder};

let arial: &[u8] = includebytes!("examples/Arial Unicode.ttf"); let mut glyphbrush = GlyphBrushBuilder::usingfont(arial) .build(gfxfactory.clone());

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

glyphbrush.queue(section, &Layout::default()); glyphbrush.queue(someothersection, &Layout::default());

glyphbrush.drawqueued(&mut gfxencoder, &gfxtarget).unwrap(); ```

Limitations

The current implementation only supports OpenGL 3.0 or later. But other rendering languages (that are supported by gfx) should be easy enough to add. Send in your PRs!

Examples

Have a look at * cargo run --example paragraph --release * cargo run --example performance --release

Changelog

0.3.2 * Move fixed GPU caching logic into crate rather than use rusttype::gpu_cache

0.3 * Use Into<SharedBytes> instead of explicit &[u8] for font byte input to improve flexibility.

0.2 * Adopt default line breaking logic according to the Unicode Standard Annex #14 with StandardLineBreaker (included in Layout::default()). A LineBreaker implementation can be provided instead of using one of these.