#font #ttf #truetype #wgpu #text

wgpu_glyph

A fast text renderer for wgpu, powered by glyph_brush

7 releases (4 breaking)

✓ Uses Rust 2018 edition

0.5.0 Nov 5, 2019
0.4.0 Aug 22, 2019
0.3.1 Jun 9, 2019
0.3.0 May 3, 2019
0.1.1 Apr 27, 2019

#7 in #truetype

Download history 88/week @ 2019-07-23 43/week @ 2019-07-30 42/week @ 2019-08-06 7/week @ 2019-08-13 42/week @ 2019-08-20 51/week @ 2019-08-27 46/week @ 2019-09-03 67/week @ 2019-09-10 126/week @ 2019-09-17 26/week @ 2019-09-24 39/week @ 2019-10-01 20/week @ 2019-10-08 37/week @ 2019-10-15 75/week @ 2019-10-22 18/week @ 2019-10-29

192 downloads per month
Used in 1 crate

MIT license

83KB
944 lines

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
~118K SLoC