1.2 KiB
Executable File
1.2 KiB
Executable File
Text Renderer
Current state
No text rendering exists yet. No font loading or glyph blitting code exists.
Goal
Draw ASCII text into the u8 framebuffer using a bitmap font, respecting the palette-index
color model (one u8 per pixel, no RGBA).
Design notes
- A bitmap font is the right fit: each glyph is a small tile of palette indices, blitted
directly into the framebuffer using the existing blit primitive in
pixelhelper.rs. - Likely approach: a fixed 8×8 or similar glyph grid packed into a TGA or raw binary, one glyph per ASCII codepoint starting at 0x20 (space).
- The font image itself should be indexed: foreground pixels carry a nonzero palette index (caller supplies the color), background pixels are index 0 (transparent/skip).
- API sketch:
fn draw_text(frame: &mut [u8], font: &Font, x: i32, y: i32, color: u8, text: &str); Fontholds the glyph sheet as anImageplus glyph width/height.
Open questions
- How do we handle proportional spacing of different characters?
- How do we store font data in memory?
- How do we handle font color rendering?
- How do we handle special characters like Ä, Ö, Ü, ß, etc.?