Removed unnecessary ImGui patch.
This commit is contained in:
parent
78c8acc31e
commit
e8b0102bfb
|
@ -2141,7 +2141,7 @@ ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels,
|
|||
void* data = ImFileLoadToMemory(filename, "rb", &data_size, 0);
|
||||
if (!data)
|
||||
{
|
||||
// IM_ASSERT_USER_ERROR(0, "Could not load font file!");
|
||||
IM_ASSERT_USER_ERROR(0, "Could not load font file!");
|
||||
return NULL;
|
||||
}
|
||||
ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();
|
||||
|
|
|
@ -116,21 +116,33 @@ int winmain::WinMain(LPCSTR lpCmdLine)
|
|||
// First step: just load the options
|
||||
options::InitPrimary();
|
||||
|
||||
if(!Options.FontFileName.empty()) {
|
||||
if(!Options.FontFileName.empty())
|
||||
{
|
||||
ImGuiSDL::Deinitialize();
|
||||
io.Fonts->Clear();
|
||||
ImVector<ImWchar> ranges;
|
||||
translations::GetGlyphRange(&ranges);
|
||||
ImFontConfig fontConfig;
|
||||
ImFontConfig fontConfig{};
|
||||
|
||||
// ToDo: further tweak font options, maybe try imgui_freetype
|
||||
fontConfig.OversampleV = 2;
|
||||
fontConfig.OversampleH = 8;
|
||||
fontConfig.OversampleH = 4;
|
||||
|
||||
if(!io.Fonts->AddFontFromFileTTF(Options.FontFileName.c_str(), 13.f, &fontConfig, ranges.Data)) {
|
||||
// Font loading failed, load default font instead
|
||||
io.Fonts->AddFontDefault();
|
||||
// ToDo: improve font file test, checking if file exists is not enough
|
||||
auto fileName = Options.FontFileName.c_str();
|
||||
auto fileHandle = fopenu(fileName, "rb");
|
||||
if (fileHandle)
|
||||
{
|
||||
fclose(fileHandle);
|
||||
|
||||
// ToDo: Bind font size to UI scale
|
||||
if (!io.Fonts->AddFontFromFileTTF(fileName, 13.f, &fontConfig, ranges.Data))
|
||||
io.Fonts->AddFontDefault();
|
||||
}
|
||||
io.Fonts->Build();
|
||||
else
|
||||
io.Fonts->AddFontDefault();
|
||||
|
||||
io.Fonts->Build();
|
||||
ImGuiSDL::Initialize(renderer, 0, 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue