glyphr

Crates.ioglyphr
lib.rsglyphr
version0.5.1
created_at2025-03-27 00:09:43.001152+00
updated_at2025-09-09 11:34:32.649235+00
descriptionA no_std, lightweight and simple font rasterizing library
homepage
repositoryhttps://github.com/Bridiro/glyphr
max_upload_size
id1607353
size67,217
Alessandro Bridi (Bridiro)

documentation

README

Glyphr

License Crates.io Downloads Docs CI

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 for detailed instructions on how to generate fonts, then proceed in this page.

How To Use

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"
Commit count: 110

cargo fmt