On Sat, 13 Dec 2025 00:33:30 GMT, Daniel Gredler <[email protected]> wrote:
> One of the possible code paths for `TextLayout.getPixelBounds(...)` actually > draws the text on a `Graphics2D` and checks the image pixels afterwards. The > text is drawn over a white background, so if the user sets the font's > foreground color to white then the text pixels cannot be detected (white on > white). > > This PR fixes the issue by removing the code that sets the background to > white, leaving the background as the default ARGB color (0 = transparent > black). This does not cause a new problem for users who might set their font > foreground color to transparent black, because transparent font foreground > colors always return an empty bounds anyway (by virtue of being transparent). > > The updated code should also be slightly faster since it's doing less work, > though I haven't run any performance tests. This pull request has now been integrated. Changeset: 62181b63 Author: Daniel Gredler <[email protected]> URL: https://git.openjdk.org/jdk/commit/62181b6363926968298ed37ac7780ee6d5ef0916 Stats: 107 lines in 2 files changed: 98 ins; 3 del; 6 mod 6562639: Wrong pixel bounds from TextLayout with white font Reviewed-by: serb, prr ------------- PR: https://git.openjdk.org/jdk/pull/28809
