wgpu_glyph 0.8.0

A fast text renderer for wgpu, powered by glyph_brush
Documentation

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