Unicode improvements and version bump.

- Added full UTF-8 support for terminal rendering, including multi-width character handling.
- Improved font handling in ImGui with expanded glyph support (Greek, Mathematical Operators).
- Updated locale initialization to enable proper character rendering.
- Bumped version to 1.5.8.
This commit is contained in:
2026-01-11 11:39:08 -08:00
parent 7347556aa2
commit a8abda4b87
5 changed files with 178 additions and 67 deletions

View File

@@ -8,16 +8,43 @@ Font::Load(const float size) const
{
const ImGuiIO &io = ImGui::GetIO();
io.Fonts->Clear();
const ImFont *font = io.Fonts->AddFontFromMemoryCompressedTTF(
ImFontConfig config;
config.MergeMode = false;
// Load Basic Latin + Latin Supplement
io.Fonts->AddFontFromMemoryCompressedTTF(
this->data_,
this->size_,
size);
size,
&config,
io.Fonts->GetGlyphRangesDefault());
if (!font) {
font = io.Fonts->AddFontDefault();
}
// Merge Greek and Coptic
config.MergeMode = true;
static const ImWchar greek_ranges[] = {
0x0370, 0x03FF, // Greek and Coptic
0,
};
io.Fonts->AddFontFromMemoryCompressedTTF(
this->data_,
this->size_,
size,
&config,
greek_ranges);
// Merge Mathematical Operators
static const ImWchar math_ranges[] = {
0x2200, 0x22FF, // Mathematical Operators
0,
};
io.Fonts->AddFontFromMemoryCompressedTTF(
this->data_,
this->size_,
size,
&config,
math_ranges);
(void) font;
io.Fonts->Build();
}
} // namespace kte::Fonts