Crates.io | gfx_glyph |
lib.rs | gfx_glyph |
version | 0.17.1 |
source | src |
created_at | 2017-08-22 10:46:59.911056 |
updated_at | 2023-02-10 15:33:13.351386 |
description | Fast GPU cached text rendering using gfx-rs & ab_glyph |
homepage | |
repository | https://github.com/alexheretic/glyph-brush |
max_upload_size | |
id | 28540 |
size | 218,327 |
Fast GPU cached text rendering using gfx-rs v0.18 & glyph-brush.
use gfx_glyph::{ab_glyph::FontArc, GlyphBrushBuilder, Section, Text};
let dejavu = FontArc::try_from_slice(include_bytes!("../../fonts/DejaVuSans.ttf"))?;
let mut glyph_brush = GlyphBrushBuilder::using_font(dejavu).build(gfx_factory.clone());
// set the text scale, font, color, position, etc
let section = Section::default()
.add_text(Text::new("Hello gfx_glyph"));
glyph_brush.queue(section);
glyph_brush.queue(some_other_section);
glyph_brush.use_queue().draw(&mut gfx_encoder, &gfx_color)?;
Have a look at
cargo run --example paragraph --release
cargo run --example performance --release
cargo run --example varied --release
cargo run --example depth --release
The current implementation supports OpenGL (3.2 or later) only. Use glyph-brush directly if this is an issue.