File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments