ui: Add first unifont plane by default

This commit is contained in:
WerWolv 2021-08-31 15:22:00 +02:00
parent 32eddbf581
commit 5f63db4a34
12 changed files with 116328 additions and 138 deletions

View File

@ -31,6 +31,7 @@ add_library(imgui STATIC
fonts/fontawesome_font.c
fonts/codicons_font.c
fonts/unifont_font.c
)
add_compile_definitions(IMGUI_IMPL_OPENGL_LOADER_GLAD)

116170
external/ImGui/fonts/unifont_font.c vendored Normal file

File diff suppressed because it is too large Load Diff

6
external/ImGui/fonts/unifont_font.h vendored Normal file
View File

@ -0,0 +1,6 @@
#pragma once
#define FONT_ICON_FILE_NAME_UNIFONT "unifont.ttf"
extern const unsigned int unifont_compressed_size;
extern const unsigned int unifont_compressed_data[52184/4];

View File

@ -27,8 +27,6 @@ namespace hex::init {
float m_progress = 0;
std::string m_currTaskName;
float m_globalScale = 1.0F;
void initGLFW();
void initImGui();

View File

@ -43,11 +43,8 @@ namespace hex {
friend void ImHexSettingsHandler_ReadLine(ImGuiContext*, ImGuiSettingsHandler *handler, void *, const char* line);
friend void ImHexSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler *handler, ImGuiTextBuffer *buf);
void setFont(const std::filesystem::path &font_path);
GLFWwindow* m_window = nullptr;
float m_globalScale = 1.0F, m_fontScale = 1.0F;
double m_targetFps = 60.0;
bool m_demoWindowOpen = false;
bool m_layoutConfigured = false;

View File

@ -115,7 +115,8 @@ namespace hex::plugin::builtin {
u8 codepointSize = ImTextCharFromUtf8(&codepoint, utf8Buffer, utf8Buffer + 4);
std::memcpy(codepointString, utf8Buffer, std::min(codepointSize, u8(4)));
auto value = hex::format("'{0}' (U+0x{1:04X})", codepoint == 0xFFFD ? "Invalid" : codepointString,
auto value = hex::format("'{0}' (U+0x{1:04X})",
codepoint == 0xFFFD ? "Invalid" : (codepointSize == 1 ? makePrintable(codepointString[0]) : codepointString),
codepoint);
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };

View File

@ -84,9 +84,14 @@ namespace hex {
static int mainArgc;
static char **mainArgv;
static ImFontAtlas *fontAtlas;
static ImFontConfig fontConfig;
static ImVec2 windowPos;
static ImVec2 windowSize;
static float globalScale;
static float fontScale;
private:
static std::map<std::string, std::any> sharedVariables;
};

View File

@ -36,8 +36,13 @@ namespace hex {
int SharedData::mainArgc;
char **SharedData::mainArgv;
ImFontAtlas *SharedData::fontAtlas;
ImFontConfig SharedData::fontConfig;
ImVec2 SharedData::windowPos;
ImVec2 SharedData::windowSize;
float SharedData::globalScale;
float SharedData::fontScale;
std::map<std::string, std::any> SharedData::sharedVariables;
}

View File

@ -82,6 +82,8 @@ namespace hex::init {
auto tasksSucceeded = processTasksAsync();
auto scale = SharedData::globalScale;
while (!glfwWindowShouldClose(this->m_window)) {
glfwPollEvents();
@ -94,18 +96,18 @@ namespace hex::init {
auto drawList = ImGui::GetForegroundDrawList();
drawList->AddImage(splashTexture, ImVec2(0, 0), splashTexture.size() * this->m_globalScale);
drawList->AddImage(splashTexture, ImVec2(0, 0), splashTexture.size() * scale);
drawList->AddText(ImVec2(15, 120) * this->m_globalScale, ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("WerWolv 2020 - {0}", &__DATE__[7]).c_str());
drawList->AddText(ImVec2(15, 120) * scale, ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("WerWolv 2020 - {0}", &__DATE__[7]).c_str());
#if defined(DEBUG)
drawList->AddText(ImVec2(15, 140) * this->m_globalScale, ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("{0} : {1} {2}@{3}", IMHEX_VERSION, ICON_FA_CODE_BRANCH, GIT_BRANCH, GIT_COMMIT_HASH).c_str());
drawList->AddText(ImVec2(15, 140) * scale, ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("{0} : {1} {2}@{3}", IMHEX_VERSION, ICON_FA_CODE_BRANCH, GIT_BRANCH, GIT_COMMIT_HASH).c_str());
#else
drawList->AddText(ImVec2(15, 140) * this->m_globalScale, ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("{0}", IMHEX_VERSION).c_str());
drawList->AddText(ImVec2(15, 140) * scale, ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("{0}", IMHEX_VERSION).c_str());
#endif
drawList->AddRectFilled(ImVec2(0, splashTexture.size().y - 5) * this->m_globalScale, ImVec2(splashTexture.size().x * this->m_progress, splashTexture.size().y) * this->m_globalScale, 0xFFFFFFFF);
drawList->AddText(ImVec2(15, splashTexture.size().y - 25) * this->m_globalScale, ImColor(0xFF, 0xFF, 0xFF, 0xFF),
drawList->AddRectFilled(ImVec2(0, splashTexture.size().y - 5) * scale, ImVec2(splashTexture.size().x * this->m_progress, splashTexture.size().y) * scale, 0xFFFFFFFF);
drawList->AddText(ImVec2(15, splashTexture.size().y - 25) * scale, ImColor(0xFF, 0xFF, 0xFF, 0xFF),
hex::format("[{}] {}", "|/-\\"[ImU32(ImGui::GetTime() * 15) % 4], this->m_currTaskName).c_str());
}
@ -155,7 +157,6 @@ namespace hex::init {
exit(EXIT_FAILURE);
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
@ -170,10 +171,10 @@ namespace hex::init {
float xscale, yscale;
glfwGetMonitorContentScale(monitor, &xscale, &yscale);
this->m_globalScale = std::midpoint(xscale, yscale);
SharedData::globalScale = SharedData::fontScale = std::midpoint(xscale, yscale);
}
this->m_window = glfwCreateWindow(640 * this->m_globalScale, 400 * this->m_globalScale, "ImHex", nullptr, nullptr);
this->m_window = glfwCreateWindow(640 * SharedData::globalScale, 400 * SharedData::globalScale, "ImHex", nullptr, nullptr);
if (this->m_window == nullptr) {
log::fatal("Failed to create GLFW window!");
exit(EXIT_FAILURE);
@ -195,13 +196,13 @@ namespace hex::init {
auto &io = ImGui::GetIO();
ImGui::GetStyle().ScaleAllSizes(this->m_globalScale);
ImGui::GetStyle().ScaleAllSizes(SharedData::globalScale);
io.Fonts->Clear();
ImFontConfig cfg;
cfg.OversampleH = cfg.OversampleV = 1, cfg.PixelSnapH = true;
cfg.SizePixels = 13.0f * this->m_globalScale;
cfg.SizePixels = 13.0f * SharedData::globalScale;
io.Fonts->AddFontDefault(&cfg);
cfg.MergeMode = true;
@ -212,7 +213,7 @@ namespace hex::init {
};
std::uint8_t *px;
int w, h;
io.Fonts->AddFontFromMemoryCompressedTTF(font_awesome_compressed_data, font_awesome_compressed_size, 11.0f * this->m_globalScale, &cfg, fontAwesomeRange);
io.Fonts->AddFontFromMemoryCompressedTTF(font_awesome_compressed_data, font_awesome_compressed_size, 11.0f * SharedData::globalScale, &cfg, fontAwesomeRange);
io.Fonts->GetTexDataAsRGBA32(&px, &w, &h);
// Create new font atlas

View File

@ -1,8 +1,15 @@
#include "init/tasks.hpp"
#include <imgui.h>
#include <imgui_freetype.h>
#include <hex/helpers/net.hpp>
#include <hex/api/content_registry.hpp>
#include <fontawesome_font.h>
#include <codicons_font.h>
#include <unifont_font.h>
#include "views/view_hexeditor.hpp"
#include "views/view_pattern_editor.hpp"
#include "views/view_pattern_data.hpp"
@ -93,6 +100,75 @@ namespace hex::init {
return result;
}
bool loadFonts() {
auto &fonts = SharedData::fontAtlas;
auto &cfg = SharedData::fontConfig;
fonts = IM_NEW(ImFontAtlas)();
cfg = { };
std::string fontFile;
for (const auto &dir : hex::getPath(ImHexPath::Resources)) {
fontFile = dir + "/font.ttf";
if (std::filesystem::exists(fontFile))
break;
}
ImVector<ImWchar> ranges;
{
ImFontGlyphRangesBuilder glyphRangesBuilder;
glyphRangesBuilder.AddRanges(fonts->GetGlyphRangesDefault());
glyphRangesBuilder.AddRanges(fonts->GetGlyphRangesJapanese());
glyphRangesBuilder.AddRanges(fonts->GetGlyphRangesChineseFull());
glyphRangesBuilder.AddRanges(fonts->GetGlyphRangesCyrillic());
glyphRangesBuilder.AddRanges(fonts->GetGlyphRangesKorean());
glyphRangesBuilder.AddRanges(fonts->GetGlyphRangesThai());
glyphRangesBuilder.AddRanges(fonts->GetGlyphRangesVietnamese());
glyphRangesBuilder.BuildRanges(&ranges);
}
ImWchar fontAwesomeRange[] = {
ICON_MIN_FA, ICON_MAX_FA,
0
};
ImWchar codiconsRange[] = {
ICON_MIN_VS, ICON_MAX_VS,
0
};
ImWchar unifontRange[] = {
0x0020, 0xFFF0,
0
};
if (!std::filesystem::exists(fontFile)) {
// Load default font
fonts->Clear();
cfg.OversampleH = cfg.OversampleV = 1, cfg.PixelSnapH = true;
cfg.SizePixels = 13.0f * SharedData::fontScale;
fonts->AddFontDefault(&cfg);
} else {
// Load custom font
cfg.OversampleH = cfg.OversampleV = 1, cfg.PixelSnapH = true;
cfg.SizePixels = 13.0f * SharedData::fontScale;
fonts->AddFontFromFileTTF(fontFile.c_str(), std::floor(14.0f * SharedData::fontScale), &cfg, ranges.Data); // Needs conversion to char for Windows
}
cfg.MergeMode = true;
fonts->AddFontFromMemoryCompressedTTF(font_awesome_compressed_data, font_awesome_compressed_size, 13.0f * SharedData::fontScale, &cfg, fontAwesomeRange);
fonts->AddFontFromMemoryCompressedTTF(codicons_compressed_data, codicons_compressed_size, 13.0f * SharedData::fontScale, &cfg, codiconsRange);
fonts->AddFontFromMemoryCompressedTTF(unifont_compressed_data, unifont_compressed_size, 13.0f * SharedData::fontScale, &cfg, unifontRange);
ImGuiFreeType::BuildFontAtlas(fonts);
return true;
}
bool loadDefaultViews() {
ContentRegistry::Views::add<ViewHexEditor>();
@ -188,6 +264,25 @@ namespace hex::init {
return false;
}
switch (ContentRegistry::Settings::read("hex.builtin.setting.interface", "hex.builtin.setting.interface.scaling", 0)) {
default:
case 0:
// Native scaling
break;
case 1:
SharedData::globalScale = SharedData::fontScale = 0.5F;
break;
case 2:
SharedData::globalScale = SharedData::fontScale = 1.0F;
break;
case 3:
SharedData::globalScale = SharedData::fontScale = 1.5F;
break;
case 4:
SharedData::globalScale = SharedData::fontScale = 2.0F;
break;
}
return true;
}
@ -208,6 +303,7 @@ namespace hex::init {
{ "Loading default views...", loadDefaultViews },
{ "Loading plugins...", loadPlugins },
{ "Loading settings...", loadSettings },
{ "Loading fonts...", loadFonts },
};
}

View File

@ -23,7 +23,6 @@
static LONG_PTR oldWndProc;
static float titleBarHeight;
static ImGuiMouseCursor mouseCursorIcon;
static float borderScaling;
static bool isTaskbarAutoHideEnabled(UINT edge, RECT monitor) {
APPBARDATA data = { .cbSize = sizeof(APPBARDATA), .uEdge = edge, .rc = monitor };
@ -97,8 +96,8 @@
POINT cursor = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
const POINT border{
static_cast<LONG>((::GetSystemMetrics(SM_CXFRAME) + ::GetSystemMetrics(SM_CXPADDEDBORDER)) * borderScaling / 2.0F),
static_cast<LONG>((::GetSystemMetrics(SM_CYFRAME) + ::GetSystemMetrics(SM_CXPADDEDBORDER)) * borderScaling / 2.0F)
static_cast<LONG>((::GetSystemMetrics(SM_CXFRAME) + ::GetSystemMetrics(SM_CXPADDEDBORDER)) * SharedData::globalScale / 2.0F),
static_cast<LONG>((::GetSystemMetrics(SM_CYFRAME) + ::GetSystemMetrics(SM_CXPADDEDBORDER)) * SharedData::globalScale / 2.0F)
};
RECT window;
@ -177,7 +176,6 @@
void Window::updateNativeWindow() {
titleBarHeight = ImGui::GetCurrentWindow()->MenuBarHeight();
borderScaling = this->m_globalScale;
if (mouseCursorIcon != ImGuiMouseCursor_None)
ImGui::SetMouseCursor(mouseCursorIcon);

View File

@ -26,6 +26,7 @@
#include <fontawesome_font.h>
#include <codicons_font.h>
#include <unifont_font.h>
#include "helpers/plugin_manager.hpp"
#include "helpers/project_file_handler.hpp"
@ -270,75 +271,6 @@ namespace hex {
}
}
void Window::setFont(const std::filesystem::path &path) {
auto &io = ImGui::GetIO();
// Load font data & build atlas
std::uint8_t *px;
int w, h;
ImVector<ImWchar> ranges;
ImFontGlyphRangesBuilder glyphRangesBuilder;
ImWchar fontAwesomeRange[] = {
ICON_MIN_FA, ICON_MAX_FA,
0
};
ImWchar codiconsRange[] = {
ICON_MIN_VS, ICON_MAX_VS,
0
};
ImFontConfig cfg;
if (!std::filesystem::exists(path)) {
// Load default font
io.Fonts->Clear();
cfg.OversampleH = cfg.OversampleV = 1, cfg.PixelSnapH = true;
cfg.SizePixels = 13.0f * this->m_fontScale;
io.Fonts->AddFontDefault(&cfg);
} else {
// Load custom font
// If we have a custom font, then rescaling is unnecessary and will make it blurry
io.FontGlobalScale = 1.0f;
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);
cfg.OversampleH = cfg.OversampleV = 1, cfg.PixelSnapH = true;
cfg.SizePixels = 13.0f * this->m_fontScale;
io.Fonts->AddFontFromFileTTF(path.string().c_str(), std::floor(14.0f * this->m_fontScale), &cfg, ranges.Data); // Needs conversion to char for Windows
}
cfg.MergeMode = true;
io.Fonts->AddFontFromMemoryCompressedTTF(font_awesome_compressed_data, font_awesome_compressed_size, 13.0f * this->m_fontScale, &cfg, fontAwesomeRange);
io.Fonts->AddFontFromMemoryCompressedTTF(codicons_compressed_data, codicons_compressed_size, 13.0f * this->m_fontScale, &cfg, codiconsRange);
ImGuiFreeType::BuildFontAtlas(io.Fonts, ImGuiFreeTypeBuilderFlags_Bitmap);
io.Fonts->GetTexDataAsRGBA32(&px, &w, &h);
// Create new font atlas
GLuint tex;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA8, GL_UNSIGNED_INT, px);
io.Fonts->SetTexID(reinterpret_cast<ImTextureID>(tex));
}
void Window::frameBegin() {
ImGui_ImplOpenGL3_NewFrame();
@ -431,7 +363,7 @@ namespace hex {
static char title[256];
ImFormatString(title, IM_ARRAYSIZE(title), "%s/DockSpace_%08X", ImGui::GetCurrentWindow()->Name, ImGui::GetID("MainDock"));
if (ImGui::Begin(title)) {
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10 * this->m_globalScale, 10 * this->m_globalScale));
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10 * SharedData::globalScale, 10 * SharedData::globalScale));
if (ImGui::BeginChild("Welcome Screen", ImVec2(0, 0), false, ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_NoScrollWithMouse)) {
this->drawWelcomeScreen();
}
@ -525,8 +457,8 @@ namespace hex {
continue;
auto minSize = view->getMinSize();
minSize.x *= this->m_globalScale;
minSize.y *= this->m_globalScale;
minSize.x *= SharedData::globalScale;
minSize.y *= SharedData::globalScale;
ImGui::SetNextWindowSizeConstraints(minSize, view->getMaxSize());
view->drawContent();
@ -567,7 +499,7 @@ namespace hex {
void Window::drawWelcomeScreen() {
const auto availableSpace = ImGui::GetContentRegionAvail();
ImGui::Image(this->m_bannerTexture, this->m_bannerTexture.size() / (2 * (1.0F / this->m_globalScale)));
ImGui::Image(this->m_bannerTexture, this->m_bannerTexture.size() / (2 * (1.0F / SharedData::globalScale)));
ImGui::Indent();
if (ImGui::BeginTable("Welcome Left", 1, ImGuiTableFlags_NoBordersInBody, ImVec2(availableSpace.x / 2, 0))) {
@ -582,7 +514,7 @@ namespace hex {
ImGui::UnderlinedText("hex.welcome.header.start"_lang);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5 * this->m_globalScale);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5 * SharedData::globalScale);
{
if (ImGui::IconHyperlink(ICON_VS_NEW_FILE, "hex.welcome.start.create_file"_lang))
EventManager::post<RequestOpenWindow>("Create File");
@ -595,7 +527,7 @@ namespace hex {
ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 9);
ImGui::TableNextColumn();
ImGui::UnderlinedText("hex.welcome.start.recent"_lang);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5 * this->m_globalScale);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5 * SharedData::globalScale);
{
if (!SharedData::recentFilePaths.empty()) {
for (auto &path : SharedData::recentFilePaths) {
@ -620,7 +552,7 @@ namespace hex {
ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5);
ImGui::TableNextColumn();
ImGui::UnderlinedText("hex.welcome.header.help"_lang);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5 * this->m_globalScale);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5 * SharedData::globalScale);
{
if (ImGui::IconHyperlink(ICON_VS_GITHUB, "hex.welcome.help.repo"_lang)) hex::openWebpage("hex.welcome.help.repo.link"_lang);
if (ImGui::IconHyperlink(ICON_VS_ORGANIZATION, "hex.welcome.help.gethelp"_lang)) hex::openWebpage("hex.welcome.help.gethelp.link"_lang);
@ -737,41 +669,13 @@ namespace hex {
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
#endif
switch (ContentRegistry::Settings::read("hex.builtin.setting.interface", "hex.builtin.setting.interface.scaling", 0)) {
default:
case 0:
this->m_globalScale = this->m_fontScale = -1.0F;
break;
case 1:
this->m_globalScale = this->m_fontScale = 0.5F;
break;
case 2:
this->m_globalScale = this->m_fontScale = 1.0F;
break;
case 3:
this->m_globalScale = this->m_fontScale = 1.5F;
break;
case 4:
this->m_globalScale = this->m_fontScale = 2.0F;
break;
}
if (auto *monitor = glfwGetPrimaryMonitor(); monitor) {
float xscale, yscale;
glfwGetMonitorContentScale(monitor, &xscale, &yscale);
// In case the horizontal and vertical scale are different, fall back on the average
if (this->m_globalScale <= 0.0F)
this->m_globalScale = this->m_fontScale = std::midpoint(xscale, yscale);
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
this->m_windowTitle = "ImHex";
this->m_window = glfwCreateWindow(1280 * this->m_globalScale, 720 * this->m_globalScale, this->m_windowTitle.c_str(), nullptr, nullptr);
this->m_window = glfwCreateWindow(1280 * SharedData::globalScale, 720 * SharedData::globalScale, this->m_windowTitle.c_str(), nullptr, nullptr);
this->setupNativeWindow();
@ -851,13 +755,13 @@ namespace hex {
EventManager::post<EventWindowClosing>(window);
});
glfwSetWindowSizeLimits(this->m_window, 720 * this->m_globalScale, 480 * this->m_globalScale, GLFW_DONT_CARE, GLFW_DONT_CARE);
glfwSetWindowSizeLimits(this->m_window, 720 * SharedData::globalScale, 480 * SharedData::globalScale, GLFW_DONT_CARE, GLFW_DONT_CARE);
}
void Window::initImGui() {
IMGUI_CHECKVERSION();
GImGui = ImGui::CreateContext();
GImGui = ImGui::CreateContext(SharedData::fontAtlas);
GImPlot = ImPlot::CreateContext();
GImNodes = ImNodes::CreateContext();
@ -872,6 +776,8 @@ namespace hex {
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
#endif
for (auto &entry : SharedData::fontAtlas->ConfigData)
io.Fonts->ConfigData.push_back(entry);
io.ConfigViewportsNoTaskBarIcon = true;
io.KeyMap[ImGuiKey_Tab] = GLFW_KEY_TAB;
@ -907,18 +813,24 @@ namespace hex {
io.UserData = new ImGui::ImHexCustomData();
style.ScaleAllSizes(this->m_globalScale);
style.ScaleAllSizes(SharedData::globalScale);
std::string fontFile;
for (const auto &dir : hex::getPath(ImHexPath::Resources)) {
fontFile = dir + "/font.ttf";
if (std::filesystem::exists(fontFile))
break;
{
GLsizei width, height;
u8 *fontData;
io.Fonts->GetTexDataAsRGBA32(&fontData, &width, &height);
// Create new font atlas
GLuint tex;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA8, GL_UNSIGNED_INT, fontData);
io.Fonts->SetTexID(reinterpret_cast<ImTextureID>(tex));
}
this->setFont(fontFile);
style.WindowMenuButtonPosition = ImGuiDir_None;
style.IndentSpacing = 10.0F;