SEFF - Simple Embeddable Font Format
This crate is designed to allow decent text rendering in resource-constrained environments like microcontrollers.
Feature summary:
- Compiles to less than 1.5 kiB of code on
thumbv7em
. - Proportional (variable-width) fonts in addition to monospaced (terminal) fonts.
- Fonts can include kerning information.
- Aggressively optimized font data structures are cheap to store and relatively cheap to render. (Monospace fonts of about 8 pixels and larger are typically 60% smaller represented in SEFF than in their naive array-of-bits form.)
- Build-time code generation takes fonts in an easily editable PNG format and produces Rust code, if you don't want to paste the code in directly.
- When built in render-only mode, has no dependencies. In particular, does not depend on any particular embedded HAL.
Drawbacks/limitations:
- Does not support fonts containing more than 256 glyphs. (I plan to have a fallback mechanism for combining fonts if you need this.)
- The Unicode support is very simplistic, mapping chars into the 256-glyph space using canned mappings -- currently only ISO 8859-1 and CP437 are supported, though more can be added.
- Does not support RTL or vertical text directions. (Mostly due to my own lack of understanding of the subtleties.)
Deliberate non-goals:
- Does not support text scaling or vector fonts. Each font has a fixed size, chosen at build time. This allows us to store data compactly and render it cheaply.
- Does not support antialiasing. Pixels are getting very small these days.
The PNG font format
See the fonts
directories for examples of the PNG input format.