Source packs move to assets/packs (untouched), maps to assets/maps, and the palette/sketch leftovers from the 8-bit era go. tools/mkfont.py repacks VEXED's Micro Chat sheet (8-column grid, 8x10 cells) into the CP437 atlas layout the font loader already reads, cropped to 8x9 so the HUD can use an 8 px line height. The CGA atlas is dropped in its favor. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
27 lines
1.4 KiB
Markdown
Executable File
27 lines
1.4 KiB
Markdown
Executable File
# Text Renderer
|
||
|
||
## Current state
|
||
|
||
`game/src/font.rs` — a CP437 bitmap font ported from the `wds` project.
|
||
|
||
- Atlas: 32 columns × 8 rows of fixed cells, codepoint = index (`A` at 65 → column 1,
|
||
row 2). Loaded with `Image::from_png`; the mask is derived from luminance (white on
|
||
black), so the caller paints glyphs in any RGB565 color.
|
||
- Proportional advance: on load the ink span of every glyph (leftmost/rightmost lit
|
||
column) is measured. `draw` crops to that span and advances by ink width + 1 px
|
||
tracking; blank glyphs (space) advance half a cell.
|
||
- `cp437(char)` maps ASCII 1:1 and the accented letters the atlas has (ä ö ü ß …);
|
||
everything else becomes `?`.
|
||
- `text_width` and `wrap` (word wrap with hard `\n`) for layout.
|
||
- Font in use: `assets/fonts/micro-chat-8x9.png` — VEXED's Micro Chat (5 px, CC-BY),
|
||
repacked into the CP437 layout by `tools/mkfont.py` from the source sheet in
|
||
`assets/fonts/Micro-Chat-All/` (8-column grid with 1 px grid lines, 8×10 cells, black
|
||
glyphs on transparent). Cells are cropped to source rows 1..9 — umlaut dots down to
|
||
descenders — giving 8×9 cells; the HUD uses an 8 px line height. The sheet marks the
|
||
space cell with a bar, which the tool drops. Regenerate with `python3 tools/mkfont.py`.
|
||
|
||
## Open questions
|
||
|
||
- A second, larger font (the CGA 8×8 / EGA 8×14 from `wds`) once the UI needs hierarchy.
|
||
- Text color per span / inline markup for the log — not before it is needed.
|