Hi,
We are facing an issue where the fonts getting garbled when clear Type tuner is enabled in Windows 10 OS.
Java version used is given below,
#java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
I have created a sample to demonstrate a code snippet in our application which hits with this issue.
Attached the screenshot of the issue.
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
public class TestClearType {
private JPanel panel1;
public static final Color bannerColor = new Color(0, 125, 184);
static Dimension upperPanelDimension = new Dimension(800, 402);
public TestClearType() {
JFrame jf = new JFrame();
JPanel main = new JPanel();
main.setLayout(new BorderLayout());
// Panel
panel1 = new JPanel();
panel1.setLayout(new BorderLayout());
panel1 = createUpperPanel(panel1);
main.add(panel1,BorderLayout.NORTH);
// Add to Frame
jf.getContentPane().add(main);
// pack and set Visible
jf.pack();
jf.setVisible(true);
System.out.println("Constructor EDT: " + SwingUtilities.isEventDispatchThread());
}
private JPanel createUpperPanel(JPanel comp) {
JPanel upperPanel = new JPanel();
upperPanel.setLayout(new GridBagLayout());
upperPanel.setBackground(bannerColor);
upperPanel.setPreferredSize(upperPanelDimension);
JLabel productTitle = new JLabel("Testing Console Text");
productTitle.setFont(new Font("roboto-light", 0, 44)); // NOI18N
productTitle.setForeground(Color.WHITE);
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
upperPanel.add(productTitle, c);
comp.add(upperPanel, BorderLayout.NORTH);
return comp;
}
public static void main(String[] args) {
SwingUtilities.invokeLater(TestClearType::new);
System.out.println("Main EDT: " + SwingUtilities.isEventDispatchThread());
}
}