JDK-8146097 : Some glyphs are not rendered or rendered partially when antialiasing is enabled
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 8u66
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_8
  • CPU: x86
  • Submitted: 2015-11-17
  • Updated: 2015-12-23
  • Resolved: 2015-12-23
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.3.9600]

A DESCRIPTION OF THE PROBLEM :
On Windows, when LCD antialiasing is enabled, glyphs of some fonts can be rendered only partially by JRE (or not rendered at all). For example, only one bar can be rendered for 'equals' character (=) instead of two.
Same behavior is not observed in native applications.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Install Inconsolata font (available at http://www.levien.com/type/myfonts/inconsolata.html, direct download link - http://www.levien.com/type/myfonts/Inconsolata.otf).
Run the sample program.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
'a=b' string is rendered in the sample application's window.
ACTUAL -
Something similar to 'a-b' is rendered.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;

public class Test {
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                JFrame frame = new JFrame("Test");
                frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                frame.add(new MyComponent());
                frame.setSize(200, 100);
                frame.setVisible(true);
                frame.setLocationRelativeTo(null);
            }
        });
    }

    private static class MyComponent extends JComponent {
        @Override
        protected void paintComponent(Graphics g) {
            Graphics2D g2d = (Graphics2D) g;
            g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
            g.setFont(new Font("Inconsolata", Font.PLAIN, 12));
            g.drawString("a=b", 30, 30);
        }
    }
}

---------- END SOURCE ----------