RFR: JDK-8314215 Trailing Spaces before Line Breaks Affect the Center Alignment of Text
John Hendrikx
jhendrikx at openjdk.org
Mon Oct 30 08:54:43 UTC 2023
On Mon, 30 Oct 2023 05:34:54 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
> I've tested `AAA BBB CCC` in Chrome, and the text is rendered pretty much exactly as your "before" version:
For the current rendering that JavaFX does, there is no browser equivalent, although `pre-wrap` comes close, JavaFX will take the spaces into account when adding the ellipsis (in HTML can test with `overflow: hidden; text-overflow: ellipsis;`) and displays odd empty lines in between the cut-off lines (see the 2nd before picture). I suppose this could also be considered a separate bug.
For browsers, `pre-line` is the `normal` equivalent that preserves spaces; this probably should be the default setting for FX as spaces are considered significant in FX controls. This what this PR provides.
Although I definitely think the `pre-line` (or `normal` but preserving white space) rendering should have been standard from the beginning, this could be provided with a CSS style (but that will need a default as well, and the current one isn't ideal as default IMHO). I'm however not sure if that's really worth it as JavaFX labels and text fields are quite different from browser elements. I'm unaware of other UI toolkits offering such settings.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1236#issuecomment-1784740948
More information about the openjfx-dev
mailing list