Replace Greek and Mathematical Operators font fallback with Iosevka Extended for improved font handling.

This commit is contained in:
2026-01-11 12:07:24 -08:00
parent a8abda4b87
commit 4c402f5ef3
4 changed files with 40 additions and 60 deletions

View File

@@ -18,6 +18,7 @@
#include "GUITheme.h"
#include "fonts/Font.h" // embedded default font (DefaultFont)
#include "fonts/FontRegistry.h"
#include "fonts/IosevkaExtended.h"
#include "syntax/HighlighterRegistry.h"
#include "syntax/NullHighlighter.h"
@@ -369,30 +370,19 @@ GUIFrontend::LoadGuiFont_(const char * /*path*/, const float size_px)
&config,
io.Fonts->GetGlyphRangesDefault());
// Merge Greek and Coptic
// Merge Greek and Mathematical symbols from IosevkaExtended
config.MergeMode = true;
static const ImWchar greek_ranges[] = {
static const ImWchar extended_ranges[] = {
0x0370, 0x03FF, // Greek and Coptic
0,
};
io.Fonts->AddFontFromMemoryCompressedTTF(
kte::Fonts::DefaultFontData,
kte::Fonts::DefaultFontSize,
size_px,
&config,
greek_ranges);
// Merge Mathematical Operators
static const ImWchar math_ranges[] = {
0x2200, 0x22FF, // Mathematical Operators
0,
};
io.Fonts->AddFontFromMemoryCompressedTTF(
kte::Fonts::DefaultFontData,
kte::Fonts::DefaultFontSize,
kte::Fonts::IosevkaExtended::DefaultFontRegularCompressedData,
kte::Fonts::IosevkaExtended::DefaultFontRegularCompressedSize,
size_px,
&config,
math_ranges);
extended_ranges);
io.Fonts->Build();
return true;

View File

@@ -1,4 +1,5 @@
#include "Font.h"
#include "IosevkaExtended.h"
#include "imgui.h"
@@ -20,30 +21,19 @@ Font::Load(const float size) const
&config,
io.Fonts->GetGlyphRangesDefault());
// Merge Greek and Coptic
// Merge Greek and Mathematical symbols from IosevkaExtended as fallback
config.MergeMode = true;
static const ImWchar greek_ranges[] = {
static const ImWchar extended_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_,
kte::Fonts::IosevkaExtended::DefaultFontRegularCompressedData,
kte::Fonts::IosevkaExtended::DefaultFontRegularCompressedSize,
size,
&config,
math_ranges);
extended_ranges);
io.Fonts->Build();
}