Comments (12)
I'll need much more information than this.
What is the version of Substance?
What is the OS and the version of the OS?
What is the version of Java?
Also, please attach screenshots of the same UI under Java 8 and Java 9 on that machine.
from substance.
Here is an image of the issue. On the left, with Java 8 (latest version), on the right, Java 9 (9.0.1). You can clearly see the edges of the components are not scaled properly in Java 9.
As for the OS, I'm using Windows 10, with a 125% scaling factor. Test done with Substance 7.1
Here is the code :
SwingUtilities.invokeLater(() ->
{
try
{
UIManager.setLookAndFeel(new SubstanceBusinessLookAndFeel());
}
catch(UnsupportedLookAndFeelException e)
{
e.printStackTrace();
}
JFrame frame = new JFrame();
JTabbedPane jtp = new JTabbedPane();
JPanel pan = new JPanel();
pan.add(new JButton("Hello!"));
jtp.addTab("Testing", pan);
frame.add(jtp);
frame.setSize(300, 200);
frame.setVisible(true);
});
from substance.
As a side note, this issue also occurs when choosing the 150% scaling factor in Windows 10
from substance.
For now, use –Dsun.java2d.uiScale=1.0 on Java 9 to disable the built-in HiDPI emulation on Java 9 when the desktop is using a custom scaling factor.
I will look into whether it is feasible to provide support for HiDPI on both Java 8 and Java 9.
from substance.
Alright, thanks for the workaround. Keep up the great work! :)
from substance.
After testing the workaround you provided, it looks like fonts are not scaled with said workaround. Everything else works, but icons seem to not be scaled at all and, because of this, appear tiny.
from substance.
This fixes the text scaling issues when using the workaround. Use this after applying the LaF :
SubstanceLookAndFeel.setFontPolicy(SubstanceFontUtilities.getScaledFontPolicy(
(float)(SubstanceSizeUtils.getPointsToPixelsRatio()) / 1.33F));
Just to recap for anyone who encounters the same bug : the current way to get Substance to work nicely with HiDPI on Java 9 is to use -Dsun.java2d.uiScale=1.0
to disable the Java 9 HiDPI system, and the code snippet above to fix font scaling.
from substance.
Thank you. I've added that snippet at the end of https://github.com/kirill-grouchnikov/substance/blob/master/www/docs/faq.md
from substance.
The snippet has a problem though, in that now all the fonts are way bigger when using Java 8.
Edit : If compatibility with both Java 8 and Java 9 is required, one can simply run the snippet under the following if :
if(new JLabel("a").getFont().getSize() <= 12)
Kind of a hack, but it works. If the font is small, it is considered to not be scaled, then the scaling mechanism is applied. In this way, if the font was already scaled, the snippet isn't run, and if it wasn't scaled, the snippet is ran. In case of normal HiDPI, then it doesn't really matter, as it will just get a scaled policy that is scaled by 100% (i.e. actually not scaled).
from substance.
That can be "guarded" by checking the Java runtime version.
System.getProperty("java.specification.version").startsWith("9")
Of course, you wouldn't know the custom scaling factor set on the particular machine without yet more code.
from substance.
The problem is that i am also encountering issues with fonts not being scaled under other very specific circumstances I won't investigate further. (e.g using packr to create a .exe with an embedded JRE under Java 8. Substance doesn't scale fonts for an obscure unknown reason.)
So this is kind of a universal fix for any "font not being scaled" problem. I will open other issues if I manage to find the specific causes for this kind of problem.
EDIT : After doing some tests the scaling issues are not caused by Substance but by a weird bug in packr. So your guard is much better in most cases.
from substance.
This is ready for testing. There are a few "corners" where the visuals under fractional scaling factors are not quite perfect. Some of those will be addressed in time for the final 8.0.0 release, and those that slip will be handled a bit later.
from substance.
Related Issues (20)
- Writing Japanese text fails when using Substance HOT 2
- Issue with the tree cell render which must be object of default cell render rather than the treecell. HOT 4
- SubstanceTableHeaderUI not being able to find draggedColumn HOT 9
- isFocusTraversable() has been deprecated
- Switching from Substance to another L&F causes IllegalArgumentException HOT 11
- Windows maximize when dragged to top HOT 1
- Maximize bug on secondary screen when screen resolutions differ HOT 4
- NullPointerException for Business L&F under Java 9 HOT 4
- Possible to change scroll bar style? HOT 1
- Move to Java 9 for compile / runtime HOT 1
- Support for "inverse flat" look of title pane control buttons HOT 1
- Slow performance HOT 4
- How to apply custom FontSets? HOT 2
- JTree rendering with Raven HOT 4
- Using the same border for JTextField and JTextArea/JScrollPane? HOT 2
- Not possible to change alpha value for color with color picker HOT 4
- JitPack deployment HOT 4
- NullPointerException in CheckBoxMenuItemIcon.getIconWidth() HOT 5
- Migration guide to v8 HOT 2
- Colorize SVG icons on skin change HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from substance.