mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-01 21:17:44 -05:00
Added support for displaying non-ASCII characters in decoder view
This requires the user to provide a font that supports these characters as well (for example unifont). The default ImGui font does not have them.
This commit is contained in:
@@ -183,7 +183,19 @@ namespace hex {
|
||||
// Load font data & build atlas
|
||||
std::uint8_t *px;
|
||||
int w, h;
|
||||
io.Fonts->AddFontFromFileTTF(path.string().c_str(), std::floor(14.0f * this->m_fontScale)); // Needs conversion to char for Windows
|
||||
|
||||
ImVector<ImWchar> ranges;
|
||||
ImFontGlyphRangesBuilder glyphRangesBuilder;
|
||||
glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesDefault());
|
||||
glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesJapanese());
|
||||
glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesChineseFull());
|
||||
glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesCyrillic());
|
||||
glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesKorean());
|
||||
glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesThai());
|
||||
glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesVietnamese());
|
||||
glyphRangesBuilder.BuildRanges(&ranges);
|
||||
|
||||
io.Fonts->AddFontFromFileTTF(path.string().c_str(), std::floor(14.0f * this->m_fontScale), nullptr, ranges.Data); // Needs conversion to char for Windows
|
||||
ImGuiFreeType::BuildFontAtlas(io.Fonts, ImGuiFreeType::Monochrome);
|
||||
io.Fonts->GetTexDataAsRGBA32(&px, &w, &h);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user