FontMetrics differ between OracleJDK 8 and OpenJDK 11
jacob_tredinnick at mentor.com
Mon Dec 24 17:33:37 UTC 2018
My team is currently working on migrating some of our (mostly Desktop & Swing-based) applications from OracleJDK 8 to OpenJDK 11 and we have discovered that some fonts in our application are getting drawn significantly differently e.g. significantly larger, differences with spaces between characters.
When debugging, we found that the FontMetrics for the Font obtained as follows:
FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(font);
Returns significantly different values:
For example a plain, size 12 Calibri font:
In OracleJDK 8 metrics.getMaxAscent() returns 11, while in OracleJDK 11 it returns 9.
I understand that the proprietary "T2K" font engine was replaced by "FreeType" in OpenJDK but I'm surprised at the very noticeable differences that we now see in some of our text objects.
Is it expected that FontMetrics would be so significantly different between OracleJDK 8 and OpenJDK 11?
Note: I can share the code that generates the font metrics as well as a file describing all the diffs for fonts on my laptop if needed.
More information about the discuss