跳转至

字体

font 覆盖四种不同显示角色:terminal/native typeface、ImGui GUI、map 与 overmap,同时 处理有序 fallback、glyph coverage、metric、hinting、antialiasing 与 GPU resource recovery。

权威路径

doc/user-guides/FONT_OPTIONS.md 解释用户配置;src/font_loader.cpp 定义可接受的 string/object/array、hinting 值、migration 与强制 Unifont fallback;src/sdl_font.* 拥有运行时 font instance 与 glyph/texture cache;bundled 文件位于 data/font/。

配置契约

typeface、gui_typeface、map_typeface、overmap_typeface 可为单一路径或有序 fallback 列表。object entry 可声明 path、hinting、antialiasing。必须保留能提供缺失 Unicode glyph 的 fallback;只检查 Latin 不充分。

贡献流程

添加 binary 前确认 font 的 redistribution/embedding license,记录 source、version、 author/foundry、license、subset/transformation 与预期角色。不能在同名下替换文件而不审查 metric、coverage、package size 与 attribution。

验证

测试拉丁、简繁中文、combining mark、wide character、symbol、fallback、line drawing、 窄 UI、map/overmap alignment、DPI/scaling、hinting mode 与 renderer reset。texture lifecycle 不同处要覆盖 SDL2/SDL3。

性能与所有权

font object 拥有 glyph texture cache;renderer recovery 会 release/rebuild 或按需重新填充。 无界 glyph/color cache 会消耗 GPU memory。font path/metadata 可进用户配置,GPU resource 绝不持久化。

生成数据

不要提交 local font cache/atlas。刻意生成 subset 只有连同可复现 generator、source license、Unicode coverage input 与验证时才可跟踪。