# Glyphr
[](https://github.com/Bridiro/glyphr#license)
[](https://crates.io/crates/glyphr)
[](https://crates.io/crates/glyphr)
[](https://docs.rs/glyphr/latest/glyphr/)
[](https://github.com/Bridiro/glyphr/actions)
This library focus is not to be the fastest, but one of the most beautiful in the embedded world.
## Features
- Completely intuitive
- You decide how pixel are written on the screen
- No heap allocation
- Compile time font bitmaps generation
- Full Unicode support
## How To Build
To get started visit [glyphr-macros](https://github.com/Bridiro/glyphr/tree/master/glyphr-macros) for detailed instructions on how to generate fonts, then proceed in this page.
## How To Use
The renderer is callback-first. You provide dimensions and closures; `glyphr` does not store your
framebuffer.
Create `Glyphr` with a builder-style config:
```rust
use glyphr::{Callbacks, Glyphr, RenderConfig, SdfConfig};
let conf = RenderConfig::default()
.with_color(0x00ff_ffff)
.with_sdf(SdfConfig::default().with_size(64).with_smoothing(0.5));
let renderer = Glyphr::with_config(conf);
let _ = (x, y, argb);
true
});
```
Render text with `draw_text`:
```rust
use glyphr::{ TextAlign, AlignV, AlignH };
renderer
.draw_text(
&mut target,
"Hello World!",
POPPINS,
100,
50,
TextAlign::new(AlignH::Left, AlignV::Baseline),
)
.unwrap();
```
For DMA-style pipelines, use `draw_text_bulk` to get one ARGB tile per glyph:
```rust
use glyphr::{AlignH, AlignV, BulkCallbacks, TextAlign};
let mut scratch = [0u32; 4096];
let _ = (x, y, w, h, pixels);
true
});
renderer
.draw_text_bulk(
&mut bulk,
"Hello DMA2D!",
POPPINS,
100,
50,
TextAlign::new(AlignH::Left, AlignV::Baseline),
)
.unwrap();
```
> [!TIP]
> If you want to run an example on your machine you can just do:
> ```rust
> cargo run --example glyphr_test --features "toml window"
> ```
>
> Bulk callback example:
> ```rust
> cargo run --example glyphr_bulk --features "window"
> ```