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

View File

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