#font #ttf #truetype #wgpu #text

wgpu_glyph

A fast text renderer for wgpu, powered by glyph_brush

12 releases (breaking)

0.10.0 Aug 27, 2020
0.9.0 May 28, 2020
0.8.0 Apr 13, 2020
0.7.0 Mar 2, 2020
0.3.1 Jun 9, 2019

#37 in Text processing

Download history 2036/week @ 2020-06-04 1541/week @ 2020-06-11 1294/week @ 2020-06-18 1647/week @ 2020-06-25 1375/week @ 2020-07-02 1527/week @ 2020-07-09 1325/week @ 2020-07-16 1060/week @ 2020-07-23 1094/week @ 2020-07-30 1233/week @ 2020-08-06 1536/week @ 2020-08-13 1939/week @ 2020-08-20 1666/week @ 2020-08-27 1900/week @ 2020-09-03 1832/week @ 2020-09-10 1195/week @ 2020-09-17

6,429 downloads per month
Used in 12 crates (5 directly)

MIT license

89KB
1K SLoC

wgpu_glyph

Integration status crates.io Documentation License

A fast text renderer for wgpu, powered by glyph_brush

use wgpu_glyph::{ab_glyph, GlyphBrushBuilder, Section, Text};

let font = ab_glyph::FontArc::try_from_slice(include_bytes!("SomeFont.ttf"))
    .expect("Load font");

let mut glyph_brush = GlyphBrushBuilder::using_font(font)
    .build(&device, render_format);

let section = Section {
    screen_position: (10.0, 10.0),
    text: vec![Text::new("Hello wgpu_glyph")],
    ..Section::default()
};

glyph_brush.queue(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

~4–7.5MB
~150K SLoC