JDK-8185538 : JDK 9 is really slow initialising some OTF/CFF fonts.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 8u152,9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2017-07-28
  • Updated: 2020-02-03
  • Resolved: 2017-10-17
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 10 JDK 7 JDK 8
10 b29Fixed 7u271Fixed 8u231Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
Download any Noto CJK Font and run this program against it
import java.io.File;
import java.awt.Font;
import java.awt.font.FontRenderContext;

public class SlowFontInit {

    public static void main(String[] args) throws Exception {
        String name = "NotoSansCJKjp-Regular.otf";
        if (args.length > 0) {
            name = args[0];
        }
        Font f = Font.createFont(Font.TRUETYPE_FONT, new File(name));
        FontRenderContext frc = new FontRenderContext(null, false, false);
        long t0 = System.currentTimeMillis();
        f.getStringBounds(" ", frc);
        long t1 = System.currentTimeMillis();
        System.out.println((t1-t0)+"ms. "+ f.getFontName());
    }
}
$ java SlowFontInit
1802ms. Noto Sans CJK JP Regular

Almost 2 seconds .. 
Comments
This does not affect 8 GA. It only affects 8u152 and later which have the fix https://bugs.openjdk.java.net/browse/JDK-8074562.
02-10-2019

This doesn't affect Oracle JDK 8 .. because it did not properly support/parse these fonts. Now it is supported but there is a a heuristic in the code that calculates font-wide ascent/descent etc by rasterising every glyph in the font ! This didn't matter so much for fonts with 256 chars but matters a lot for 64K ! The heuristic should be replaced by reading these values from font tables.
28-07-2017