JDK-8236996 : Incorrect Roboto font rendering on Windows with subpixel antialiasing
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 8,11,13
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • Submitted: 2020-01-13
  • Updated: 2020-10-12
  • Resolved: 2020-01-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 15 JDK 8 Other
11.0.8-oracleFixed 13.0.4Fixed 15 b10Fixed 8u270Fixed openjdk8u262Fixed
Related Reports
Duplicate :  
Description
The problem can be reproduced on Windows 10 (in particular, version 1809, build 17763.914) for an old version of Roboto font, attached to this ticket.
Steps to reproduce:
1) Install all font variants from the provided archive one-by-one in alphabetical order (black, bold, light, medium, regular, thin).
2) Run the program with source code given below.

Expected result: "Hello, world!" text is rendered.
Actual result: unrelated glyphs are rendered (see attached image).

--- Test program source code ---
import javax.swing.*;
import java.awt.*;

public class FontDrawingTest {
    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> {
            JFrame frame = new JFrame();
            frame.add(new MyComponent());
            frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            frame.setSize(200, 100);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        });
    }

    private static class MyComponent extends JComponent {
        @Override
        protected void paintComponent(Graphics g) {
            ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, 
                                              RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
            g.setFont(new Font("Roboto", Font.PLAIN, 24));
            g.drawString("Hello, world!", 25, 35);
        }
    }
}
--------------------------------

Comments
Fix Request (8u) Backport to 8u requested because it is a part of 8u271-oracle. Patch applies cleanly to 8u-dev after paths reshuffling. Testing: manually with FontDrawingTest, jtreg:test/jdk/java/awt/font, jck:api/java_awt/Font. Exported commit for 8u-dev with original attribution: http://cr.openjdk.java.net/~akasko/jdk8u/8236996/8236996_8u.patch
25-05-2020

Verified that the bug is reproducible with Oracle JDK 8 and that porting the fix from JDK 15 to JDK 8 resolves the bug in Oracle JDK 8. Accomplishing backport of the fix to Oracle JDK 8.
14-05-2020

OK, pushed to jdk13u-dev
15-04-2020

I am not a committer in jdk-updates and would appreciate if someone push it to 13u-dev for me, thanks!
14-04-2020

Approved for 13u. Please push to jdk13u-dev; master is considered closed.
09-04-2020

Fix Request (11u) Backport to 11u requested because this patch fixes important problem with fonts support on Windows. Patch applies cleanly to 11u-dev. Testing: manually with FontDrawingTest, jtreg:test/jdk/java/awt/font, jck:api/java_awt/Font.
08-04-2020

Fix Request (13u) Backport to 13u requested because this patch fixes important problem with fonts support on Windows. Patch applies cleanly to 13u-dev. Testing: manually with FontDrawingTest, jtreg:test/jdk/java/awt/font, jck:api/java_awt/Font. PS: I work on Windows builds at Red Hat and going to proceed with 11u backport after 13u one.
05-04-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/82fe2f667c29 User: psadhukhan Date: 2020-02-11 08:55:22 +0000
11-02-2020

URL: https://hg.openjdk.java.net/jdk/client/rev/82fe2f667c29 User: prr Date: 2020-01-27 21:02:36 +0000
27-01-2020

http://mail.openjdk.java.net/pipermail/2d-dev/2020-January/010522.html
13-01-2020