Add Chinese text rendering support

Extend the bitmap font pipeline with the Chinese Joker glyph subset and encode supported UTF-8 text for Tonc TTE. Move the affine map clear of the expanded font, add a compile-time VRAM overlap guard, and cover every custom glyph with host tests.
This commit is contained in:
2026-07-19 11:35:14 +08:00
parent 7a5a4a1276
commit c7ef3c0047
13 changed files with 583 additions and 15 deletions
+25
View File
@@ -25,6 +25,31 @@
#include "soundbank.h"
#include "soundbank_bin.h"
enum
{
TTE_ASCII_GLYPH_COUNT = 96,
FONT_TILES_PER_ROW = 16,
CHARBLOCK_4BPP_TILE_COUNT = 512,
SCREENBLOCK_4BPP_TILE_COUNT = 64,
CHINESE_GLYPH_COUNT = 0
#define CHINESE_GLYPH(codepoint) +1
#include "def_chinese_glyph_table.h"
#undef CHINESE_GLYPH
,
TTE_FONT_TILE_COUNT =
TTE_ASCII_GLYPH_COUNT +
((CHINESE_GLYPH_COUNT + FONT_TILES_PER_ROW - 1) / FONT_TILES_PER_ROW) * FONT_TILES_PER_ROW,
TTE_FONT_FIRST_TILE = TTE_CBB * CHARBLOCK_4BPP_TILE_COUNT,
TTE_FONT_END_TILE = TTE_FONT_FIRST_TILE + TTE_FONT_TILE_COUNT,
AFFINE_BG_MAP_FIRST_TILE = AFFINE_BG_SBB * SCREENBLOCK_4BPP_TILE_COUNT,
AFFINE_BG_MAP_END_TILE = AFFINE_BG_MAP_FIRST_TILE + SCREENBLOCK_4BPP_TILE_COUNT,
};
_Static_assert(
TTE_FONT_END_TILE <= AFFINE_BG_MAP_FIRST_TILE || AFFINE_BG_MAP_END_TILE <= TTE_FONT_FIRST_TILE,
"TTE font tiles overlap the affine background map"
);
void init()
{
rng_init();