RFR: 8167268: StandardGlyphVector.getGlyphMetrics creates metrics with erroneous bounds for characters with no outline (e.g., the space character ' ') [v2]

Daniel Gredler dgredler at openjdk.org
Sat Oct 4 14:00:53 UTC 2025


On Wed, 1 Oct 2025 18:41:00 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Do you know when that might happen? This code gets its values (after a few layers of abstraction) from `StandardGlyphVector$GlyphStrike.getGlyphOutlineBounds(int, float, float)`, which has a similar `isEmpty` check.
>
> I am not sure if it is possible, but I would like to make sure we did not introduce any issues, since isEmpty() will skip ‘flipped’ bounds.

I think the main thing is that the condition which adds the "aggregate" position to the glyph bounds is the same condition which later undoes this and converts the position back to the "single glyph" position. The code which adds the total advance the glyph position uses `isEmpty`, so I think the code which undoes it (the code being added in this PR) needs to use it as well:

https://github.com/openjdk/jdk/blob/76dba201fa1a525780677e4d3dee8e9ffafd1cd7/src/java.desktop/share/classes/sun/font/StandardGlyphVector.java#L1798

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27580#discussion_r2403986158


More information about the client-libs-dev mailing list