Files
kte/fonts/Font.cc
Kyle Isom a8abda4b87 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.
2026-01-11 11:39:08 -08:00

50 lines
935 B
C++

#include "Font.h"
#include "imgui.h"
namespace kte::Fonts {
void
Font::Load(const float size) const
{
const ImGuiIO &io = ImGui::GetIO();
io.Fonts->Clear();
ImFontConfig config;
config.MergeMode = false;
// Load Basic Latin + Latin Supplement
io.Fonts->AddFontFromMemoryCompressedTTF(
this->data_,
this->size_,
size,
&config,
io.Fonts->GetGlyphRangesDefault());
// 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);
io.Fonts->Build();
}
} // namespace kte::Fonts