ImHex icon indicating copy to clipboard operation
ImHex copied to clipboard

[Bug] Text becomes blurry if enable "Restore window position" and restored maximized

Open CrendKing opened this issue 4 months ago • 6 comments

Operating System

Windows

What's the issue you encountered?

If first enable "Restore window position", maximize and exit, the next time ImHex is launched maximized, all text becomes blurry. This happens to both the default pixel font as well as custom TrueType font. Screenshot below.

There is no such problem is ImHex is launched with regular size then maximize.

Also, I notice that after launch this way, the main menu becomes a hamburger menu, while there is enough space to render the whole menu. Why?

How can the issue be reproduced?

  • Enable "Restore window position"
  • Maximize window
  • Exit
  • Launch

ImHex Version

1.32.2

ImHex Build Type

  • [ ] Nightly or built from sources

Installation type

Scoop portable

Additional context?

For Pixel font screenshots, I'm using 2x scaling because it is too small by default to identify the issue, and I'm not aware of a way to only change the font size.

Screenshots

Pixel font with problem: Pixel bad Pixel font without problem: Pixel good TrueType font with problem: TrueType bad TrueType font without problem: TrueType good

CrendKing avatar Feb 21 '24 02:02 CrendKing

I just tried the nightly, and it seems enabling the new "Use OS Window decorations" eliminates the issue.

CrendKing avatar Feb 25 '24 05:02 CrendKing

Just tried this locally and I can't seem to replicate it. Both 1.0x and 2.0x look perfectly crisp for me when following your steps. Also I can't really make out any difference between the pictures you've posted but it might have been lost in compression.

Blurry fonts often mean though that you have Antialiasing or Anisotropic Filtering force-enabled in your GPU Driver settings. Check there maybe

WerWolv avatar Feb 25 '24 09:02 WerWolv

Well, if you can't tell the differences in the screenshot, maybe you missed the issue in your replication process as well. Please allow me to help you.

The difference is not lost in compression. I just downloaded the pixel font images above, cropped just the "retinas" part, and zoomed in 15x in a image editor. You can see that the problematic version has all strokes bleeding into the pixel above. This is usually caused by subpixel antialiasing, and it's usually cured by adding hinting to the font and use it in the application. If this only happened to the custom TrueType font, then I can guess maybe your font rendering engine does not make use of hinting. However, since this also happens to the pixel font, which should not have subpixel antialiasing at all, then I had no idea now.

Good small Bad small Good large Bad large


Also, just FYI, one way to identify subtle differences between two images, especially their dimensions differ, is to download them, open them both in image viewer/editor, move one of the image so their relevant position overlaps, then switch tabs/windows repeatedly. Zooming in also helps.

Also, this could be specific to your Windows build, which could explain why enabling the OS specific window deco solves the issue, and maybe why you don't replicate the issue.

CrendKing avatar Feb 25 '24 12:02 CrendKing

Okay it's extremely subtle in the original large screenshots you posted. In the past when people had issues with blurry fonts, they were really completely blurred out.

However, I still don't have the issue myself. It looks 100% crisp to me. image

Could you try the latest dev build from https://imhex.download/#nightly perhaps? Just to rule out it hasn't been fixed already.

The font renderer I'm using is basically just ImGui's with FreeType as rasterizer, I doubt that one has any issues.

WerWolv avatar Feb 25 '24 14:02 WerWolv

Thank you. I know it's relatively subtle. Once I see it, I can't unsee it :) Especially for me who used to develop font rendering engine myself.

Like I said, I tried nightly (and also the new 1.33.0). By default it behaves the same for me, until I turned on the "Use OS Window decorations".

I also noticed that while the body part of the app has the blurry, the menu text stays crisp clear. See magnified screenshots. Is there a different rendering method between the two?

Menu Body

CrendKing avatar Feb 25 '24 23:02 CrendKing

Since you mentioned about GPU driver settings, and I can't run ImHex in a virtual machine due to lack of video hardware acceleration, I went to reset my driver settings (it is NVIDIA), even though I'm pretty sure I've never change its default (I learned lesson before, and I even upgraded to the latest this week. Strangely I can no longer reproduce the issue any more.

Well, sorry for taking your time. Feel free to close. And to anyone in the future who might encounter the same issue, try resetting GPU driver settings and/or upgrade driver version.

CrendKing avatar Feb 26 '24 00:02 CrendKing