RFR: 8167268: StandardGlyphVector.getGlyphMetrics creates metrics with erroneous bounds for characters with no outline (e.g., the space character ' ')
Sergey Bylokhov
serb at openjdk.org
Tue Sep 30 19:18:45 UTC 2025
On Tue, 30 Sep 2025 14:26:34 GMT, Daniel Gredler <dgredler at openjdk.org> wrote:
> `GlyphMetrics` objects returned by `StandardGlyphVector.getGlyphMetrics(int)` contain bounds that are calculated by taking the glyph’s visual bounds and normalizing them by subtracting the glyph’s position.
>
> However, some glyphs (e.g., the glyph for the space character) do not have visual bounds. Their outline is an empty shape. In such a case the bounds in the metrics should not be normalized by the glyph’s position. The code erroneously ignores this special case, thus producing bounds with inconsistent negative x-positions.
test/jdk/java/awt/font/GlyphVector/GlyphMetricsTest.java line 65:
> 63: }
> 64:
> 65: private static void assertEqual(double d1, double d2, double variance, String scenario, int index) {
please split the long line to have 80 chars
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27580#discussion_r2392595773
More information about the client-libs-dev
mailing list