The following code throws exception with hershey font that can be found in recent
fedora release:
Font f = Font.createFont(Font.TYPE1_FONT, new File("hrger.pfa"));
FontMetrics fm = Toolkit.getDefaultToolkit().getFontMetrics(f);
fm.getWidths(); //Index out of bounds is thrown here.
Exception stack trace:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at sun.font.FileFontStrike.setCachedGlyphPtr(FileFontStrike.java:374)
at sun.font.FileFontStrike.setCachedGlyphPtr(FileFontStrike.java:425)
at sun.font.FileFontStrike.getGlyphImagePtr(FileFontStrike.java:284)
at sun.font.FileFontStrike.getGlyphAdvance(FileFontStrike.java:496)
at sun.font.FileFontStrike.getCodePointAdvance(FileFontStrike.java:526)
at sun.font.FontDesignMetrics.handleCharWidth(FontDesignMetrics.java:415)
at sun.font.FontDesignMetrics.getWidths(FontDesignMetrics.java:537)
at HersheyFont.main(HersheyFont.java:27)
Test source code and font file are attached to this CR.
This can be reproduced on openjdk 6 "build 1.6.0-ea-b10" on at least
solaris x86 and linux.
on jdk 7 the test code above runs successfully on both solaris and linux.