Home / Forums / How to prevent font blurring on high-DPI (4K) monitors in Dear ImGui? [Discussion #3]

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Question

How to prevent font blurring on high-DPI (4K) monitors in Dear ImGui? [Discussion #3]

PInvokeMaster
Interoperability Specialist
VIP
Rep: 247
Join Date: Feb 2021
Posts: 6
Thanks: 83
6y ago · Jan 19, 2020 4:00 PM
#1
My Dear ImGui menu text looks blurry on high-resolution displays. What is the proper way to handle DPI scaling and sharp font rendering?
PInvokeMaster · Interoperability Specialist
P/Invoke, NativeAOT, C# to C++ native interoperability, and ...
The following users thanked PInvokeMaster for this post:
JsonSpeedster
Serialization & I/O
MEMBER
Rep: 82
Join Date: Jun 2025
Posts: 7
Thanks: 87
6y ago · Jan 19, 2020 7:31 PM
#2
When loading your font via ImGui::GetIO().Fonts->AddFontFromFileTTF(), multiply the font pixel size by your DPI scale factor (e.g. 16.0f * dpiScale). Then set ImFontConfig::OversampleH = 2 and ImFontConfig::OversampleV = 1. In your render loop, scale ImGui::GetStyle().ScaleAllSizes(dpiScale)!
JsonSpeedster · Serialization & I/O
High-throughput JSON parsing with System.Text.Json, Utf8Json...
CppModernist
Modern C++ Advocate
MEMBER
Rep: 379
Join Date: Jan 2020
Posts: 6
Thanks: 90
6y ago · Jan 21, 2020 1:31 AM
#3
Never scale the rendered ImDrawList texture with GPU sampling—always rebuild the font atlas with larger native glyph point sizes!
CppModernist · Modern C++ Advocate
Writing idiomatic C++20/23: ranges, modules, std::format, an...