I'm experimenting with different fonts for a Swing UI and I've noticed a strange effect when switching from Oracle JDK 8 to OpenJDK 16. Using two versions of the Lato font (the version 1 available from Google Fonts, and the version 2 available from latofonts.com), there is a significant difference in the position of the baseline with the version 2 on OpenJDK.
Here is an example with Oracle JDK 8:
And an example with OpenJDK 16:
On Oracle JDK 8 the baseline is the same for both fonts, but on OpenJDK 16 the Lato 2 baseline is higher. The text is no longer vertically centered relatively to the checkbox and to the text field.
I don't understand why this happens. Is this a bug in the JDK? Or an issue with the font file? I've opened both fonts in FontForge and they look quite similar.
I'm aware the font rasterizer used by OpenJDK (FreeType) is different from the one in the Oracle JDK 8 (T2K). I also know that the Lato 2 font could be shifted by deriving the font with an AffineTransform but that sounds like a dubious hack.