2222#include " ../lib/PointCtrlSource.h"
2323#include " version.h"
2424
25+ #include < shlobj_core.h>
26+
2527namespace HTCC = HandTrackedCockpitClicking;
2628namespace Config = HTCC::Config;
2729namespace Version = HTCCSettings::Version;
@@ -70,7 +72,7 @@ class HTCCSettingsApp {
7072 {
7173 const auto screenHeight = GetSystemMetrics (SM_CYSCREEN);
7274 const auto height = screenHeight / 2 ;
73- const auto width = height / 2 ;
75+ const auto width = ( height * 2 ) / 3 ;
7476
7577 mHwnd .reset (CreateWindowExW (
7678 WS_EX_APPWINDOW | WS_EX_CLIENTEDGE,
@@ -85,6 +87,7 @@ class HTCCSettingsApp {
8587 nullptr ,
8688 instance,
8789 nullptr ));
90+ ImGui::GetMa
8891 }
8992 if (!mHwnd ) {
9093 throw std::runtime_error (
@@ -147,6 +150,8 @@ class HTCCSettingsApp {
147150 io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
148151 ImGui_ImplWin32_Init (mHwnd .get ());
149152 ImGui_ImplDX11_Init (mD3DDevice .get (), mD3DContext .get ());
153+
154+ this ->LoadFonts ();
150155 }
151156
152157 ~HTCCSettingsApp () {
@@ -156,6 +161,36 @@ class HTCCSettingsApp {
156161 gInstance = nullptr ;
157162 }
158163
164+ void LoadFonts () {
165+ static std::filesystem::path sFontsPath ;
166+ static std::once_flag sFontsPathOnce ;
167+ std::call_once (sFontsPathOnce , [&path = sFontsPath ]() {
168+ wil::unique_cotaskmem_string buf;
169+ THROW_IF_FAILED (SHGetKnownFolderPath (FOLDERID_Fonts, KF_FLAG_DEFAULT, nullptr , buf.put ()));
170+ path = { std::wstring_view { buf.get () } };
171+ if (std::filesystem::exists (path)) {
172+ path = std::filesystem::canonical (path);
173+ }
174+ });
175+ if (sFontsPath .empty ()) {
176+ return ;
177+ }
178+
179+ auto fonts = ImGui::GetIO ().Fonts ;
180+ fonts->Clear ();
181+
182+ const auto dpi = GetDpiForWindow (mHwnd .get ());
183+ const auto scale = static_cast <FLOAT>(dpi) / USER_DEFAULT_SCREEN_DPI;
184+ const auto size = std::floorf (scale * 16 );
185+
186+ fonts->AddFontFromFileTTF (
187+ (sFontsPath / " segoeui.ttf" ).string ().c_str (), size);
188+ fonts->Build ();
189+ ImGui_ImplDX11_InvalidateDeviceObjects ();
190+
191+ ImGui::GetStyle ().ScaleAllSizes (scale);
192+ }
193+
159194 [[nodiscard]] HWND GetHWND () const noexcept {
160195 return mHwnd .get ();
161196 }
@@ -307,7 +342,7 @@ class HTCCSettingsApp {
307342 ImGui::TextWrapped (
308343 " HTCC attempts to detect available features; this may not work with some "
309344 " buggy drivers. You can bypass the detection below - if the features are "
310- " not actually availalbe , this may make games crash." );
345+ " not actually available , this may make games crash." );
311346 if (ImGui::Checkbox (
312347 " Always enable XR_ext_hand_tracking" ,
313348 &Config::ForceHaveXRExtHandTracking)) {
0 commit comments