MegaMek / megameklab

MegaMekLab is a BattleTech unit modification program. It allows creating and modifying all unit types available in MegaMek from Support Vehicles up to WarShips. It also allows printing record sheets for single or multiple units.
http://www.megamek.org
86 stars 131 forks source link

GUI Scaling Issue #1170

Open matthewbro3 opened 1 year ago

matthewbro3 commented 1 year ago

Environment

Version: MegaMekLab, HQ package, 0.48.0 Operating System: Linux, Ubuntu 22.04.1 LTS Java: OpenJDK 11.0.16

Description

MegaMekLab appears to be experiencing GUI issues on my high DPI monitor (3072 x 1920, scaling factor 200%). As shown in the provided screenshots, certain GUI elements appear compressed, rendering them difficult to read or use, bordering on impossible. The issue is consistently reproducible across all. I have attempted the following launch options from the terminal, but the issue persisted:

"java -Xmx1024m -Dsun.java2d.opengl=true -Dsun.java2d.uiScale=1 -jar MegaMekLab.jar" "java -Dsun.java2d.uiScale=1 -jar MegaMekLab.jar" "GDK_SCALE=1 java -jar MegaMekLab.jar" "GDK_DPI_SCALE=1 java -jar MegaMekLab.jar"

Setting the scaling factor for each of these commands to 0.5 and 2 also had no effect, as did running version 0.49.7 and 0.49.9. Running the program using OpenJDK8 also failed to resolve the problem.

The only fix that did work was setting the operating system's scaling to 100%, rather than 200%. Given the high resolution of the monitor, this also rendered the OS GUI impractically small, so I do not consider this a viable fix. Given this, and the fact that only some of the text appears to be scaled up, I believe the source of the problem is that the OS's scaling factor is only applying to certain elements of the GUI.

Files

Screenshot from 2022-09-14 11-38-21 Screenshot from 2022-09-10 12-15-15 megameklablog.txt

mhjacks commented 3 months ago

Seeing something very similar on Fedora 40 / Java 17 with a 4k screen: image

It's really only the structure/armor screen that's a problem, the rest actually look pretty good (in MML anyway)

In my case, setting the OS scaling to 100% makes everything painfully small so it's not a viable workaround for me. I do have other machines I can edit units on.

raelik commented 1 week ago

I've noticed this too (on Linux specifically), and also noticed that trying to use GDK_SCALE or -Dsun.java2d.uiScale has less-than-stellar results because of inconsistencies. For instance, setting the scale to 2x results in the font being legible on the start screen, but the splash image also doubles in size and makes the UI buttons inaccessible off the edge of the screen. I can modify the splash image to account for this though. BUT, then the fonts on the Unit Selection screen become overly large. MegaMek with it's internal font scaling doesn't need to use these options and seems to be much more consistent.