Skip to content

Commit bd2e924

Browse files
authored
Merge pull request #643 from Krowe-moh/patch-1
2 parents e47b3ac + dee4eca commit bd2e924

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

FModel/Framework/ImGuiController.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,19 @@ public ImGuiController(int width, int height)
6666
var iniFileNamePtr = Marshal.StringToCoTaskMemUTF8(Path.Combine(UserSettings.Default.OutputDirectory, ".data", "imgui.ini"));
6767
io.NativePtr->IniFilename = (byte*)iniFileNamePtr;
6868
}
69-
FontNormal = io.Fonts.AddFontFromFileTTF("C:\\Windows\\Fonts\\segoeui.ttf", 16 * DpiScale);
70-
FontBold = io.Fonts.AddFontFromFileTTF("C:\\Windows\\Fonts\\segoeuib.ttf", 16 * DpiScale);
71-
FontSemiBold = io.Fonts.AddFontFromFileTTF("C:\\Windows\\Fonts\\seguisb.ttf", 16 * DpiScale);
69+
70+
// If not found, Fallback to default ImGui Font
71+
var normalPath = @"C:\Windows\Fonts\segoeui.ttf";
72+
var boldPath = @"C:\Windows\Fonts\segoeuib.ttf";
73+
var semiBoldPath = @"C:\Windows\Fonts\seguisb.ttf";
74+
75+
if (File.Exists(normalPath))
76+
FontNormal = io.Fonts.AddFontFromFileTTF(normalPath, 16 * DpiScale);
77+
if (File.Exists(boldPath))
78+
FontBold = io.Fonts.AddFontFromFileTTF(boldPath, 16 * DpiScale);
79+
if (File.Exists(semiBoldPath))
80+
FontSemiBold = io.Fonts.AddFontFromFileTTF(semiBoldPath, 16 * DpiScale);
81+
7282
io.Fonts.AddFontDefault();
7383
io.Fonts.Build(); // Build font atlas
7484

0 commit comments

Comments
 (0)