RFR: JDK-8314215 Trailing Spaces before Line Breaks Affect the Center Alignment of Text

Andy Goryachev angorya at openjdk.org
Fri Jan 26 18:48:41 UTC 2024


On Fri, 26 Jan 2024 01:25:14 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> thank you @hjohn !  this PR has been out for a while, could you sync it up with the master please?
>
> @andy-goryachev-oracle thanks for testing this, what you discovered was a bug in the `computeTrailingWhiteSpace` code that went undetected because of the simplicity of the strings I tested with.  The `positions` array containing all the character widths is shared amongst all `TextRun`s (it does mention that) but I accessed it as if it was 0 based per `TextRun`.  This means it sometimes included the width of characters that weren't spaces at all...

@hjohn 
I see some weird behavior with the text string copied from
https://github.com/openjdk/jfx/pull/1236#issuecomment-1910538102

See here:

![Screenshot 2024-01-26 at 10 39 20](https://github.com/openjdk/jfx/assets/107069028/cfdb2298-36c4-480f-bafe-f7e6e18155d7)

I've updated the MonkeyTester
https://github.com/andy-goryachev-oracle/MonkeyTest

to have the text alignment and text bounds type properties - do you think you could try using it to test?

For example,
- should the underline/strike through properties affect the handling of whitespace?
- does the updated code handle TextBoundsType.VISUAL and .LOGICAL_VERTICAL_CENTER correctly?

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

PR Comment: https://git.openjdk.org/jfx/pull/1236#issuecomment-1912524383


More information about the openjfx-dev mailing list