RFR: JDK-8314215 Trailing Spaces before Line Breaks Affect the Center Alignment of Text
John Hendrikx
jhendrikx at openjdk.org
Fri Jan 26 01:27:50 UTC 2024
On Thu, 25 Jan 2024 23:44:06 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>>> Regarding other whitespace characters. Using \u2003 em space, pasting the following text
>>
>> I think we can use `Character.isWhitespace`. For the most part it aligns with "is this a breaking space". It's not perfect, but we can do more when there are complaints. Here's my test:
>>
>>
>> char isWhiteSpace (breaking space)?
>> \u0009 true
>> \u0020 true
>> \u00a0 false
>> \u1680 true
>> \u180e false <- unexpected
>> \u2001 true
>> \u2002 true
>> \u2003 true
>> \u2004 true
>> \u2005 true
>> \u2006 true
>> \u2007 false
>> \u2008 true
>> \u2009 true
>> \u200a true
>> \u200b false <- unexpected
>> \u200c false <- unexpected
>> \u200d false <- unexpected
>> \u202f false
>> \u205f true
>> \u3000 true
>
> 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...
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1236#issuecomment-1911261917
More information about the openjfx-dev
mailing list