protege icon indicating copy to clipboard operation
protege copied to clipboard

High DPI support (Linux)

Open t0mmyt opened this issue 8 years ago • 24 comments

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

t0mmyt avatar Sep 28 '15 22:09 t0mmyt

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.

scossu avatar Oct 01 '15 04:10 scossu

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

matthewhorridge avatar May 18 '16 19:05 matthewhorridge

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

louwers avatar Oct 04 '16 21:10 louwers

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.

csnyulas avatar Mar 31 '17 06:03 csnyulas

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

lsarni avatar Jan 12 '18 10:01 lsarni

Problem still here

nlappas avatar Mar 08 '18 04:03 nlappas

Can this be re-opened?

louwers avatar Mar 08 '18 12:03 louwers

Sure, reopening this.

matthewhorridge avatar Mar 12 '18 16:03 matthewhorridge

Any workaround?

nlappas avatar Jul 25 '18 17:07 nlappas

@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.

matthewhorridge avatar Jan 17 '19 01:01 matthewhorridge

It has changed but not improved on Windows:

5.2 5 2

Beta 5 beta 5

Beta 8 beta 8

lsarni avatar Jan 17 '19 23:01 lsarni

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

matthewhorridge avatar Jan 17 '19 23:01 matthewhorridge

Still tiny @matthewhorridge

5.2 5 2

Beta 5 beta 5

Beta 8 beta 8

lsarni avatar Jan 17 '19 23:01 lsarni

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

matthewhorridge avatar Jan 17 '19 23:01 matthewhorridge

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

bututoubaobei avatar Feb 12 '19 21:02 bututoubaobei

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

eyusupov avatar Nov 27 '19 22:11 eyusupov

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

atextor avatar Mar 05 '20 04:03 atextor

@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 \

eyusupov avatar May 14 '20 18:05 eyusupov

@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

Dzeri96 avatar Nov 05 '20 18:11 Dzeri96

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

haoyun avatar Mar 03 '21 00:03 haoyun

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.

donpellegrino avatar Nov 01 '22 16:11 donpellegrino

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.)

renyuneyun avatar Apr 04 '23 11:04 renyuneyun

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.

knbknb avatar Jun 08 '23 21:06 knbknb

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.

miguelrgonzalez avatar Apr 10 '24 07:04 miguelrgonzalez