diff options
| author | JosJuice <josjuice@gmail.com> | 2025-11-16 13:58:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-16 13:58:18 +0100 |
| commit | 91c3a58889ee4b45606400ca961e6112778ccb95 (patch) | |
| tree | 551f1554d89775f76b5596539fe23d02101facec /Source/Core | |
| parent | e0f52e5799f5808c8f1ff997fd9a7ccd362674ca (diff) | |
| parent | c135af22dde93327bc4e0c4c5b8c649cc847207e (diff) | |
Merge pull request #13922 from TryTwo/imgui_add_default_font
OSD/Imgui: Add a better default font
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/DolphinQt/Settings/OnScreenDisplayPane.cpp | 8 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/OnScreenUI.cpp | 26 |
2 files changed, 27 insertions, 7 deletions
diff --git a/Source/Core/DolphinQt/Settings/OnScreenDisplayPane.cpp b/Source/Core/DolphinQt/Settings/OnScreenDisplayPane.cpp index 53f1888709..5d5f4d346f 100644 --- a/Source/Core/DolphinQt/Settings/OnScreenDisplayPane.cpp +++ b/Source/Core/DolphinQt/Settings/OnScreenDisplayPane.cpp @@ -149,8 +149,10 @@ void OnScreenDisplayPane::AddDescriptions() "<br><br><dolphin_emphasis>If unsure, leave this checked.</dolphin_emphasis>"); static const char TR_OSD_FONT_SIZE_DESCRIPTION[] = QT_TR_NOOP( "Changes the font size of the On-Screen Display. Affects features such as performance " - "statistics, frame counter, and netplay chat.<br><br><dolphin_emphasis>If " - "unsure, leave this at 13.</dolphin_emphasis>"); + "statistics, frame counter, and netplay chat." + "<br><br>The font can be changed by placing a TTF font file into Dolphin's User/Load " + "folder, and renaming it OSD_Font.ttf." + "<br><br><dolphin_emphasis>If unsure, leave this at 13.</dolphin_emphasis>"); static const char TR_SHOW_FPS_DESCRIPTION[] = QT_TR_NOOP("Shows the number of distinct frames rendered per second as a measure of " @@ -204,7 +206,7 @@ void OnScreenDisplayPane::AddDescriptions() "savestates.<br><br><dolphin_emphasis>If unsure, leave " "this unchecked.</dolphin_emphasis>"); static const char TR_LAG_COUNTER_DESCRIPTION[] = QT_TR_NOOP( - "Shows how many frames have occured without controller inputs being checked. Resets to 1 " + "Shows how many frames have occurred without controller inputs being checked. Resets to 1 " "when inputs are processed. <br><br><dolphin_emphasis>If unsure, leave " "this unchecked.</dolphin_emphasis>"); static const char TR_FRAME_COUNTER_DESCRIPTION[] = diff --git a/Source/Core/VideoCommon/OnScreenUI.cpp b/Source/Core/VideoCommon/OnScreenUI.cpp index 8cbd7ca4f0..0bf669ab96 100644 --- a/Source/Core/VideoCommon/OnScreenUI.cpp +++ b/Source/Core/VideoCommon/OnScreenUI.cpp @@ -3,7 +3,9 @@ #include "VideoCommon/OnScreenUI.h" +#include "Common/CommonPaths.h" #include "Common/EnumMap.h" +#include "Common/FileUtil.h" #include "Common/Profiler.h" #include "Common/Timer.h" @@ -74,11 +76,28 @@ bool OnScreenUI::Initialize(u32 width, u32 height, float scale) } // Font defaults + ImGuiIO& io = ImGui::GetIO(); m_imgui_textures.clear(); - // Setup new font management behavior. - ImGui::GetIO().BackendFlags |= - ImGuiBackendFlags_RendererHasTextures | ImGuiBackendFlags_RendererHasVtxOffset; + // User supplied font + std::string file = File::GetUserPath(D_LOAD_IDX) + "OSD_Font.ttf"; + + bool font_exists = File::Exists(file); + if (!font_exists) + { + // Default supplied font + file = File::GetSysDirectory() + DIR_SEP + RESOURCES_DIR + DIR_SEP + "OSD_Font.ttf"; + font_exists = File::Exists(file); + } + + if (font_exists) + { + io.Fonts->Clear(); + io.Fonts->AddFontFromFileTTF(file.c_str()); + } + + // Setup new font management behavior + io.BackendFlags |= ImGuiBackendFlags_RendererHasTextures | ImGuiBackendFlags_RendererHasVtxOffset; if (!RecompileImGuiPipeline()) return false; @@ -443,7 +462,6 @@ void OnScreenUI::UpdateImguiTexture(ImTextureData* tex) tex->SetTexID(static_cast<ImTextureID>(*font_tex.get())); // Keeps the texture alive. m_imgui_textures.push_back(std::move(font_tex)); - tex->SetStatus(ImTextureStatus_OK); } else if (tex->Status == ImTextureStatus_WantUpdates) |
