How to set Java (Designer) to use 100% screen scaling without changing Windows setting?

I think I saw this mentioned on the forums somewhere about a java argument you can set for this, but can’t find it…

Windows screen scaling of anything but 100% causes issues with object displays in Java apps, the Designer included, and while I always have this at 100% (even on my tiny 27" 4K monitor :D), some colleagues aren’t so adventurous and would like to set Windows to 125%.

From memory it might have been @Kevin.Herron that mentioned the Java arg?

2 Likes

Should be:

-Dsun.java2d.uiScale=1.0
3 Likes

Thanks Kevin!

Just to confirm, this is how you add these right? (and how would you add multiple?)

I think so… is that field not multi line? I’m not on a real computer right now so I can’t check.

Hmm, this didn’t seem to work on Linux. Haven’t tried on Windows

Didn’t work in Linux how? Linux will only scale 100% or 200%, depending on your screen resolution and the value of the GDK_SCALE environment variable or something… based on the hardware you described I’d expect you’re already seeing 100% in Linux.

@zander.minchin

I think using this to fix the script editor might have caused another issue?

Seems to get worse the higher the windows scaling are. 125 % seemed ok, but 150 % is as my photo shows.

We don’t test on nor expect fractional scaling to work - if anything, we expect it to be broken.
100 or 200% only.

100 (to small) and 200 (to large) percent make the script editor work without this uiscale. What is the purpose of it then?

Perhaps we’re talking past each other.

As of Java 9, Java Swing attempts to scale to whatever the UI scaling factor is set to. Windows and most Linux distros let you choose ‘fractional’ scales, i.e. 125%. Swing will attempt to support this, but really does not do a good job - fonts are scaled oddly, images are resized poorly, etc.

-Dsun.java2d.uiScale is an “escape hatch” - it is a more local setting to override the scale factor for a particular Swing application, rather than having to change your scaling factor for the entire OS.
The only value you should supply to uiScale is 1.0 or 2.0, because Swing doesn’t work well at fractional scaling values. The only reason you need to set uiScale is if you have a monitor that you want to leave at 125% or other fractional scale factor at the OS level but still work with Ignition without issues.

I see, seems to be other issues than we experience with 4K and 125 or 150 % scaling. Text and images looks good. In the script editor the mouse pointer and actual position is off, worse the longer the script line is. I believe snap is also affected by this. I tend to write scripts in notepad++ and copy them to the editor. The struggle is real. :sweat_smile:

Does the editing pane in the script console have the same issues?

:crossed_fingers: in 8.1.18 we’ll be replacing all the scripting areas throughout the designer with the same backing editor as the script console, which should bring a new set of problems solve the current known problems, particularly with high DPI.

7 Likes

Script console works, so that sounds great. :grinning:

I’m curious what you mean. As in there’ll be an execute button and a little console window?

Editor. Left hand side.

Ah, so only a backend change, there won’t be any discernble difference for users

Paul has promised much more than that. :heart_eyes:

2 Likes

Debugging? :grimacing::grimacing:

1 Like