Platform: Windows (I run the test on win7 ja and win7 zh_CN), Linux and maybe more
Java: Java 8 b45. This problem does not happen in earlier builds or release.
In command line interface, compile attached file, StringTest.java. Run StringTest more than one times in the console. For the same String, return value of FontMetrics.stringWidth() is often different.
The output of the program should be the same, but in different run, the output of StringTest is different.
If we use Java 8 b44 or Java 7, there is no such problem.
StringTest.java uses Toolkit.getDefaultToolkit().getFontMetrics(f) to get FontMetrics. Toolkit.getFontMetrics(Font f) is depericated now. I am not sure if this method causes the problem. I use JFrame.getFontMetrics to get the FontMetrics in another program, and in that case, the output of FontMetrics.stringWidth() does not change.
Toolkit.getFontMetrics(Font f) is not removed from Java API, though it's depricated. The testing program also works fine before 8 b45. I am also not sure if the problem is caused by Toolkit.getFontMetrics(Font f) because I can not try all the Java GUI components to get the FontMetrics.