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

Daniel Gredler dgredler at openjdk.org
Thu Dec 11 13:56:20 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.

This pull request has now been integrated.

Changeset: e1d1d53c
Author:    Daniel Gredler <dgredler at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/e1d1d53cd1211b64d1fef03583a23056908b3482
Stats:     80 lines in 2 files changed: 74 ins; 0 del; 6 mod

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

Reviewed-by: serb, prr

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

PR: https://git.openjdk.org/jdk/pull/27580


More information about the client-libs-dev mailing list