#font #ttf #truetype #wgpu #text

wgpu_glyph

A fast text renderer for wgpu, powered by glyph_brush

8 releases (5 breaking)

✓ Uses Rust 2018 edition

0.6.0 Nov 24, 2019
0.5.0 Nov 5, 2019
0.4.0 Aug 22, 2019
0.3.1 Jun 9, 2019
0.1.1 Apr 27, 2019

#2 in #wgpu

Download history 24/week @ 2019-10-04 19/week @ 2019-10-11 53/week @ 2019-10-18 59/week @ 2019-10-25 61/week @ 2019-11-01 19/week @ 2019-11-08 27/week @ 2019-11-15 971/week @ 2019-11-22 553/week @ 2019-11-29 209/week @ 2019-12-06 97/week @ 2019-12-13 81/week @ 2019-12-20 69/week @ 2019-12-27 57/week @ 2020-01-03 89/week @ 2020-01-10

724 downloads per month
Used in 3 crates

MIT license

84KB
1K SLoC

wgpu_glyph

Integration status crates.io Documentation License

A fast text renderer for wgpu, powered by glyph_brush

use wgpu_glyph::{Section, GlyphBrushBuilder};

let font: &[u8] = include_bytes!("SomeFont.ttf");
let mut glyph_brush = GlyphBrushBuilder::using_font_bytes(font)
    .build(&mut device, render_format);

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

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

glyph_brush.draw_queued(
    &mut device,
    &mut encoder,
    &frame.view,
    frame.width.round() as u32,
    frame.height.round() as u32,
);

device.get_queue().submit(&[encoder.finish()]);

Examples

Have a look at

Dependencies

~9MB
~120K SLoC