Comments (15)
There're multiple corner-cases when you consider multi-monitor setup each with a different DPI setting. Currently moving ImHex View window on a monitor with a different DPI scale behaves weirdly, because WinAPI calls provide different coordinates depending on the app's DPI awareness level.
Since each View window has its own native HWND, perhaps it's also worth trying to enable Per Monitor awareness for the app and react to WM_DPICHANGED
events as such as @ocornut has described.
from imhex.
FYI as long as you are not using multi-viewports over multiple-monitors, the solution is fairly simple:
- on boot: query DPI, load font scaled according to DPI scale (then rounded to integer)
- on boot: called style.ScaleAllSizes()
- in main loop: avoid use of constants, instead make those factors of another value (e.g. font size, some padding/spacing value).
Doing step 1 even on the default font yield better results than bilinear-filtering it after the fact.
Bonus, if using imgui_impL_win32
backend it now has helper to query DPI in a way which doesn't requires newer SDK nor requires recent version of window.
Long answer, but most of it only related to multi-viewports with multi-monitors:
https://github.com/ocornut/imgui/blob/master/docs/FAQ.md#q-how-should-i-handle-dpi-in-my-application
Happy to help if you have further questions.
from imhex.
Hi! Thanks a lot for the suggestions!
Right now I simply have a multiplier in the imgui.ini config file to scale up the font/UI. I'll definitely look into those functions though.
I'd like to keep the glfw backend because I'm providing Windows and Linux builds and want them to be unified.
from imhex.
Right now I simply have a multiplier in the imgui.ini config file to scale up the font/UI.
I assume you do know the result of these multipliers is a blurry vaseline over the screen :P
from imhex.
I assume you do know the result of these multipliers is a blurry vaseline over the screen :P
Using nearest-neighbor filtering instead of linear filtering when the scale factor is an integer value should help keep text sharp. See https://tanalin.com/en/articles/integer-scaling/.
from imhex.
Does imgui even supports integer scaling by default? I think you gonna need to initialize d3d device chain with custom stuff.
from imhex.
from imhex.
There’s no need to bother with a subpar solution since it’s fairly easily to implement the proper solution of rebuilding the font atlas for a given scale.
As long as I remember existence of IMGUI - font scaling always was a blurry mess, seems like it is the bane of IMGui haha.
from imhex.
Well those things are true, and by definition there's no way you can non-integer scale the default bitmap font and get it crisp.
But scaling it at rasterization time does give better output than bilinear filtering, and once you start scale it is advised you use an appropriate font and perhaps that rasterization time scaling, and then things tends to be ok, even more so if you use Freetype.
from imhex.
What was added for HDPI in 1.6.0? Because from what I can see with my DPI 120% and Text Scale 125% it is still pretty tiny.
I'd rather see custom scaling by the program as an additional override so I can customize it manually to the point it no longer hurts. Windows scaling is always hit and miss.
from imhex.
How do I tweak/configure scaling now in 1.7?
from imhex.
@Kein It's removed, you're stuck with automatic scaling unless you modify the code back. See 56cca88#diff-90da325c23da2f8860d4d6c79af12527fd2d0cb909e172edf84daf2e2d1c9724L25
from imhex.
Autoscaling sucks, yeah
from imhex.
As always, you're more than welcome to submit a PR. I'd be happy to merge it.
from imhex.
On my system:
- macOS 11.4
- Latest Git master (same issue with 1.8.1 binary distribution)
- glfw 3.3.4
- Screen resolution 2x HiDPI
…ImHex's UI is properly laid out and not blurry, but everything looks 2x too large.
I investigated, and it looks like imgui has its own implementation of DPI scaling. From external/ImGui/source/imgui_impl_glfw.cpp:
glfwGetFramebufferSize(g_Window, &display_w, &display_h);
io.DisplaySize = ImVec2((float)w, (float)h);
if (w > 0 && h > 0)
io.DisplayFramebufferScale = ImVec2((float)display_w / w, (float)display_h / h);
But then ImHex is applying its own scaling on top of that:
glfwGetMonitorContentScale(monitor, &xscale, &yscale);
// In case the horizontal and vertical scale are different, fall back on the average
this->m_globalScale = this->m_fontScale = std::midpoint(xscale, yscale);
Thus, the 2x scale modifier is being applied twice. If I set m_globalScale
and m_fontScale
to 1 instead, the UI looks reasonably sized.
If anyone else sees different behavior, it may be because you have a different version of glfw or another library installed via Homebrew, given #268.
from imhex.
Related Issues (20)
- [Bug] Window "blinks" by becoming blurry at intervals HOT 10
- [Bug] Alt Gr key is mishandled, Ctrl key stays in pressed state, editor is unusable on AZERTY HOT 1
- [Bug] Certain setting description is clipping out of the Settings window
- [Bug] Description field in the Patterns tab of Content Store is too narrow HOT 2
- [Bug] Data Information, Byte distribution chart doesn't show bytes that occur once.
- [Bug] Double-free on exit in font manager plugin with custom font
- [Bug] Window scaling is not updated HOT 1
- [Bug] Crash on startup HOT 2
- [Bug] Existing bookmarks don't update when the base address is changed
- [Bug] Using #pragma bitfield_order crashes the application
- [Bug] placement doesn't work in if outside of a struct HOT 3
- [Bug] Hex Editor scroll don't work properly using "Jump To" HOT 1
- [Bug] UI doesn't start without raising an error on Ubuntu
- [Bug] File dialog is no longer parented properly on Linux X11 HOT 1
- [Bug] find_sequence can fail if based_address is not zero.
- [Feature] Highlight multiple paragraphs with the same color when creating a bookmark
- [Bug] Base64 provider does not work on files with newlines HOT 3
- [Bug] Graphical corruption and mouse clicking incorrect on Windows 10 HOT 2
- [Bug] Chinese(Simplified) got doubled in the language list
- [Bug] Window becomes completely unresponsive after resizing HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imhex.