-
Bug
-
Resolution: Unresolved
-
P4
-
8u152, 9.0.1
-
None
-
windows
Steps to reproduce:
1) Install Source Code Pro font from https://github.com/adobe-fonts/source-code-pro/archive/2.030R-ro/1.050R-it.zip
(install all fonts from TTF subfolder)
2) Set system locale to Russian
(on Windows 10 it's done in Control Panel -> Region -> Administrative -> Language for non-Unicode programs -> Change system locale...,
reboot is required)
3) Run the sample program with source given below.
Expected result: '123' digits are rendered in opened window (see attached renderingWithUSLocale.png).
Actual result: different glyphs are rendered (see attached renderingWithRussianLocale.png).
The issue is reproduced with latest Java 8 (1.8.0_152) and 9 (9.0.1) release builds.
---Sample program source code start---
import javax.swing.*;
import java.awt.*;
public class FontDrawingTest {
public static void main(String[] args) {
GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
SwingUtilities.invokeLater(() -> {
JFrame frame = new JFrame();
frame.add(new MyComponent());
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
});
}
private static class MyComponent extends JComponent {
private final Font font = new Font("Source Code Pro", Font.ITALIC, 24);
private final String text = "123";
@Override
protected void paintComponent(Graphics g) {
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
g.setFont(font);
g.drawString(text, 70, 80);
}
}
}
---Sample program source code end---
1) Install Source Code Pro font from https://github.com/adobe-fonts/source-code-pro/archive/2.030R-ro/1.050R-it.zip
(install all fonts from TTF subfolder)
2) Set system locale to Russian
(on Windows 10 it's done in Control Panel -> Region -> Administrative -> Language for non-Unicode programs -> Change system locale...,
reboot is required)
3) Run the sample program with source given below.
Expected result: '123' digits are rendered in opened window (see attached renderingWithUSLocale.png).
Actual result: different glyphs are rendered (see attached renderingWithRussianLocale.png).
The issue is reproduced with latest Java 8 (1.8.0_152) and 9 (9.0.1) release builds.
---Sample program source code start---
import javax.swing.*;
import java.awt.*;
public class FontDrawingTest {
public static void main(String[] args) {
GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
SwingUtilities.invokeLater(() -> {
JFrame frame = new JFrame();
frame.add(new MyComponent());
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
});
}
private static class MyComponent extends JComponent {
private final Font font = new Font("Source Code Pro", Font.ITALIC, 24);
private final String text = "123";
@Override
protected void paintComponent(Graphics g) {
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
g.setFont(font);
g.drawString(text, 70, 80);
}
}
}
---Sample program source code end---
- relates to
-
JDK-8228713 [Windows] Incorrect mapping from font file to GDI font results in the wrong glyphs being displayed
- Closed