#font #ttf #truetype #wgpu #text

wgpu_glyph

A fast text renderer for wgpu, powered by glyph_brush

10 releases (breaking)

✓ Uses Rust 2018 edition

0.8.0 Apr 13, 2020
0.7.0 Mar 2, 2020
0.6.0 Nov 24, 2019
0.3.1 Jun 9, 2019

#7 in Rendering

Download history 231/week @ 2020-01-25 275/week @ 2020-02-01 215/week @ 2020-02-08 142/week @ 2020-02-15 292/week @ 2020-02-22 564/week @ 2020-02-29 373/week @ 2020-03-07 624/week @ 2020-03-14 795/week @ 2020-03-21 1183/week @ 2020-03-28 1330/week @ 2020-04-04 1329/week @ 2020-04-11 847/week @ 2020-04-18 1027/week @ 2020-04-25 2341/week @ 2020-05-02 1168/week @ 2020-05-09

2,576 downloads per month
Used in 9 crates (5 directly)

MIT and MPL-2.0 licenses

85KB
1K SLoC

Ruby HTML 1K SLoC // 0.1% comments Gherkin (Cucumber) 51 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)
    .expect("Load font")
    .build(&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(
    &device,
    &mut encoder,
    &frame.view,
    frame.width,
    frame.height,
);

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

Examples

Have a look at

Dependencies

~3–5MB
~103K SLoC