#font-rasterizer #font #graphics #sdf #rasterizer #no-alloc

no-std glyphr

A no_std, lightweight and simple font rasterizing library

14 releases (4 breaking)

Uses new Rust 2024

0.5.1 Sep 9, 2025
0.5.0 Jun 13, 2025
0.4.1 Jun 6, 2025
0.3.2 May 22, 2025
0.1.0 Mar 27, 2025

#726 in Embedded development

Download history 78/week @ 2025-09-04 42/week @ 2025-09-11 3/week @ 2025-09-18 4/week @ 2025-09-25 7/week @ 2025-10-02

755 downloads per month

Apache-2.0

34KB
755 lines

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"

Dependencies

~2.2–5MB
~95K SLoC