Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8185538

JDK 9 is really slow initialising some OTF/CFF fonts.

XMLWordPrintable

    • 2d
    • b29

        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 ..

              pnarayanan Prahalad Kumar Narayanan (Inactive)
              prr Philip Race
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: