embedded-graphics-profont
Bitmap font rendering for embedded-graphics with text anchoring and tracking support.
Quick Start
use ;
use ;
use FONT;
// Render text
let text = new;
display.draw.ok;
// With anchoring and spacing
let text = new
.with_anchor
.with_tracking;
display.draw.ok;
Features
no_stdcompatible- Bitmap fonts (monospace & proportional)
- 9-point text anchoring (TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottomCenter, BottomRight)
- Character tracking (letter spacing)
- Transparent rendering (only font pixels drawn)
- Text measurement via
font.measure_str()
Font Generation
See TOOLS.md for complete font generation workflow.
Quick workflow:
- Create/edit font in GLCD Font Creator
- Export as
.c(Format: MikroC, Method: "Export for tft") - Convert with
main.py→ generatesfonts.rs - Copy to project
API Overview
Font::new(lookup_table, data, ascii_begin, ascii_end, max_height, proportional) |
Create font |
font.measure_str(text, tracking) |
Get text width in pixels |
text.with_anchor(anchor) |
Set anchor point |
text.with_tracking(pixels) |
Set letter spacing |
Character::new(ch, pos, font, color) |
Render single char |
Modules
font- Font definition, Text, Character, Anchorrenderer- Low-level draw_char/draw_str functions
See cargo doc --open for full API reference.