wgpu_glyph 0.10.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::{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