On Fri, 26 Jan 2024 18:45:29 GMT, Andy Goryachev <ango...@openjdk.org> wrote:
> I see some weird behavior with the text string copied from https://github.com/openjdk/jfx/pull/1236#issuecomment-1910538102 @andy-goryachev-oracle I had two checks for white space in the `computeTrailingSpaceWidth` code but only fixed one to `Character.isWhitespace`, which resulted in the artifacts you saw, sorry about that. I've fixed this now and tested with both types of white spaces. I also fixed a bug where I made assumptions about how `TextRun` works (its positions array can sometimes be shared, sometimes not, sometimes it even contains 2 floats per "position"). I now call `TextRun#getAdvance` which should be always correct. Furthermore, I discovered that changing the width of the `TextLine` is influencing a lot more than just the display. I've opted now to keep the width unchanged, but track the trailing space width separately. Only for the alignment calculations the trailing space is now taken into account. Finally, the `TextAlignment.JUSTIFY` calculation was changed to correctly take multiple trailing spaces into account. There is one more open issue there that I should tackle, but I'm unsure if that's desired (it may be a separate bug). The justify calculation only looks at regular white spaces (0x20), but I think it should really be looking at all types... ------------- PR Comment: https://git.openjdk.org/jfx/pull/1236#issuecomment-1913077183