protegeproject / protege

Protege Desktop
http://protege.stanford.edu
Other
1.01k stars 231 forks source link

High DPI support (Linux) #251

Open t0mmyt opened 9 years ago

t0mmyt commented 9 years ago

I'm not sure if this counts as a bug or a feature request but Protege is almost unusable on a high resolution screen. If scaling is set in GTK and the GTK "theme" is used then some elements scale but most still do not.

I've attached screenshots of Protege default and GTK. My resolution is 3200x1800 on a 13" screen. WM is Gnome 3.16 with High DPI scaling set to 2.

protege-classic protege-gtk

scossu commented 9 years ago

Same issue here. XFCE with DPI set to 280, all other applications look fine.

After looking online, the issue seems to be related more generally to Swing, and this is confirmed by other Swing apps that I run and have the same issue, but I cannot tell much more because I am not a Java developer.

OS X seems to have much better support for Java/Swing on HiDPI. On MacBook Retina Protege looks good.

matthewhorridge commented 8 years ago

Closing because this is a Java/Swing issue and not a Protege issue.

louwers commented 8 years ago

@matthewhorridge This has been fixed in JDK 9 https://iamnobuna.ga/post/java-hidpi-woes-finally-over

csnyulas commented 7 years ago

Here are a few potential leads for overcoming this problem (needs to be tested and validated): http://stackoverflow.com/questions/15659044/how-to-set-the-dpi-of-java-swing-apps-on-windows-linux https://superuser.com/questions/988379/how-do-i-run-java-apps-upscaled-on-a-high-dpi-display http://stackoverflow.com/questions/28673127/how-can-i-scale-fonts-on-a-high-resolution-screen Google has many more results...

If anyone can confirm which, if any, of this solution has worked for them for Protégé that would be really great.

Note: The Protégé Look and Feel (L&F) can be set using the Window -> Look & Feel menu.

lsarni commented 6 years ago

Anyone has managed to fix this? I have tried JDK 9, the custom manifest and a few other solutions without any luck

nlappas commented 6 years ago

Problem still here

louwers commented 6 years ago

Can this be re-opened?

matthewhorridge commented 6 years ago

Sure, reopening this.

nlappas commented 6 years ago

Any workaround?

matthewhorridge commented 5 years ago

@nlappas @lsarni @louwers please could you take a look at Protege 5.5.0-beta-8 and let me know if this improves things? Thank you.

lsarni commented 5 years ago

It has changed but not improved on Windows:

5.2 5 2

Beta 5 beta 5

Beta 8 beta 8

matthewhorridge commented 5 years ago

@lsarni this is really helpful, thanks. What does the class hierarchy look like? Is it still tiny?

lsarni commented 5 years ago

Still tiny @matthewhorridge

5.2 5 2

Beta 5 beta 5

Beta 8 beta 8

matthewhorridge commented 5 years ago

@lsarni good to know. Thank you very much for your help. Much appreciated.

bututoubaobei commented 5 years ago

I have solved the problem by decrease the resolution of my windows 10 (originally it is 38402160, after changed, it is 1600900)

eyusupov commented 4 years ago

Adding -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel to run.sh (or CMDLINE env var) solved this for me on Linux

atextor commented 4 years ago

@eyusupov Which Protégé version and JRE version did you use?

eyusupov commented 4 years ago

@atextor just tried it again.

Starting Protege 4 OWL Editor (Version 4.3.0, Build = 304)
Platform:
    Java: JVM 1.8.0_252-b09 Memory: 466M
    Language: en, Country: US
    Framework: Apache Software Foundation (1.9)
    OS: linux (5.6.11.300_fc32_x86_64)
    Processor: x86-64

$ /usr/bin/java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

Still works. I edited run.sh like this:

java -Xmx500M -Xms250M \
     -server \
     -Dlog4j.configuration=file:log4j.xml \
     -DentityExpansionLimit=100000000 \
     -Dfile.encoding=UTF-8 \
     -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel \
     -classpath bin/felix.jar:bin/ProtegeLauncher.jar \
     org.protege.osgi.framework.Launcher \
Dzeri96 commented 3 years ago

@atextor just tried it again.

Starting Protege 4 OWL Editor (Version 4.3.0, Build = 304)
Platform:
    Java: JVM 1.8.0_252-b09 Memory: 466M
    Language: en, Country: US
    Framework: Apache Software Foundation (1.9)
    OS: linux (5.6.11.300_fc32_x86_64)
    Processor: x86-64

$ /usr/bin/java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

Still works. I edited run.sh like this:

java -Xmx500M -Xms250M \
     -server \
     -Dlog4j.configuration=file:log4j.xml \
     -DentityExpansionLimit=100000000 \
     -Dfile.encoding=UTF-8 \
     -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel \
     -classpath bin/felix.jar:bin/ProtegeLauncher.jar \
     org.protege.osgi.framework.Launcher \

This does not seem to work on Kubuntu 20.10

haoyun commented 3 years ago

Two not-so-perfect solutions:

  1. as mentioned above, use -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel plus a) -Dsun.java2d.uiScale=2, OR b) export GDK_SCALE=2
  2. use https://github.com/kaueraal/run_scaled
donpellegrino commented 1 year ago

Workaround for Microsoft Windows

For Windows 11 Enterprise 21H2 I found this answer useful: https://superuser.com/a/1207925. From the Protege directory, the jre/bin/java.exe is the file to change the Compatibility settings on. I used the "System (Enhanced)" setting and that seemed to reduce some of the fuzziness of the rendering seen using the "System" setting.

The root cause of this issue seems to be the limitations of the JRE version packaged with Protege Desktop for Windows.

renyuneyun commented 1 year ago

I'm using Wayland, and tried the above methods, but (almost) none made a difference for HiDPI. The only way that made a difference is to use run_scaled, which it has its own problems as well (e.g. resource consumption, not playing well with my existing scaling configuration, etc).

In particular, run_scaled basically started a separate X session and started protege within it. It seems setting the scaling factors for protege (-Dsun.java2d.uiScale=2 or export GDK_SCALE=2) will be combined with my existing scaling factor (for X and Wayland, not sure which), when used with run_scaled, leading to the UI exceptionally huge.

(As environmental information: my some other Java application would scale correctly with -Dglass.gtk.uiScale=200%, directly with Wayland. Though it uses JavaFx and Java 14.)

knbknb commented 1 year ago

On Linux using Protege 5.6.1, (which comes with its own Java 11 JRE), I have changed the first 1 lines in run.sh from this

#!/usr/bin/env bash

to this

#!/usr/bin/env bash
export GDK_SCALE=2

and the GUI becomes usable again;

This hack does not fix the GUI scaling problems for 5.5.0 which comes with its own Java 8 (and older GUI libraries?). Protege 5.5.0 is still displayed with tiny fonts.

miguelrgonzalez commented 5 months ago

version 5.6.3 had the same issue in Linux. It can be solved by adding this to the conf file at (I had to create the conf folder) : ~/.Protege/conf/jvm.conf

append=-Dsun.java2d.uiScale=2

And setting window->Look & feel -> Protégé

Cleaner than modifying the run script and it should also survive tool upgrades.