| Crates.io | glyphr |
| lib.rs | glyphr |
| version | 0.5.1 |
| created_at | 2025-03-27 00:09:43.001152+00 |
| updated_at | 2025-09-09 11:34:32.649235+00 |
| description | A no_std, lightweight and simple font rasterizing library |
| homepage | |
| repository | https://github.com/Bridiro/glyphr |
| max_upload_size | |
| id | 1607353 |
| size | 67,217 |
This library focus is not to be the fastest, but one of the most beautiful in the embedded world.
To get started visit glyphr-macros for detailed instructions on how to generate fonts, then proceed in this page.
To decide how to write pixels you can use BufferTarget (only if you're using a [u32] array). If you're using a custom target you need to implement the RenderTarget trait on it.
Then you create the struct Glyphr:
use glyphr::{ Glyphr, BufferTarget, RenderConfig, SdfConfig };
let mut target = BufferTarget::new(&mut buffer, 800, 480);
let conf = RenderConfig {
color: 0xffffff,
sdf: SdfConfig {
size: 64,
mid_value: 0.5,
smoothing: 0.5,
}
};
let renderer = Glyphr::with_config(conf);
and to render anything you just call:
use glyphr::{ TextAlign, AlignV, AlignH };
renderer.render(&mut target, "Hello World!", POPPINS, 100, 50, TextAlign { horizontal: AlignH::Left, vertical: AlignV::Baseline }).unwrap();
[!TIP] If you want to run an example on your machine you can just do:
cargo run --example glyphr_test --features "toml window"