#font #ttf #truetype #gfx #text

gfx_glyph

Fast GPU cached text rendering using gfx-rs & rusttype

39 releases

✓ Uses Rust 2018 edition

0.15.0 May 3, 2019
0.14.0 Feb 12, 2019
0.13.1 Dec 21, 2018
0.13.0 Sep 14, 2018
0.6.4 Nov 24, 2017

#31 in GUI

Download history 864/week @ 2019-01-18 633/week @ 2019-01-25 609/week @ 2019-02-01 643/week @ 2019-02-08 824/week @ 2019-02-15 600/week @ 2019-02-22 778/week @ 2019-03-01 510/week @ 2019-03-08 660/week @ 2019-03-15 982/week @ 2019-03-22 506/week @ 2019-03-29 629/week @ 2019-04-05 1055/week @ 2019-04-12 1124/week @ 2019-04-19 771/week @ 2019-04-26

3,166 downloads per month
Used in 24 crates (6 directly)

Apache-2.0

139KB
2K SLoC

gfx_glyph crates.io Documentation

Fast GPU cached text rendering using gfx-rs v0.18 & glyph-brush.

use gfx_glyph::{Section, GlyphBrushBuilder};

let garamond: &[u8] = include_bytes!("GaramondNo8-Reg.ttf");
let mut glyph_brush = GlyphBrushBuilder::using_font_bytes(garamond)
    .build(gfx_factory.clone());

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

glyph_brush.queue(section);
glyph_brush.queue(some_other_section);

glyph_brush.use_queue().draw(&mut gfx_encoder, &gfx_color)?;

Examples

Have a look at

  • cargo run --example paragraph --release
  • cargo run --example performance --release
  • cargo run --example varied --release
  • cargo run --example depth --release

Limitations

The current implementation supports OpenGL (3.2 or later) only. Use glyph-brush directly if this is an issue.

Dependencies

~3MB
~58K SLoC