Bug 484303 - On high DPI screens, text on UI controls is too small to read
Summary: On high DPI screens, text on UI controls is too small to read
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 23.08.4
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-23 06:56 UTC by Peter Meilstrup
Modified: 2024-04-13 20:47 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Showing too small UI text before and after correction (141.51 KB, image/png)
2024-03-23 06:56 UTC, Peter Meilstrup
Details
Okular nightly built on windows with Qt6 (207.52 KB, image/png)
2024-04-13 20:45 UTC, Tobias Schula
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Meilstrup 2024-03-23 06:56:48 UTC
Created attachment 167637 [details]
Showing too small UI text before and after correction

SUMMARY

On high DPI screens where UI scale is set to 200%, text on UI controls and popup menus is too small to read.

STEPS TO REPRODUCE
1. Okular 23.08.04 is installed from from the windows store.  
2. Using a 4k display, and have Scaling in Windows Settings>System>Display>Scale is set to 200%.
3. Launch Okular.

OBSERVED RESULT

Labels on buttons/toolbar controls and popup menus is too small to read (see attached screenshot, upper half.)

EXPECTED RESULT

(see screenshot, lower half)

SOFTWARE/OS VERSIONS
Windows:
    Edition	Windows 11 Pro
    Version	23H2
    Installed on	‎12/‎8/‎2023
    OS build	22631.3296
    Experience	Windows Feature Experience Pack 1000.22687.1000.0

Okular: Okular reports its version as 23.08.04, The Windows Store app reports the installed version as 23.801.1522.0.

ADDITIONAL INFORMATION

I have found a way to correct the issue by manually updating the application manifest information.

1. Install the Windows SDK. Then locate the program `mt.exe`. On my system it is located at `C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\mt.exe`.

2. At an administrator prompt, use `mt.exe` to extract the manifest from the okular binary. I used the commands:

        cd "C:\Program Files\Okular\bin"
        "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\mt.exe" "-inputresource:okular.exe;#1" -out:okular.manifest
        
    Examine the resulting file `okular manifest`. I found:

  <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>

 3.  Edit `okular.manifest` to inludes a dpi awareness setting. After editing, mine looked like this:

```{html}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
      </requestedPrivileges>
    </security>
  </trustInfo>
  <asmv3:application>
    <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
      <dpiAwareness>system</dpiAwareness>
    </asmv3:windowsSettings>
  </asmv3:application>
</assembly>
```

4. Make a backup of `okular.exe`, then apply the changed manifest back to the okular binary. I ran:

    "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\mt.exe" -manifest okular.manifest "-updateresource:okular.exe;#1"

After relaunching Okular, it now shows reasonable font sizes in its UI.
Comment 1 Tobias Schula 2024-03-24 07:47:11 UTC
This is a common problem with Qt5 based apps on Windows. Having multiple screens and scaling factors makes the problem even worse. This problem is fixed with Qt6, which will/should be used by the next release of okular on Windows. I can't find the relevant bug reports right now, but this known by the Qt devs, which kept the current behavior in Qt5, so it doesn't break existing apps, but this scaling problem is gone with Qt6.
Comment 2 Tobias Schula 2024-04-13 20:45:40 UTC
Created attachment 168477 [details]
Okular nightly built on windows with Qt6

Installing the current nightly for windows, compiled with Qt6 indeed fixes the bug. All interface elements and fonts are correctly scaled. On the left: 125%, in the middle: 175%, right: 100%