-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Loaded font looks smaller that it should with given size #4780
Description
Version/Branch of Dear ImGui:
brunch: master
commit hash: 78c6435dbb65e84897f22cf8d4a6c5169c3775bc
Dear ImGui 1.86 WIP (18513)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 4, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _WIN64
define: _MSC_VER=1929
define: _MSVC_LANG=202004
--------------------------------
io.BackendPlatformName: imgui_impl_glfw
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000000
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00000006
HasMouseCursors
HasSetMousePos
--------------------------------
io.Fonts: 2 fonts, Flags: 0x00000000, TexSize: 512,1024
io.DisplaySize: 1280.00,800.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 5.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00
My Issue/Question:
I am trying to change default font in my application but it seems that some fonts loading works unexpected: font size doest match to given value.
For examle I changed default font to windows Consola (C:\Windows\Fonts\Consola.ttf) and it looks fine (screenshot 1)
And then I tried windows Segoe UI (C:\Windows\Fonts\segoeui.ttf) with same size and it looks smaller then I expect (screenshot 2)
Screenshots/Video
There is notepad with "Debug" in the same font and font size as Dear ImGui in these screenshots
Screenshot 1 (text in notepad is a bit bigger):

Screenshot 2 (text in notepad is much bigger):

Standalone, minimal, complete and verifiable example:
I tried it with IMGUI_ENABLE_FREETYPE and without, got same result
std::filesystem::path fontPath = "C:\\Windows\\Fonts\\segoeui.ttf";
ImGuiIO& io = ImGui::GetIO();
io.Fonts->AddFontFromFileTTF( fontPath.string().c_str(), 14, nullptr, nullptr);
io.Fonts->Build();