wgpu-text
wgpu-text is a wrapper over glyph-brush for easier text rendering in wgpu.
This project was inspired by and is similar to wgpu_glyph, but has additional features and is simpler. Also there is no need to include glyph-brush in your project.
Some features are directly implemented from glyph-brush so you should go trough Section docs and Section examples for better understanding of adding and managing text.
Example:
use BrushBuilder;
use ;
let brush = using_font_bytes.unwrap
/* .initial_cache_size((1024, 1024))) */ // use this to avoid resizing cache texture
/* .with_depth_testing() */ // enables depth testing
.build;
let section = default
.add_text
.with_layout;
// on resize:
brush.resize_view;
// window event loop:
RedrawRequested =>
Installation
Add the following to your Cargo.toml file:
[]
= "0.5.0"
Features
Besides basic text rendering and glyph-brush features, there are some features that add customization:
builtin matrix - default matrix for orthographic projection, feel free to use it for creating custom matrices
custom matrix - ability of providing a custom matrix for purposes of custom view, rotation...
depth testing - by adding z coordinate text can be set on top or below other text (if enabled)
Examples
Look trough examples for more.
cargo run --example <example-name>
Run examples with --release for true performance.
Goals
- improve docs
- add more examples
- maybe some new features
- (wgpu stuff: maybe change to StagingBelt instead of Queue)
Contributing
All contributions are welcome.