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

Andy Goryachev angorya at openjdk.org
Mon Sep 25 22:26:17 UTC 2023


On Sat, 23 Sep 2023 14:36:09 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/javafx/text/PrismTextLayout.java line 965:
>> 
>>> 963: 
>>> 964:         for (int i = length + startOffset - 1; i >= startOffset; i--) {
>>> 965:             if (chars[i] != ' ') {
>> 
>> should `Character.isWhitespace()` be used instead (think of symbols like U+2001 that might break, see https://en.wikipedia.org/wiki/Whitespace_character)
>
> I'm not entirely sure, perhaps Phil Race @prrace could answer that?  There are loops that just check for 0x20, but also more complicated loops that use `Character.isWhitespace`.

I think this logic needs to support all whitespace characters that might break.  Since there is no method in Character to indicate the breaking behavior, I wonder if we ought to either request one, or simply hardcode a list here.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1236#discussion_r1336441092


More information about the openjfx-dev mailing list