RFR: 8314215: Trailing Spaces before Line Breaks Affect the Center Alignment of Text [v15]

John Hendrikx jhendrikx at openjdk.org
Tue Apr 23 05:54:37 UTC 2024


On Mon, 22 Apr 2024 16:52:16 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

> 2. resolve the problems with the fonts (could we pick the font(s) that are available via some utility method?)

I already left a comment on this before, see here: https://github.com/openjdk/jfx/pull/1236#issuecomment-1939200760

The `TextLayoutTest` tests the reflow logic in `PrismTextLayout`. The code under test is not platform or font specific, it doesn't have different branches for different fonts or platforms.  Adding more fonts for specific platforms therefore would exercise the exact same code paths twice without a tangible benefit.  If the tests fail for Tahoma, the same tests would fail for Monaco.  If it fails on one platform, the exact same failures would occur on another platform.

Duplicating the tests for a new font would require running the tests, checking all the exact metric values, and copying those to the duplicated test.  Adding new tests becomes more of a maintenance burden as now two tests need to be maintained and updated (both would fail if one fails).

Ideally, these tests should be real Unit tests, with a Font definition stored in `src/test/resources` and without requiring the FX platform to run -- the tested code is just some maths after all.  However, FX is insufficiently abstracted to allow for loading certain classes without the platform running, and storing a specific font in the repository may not be possible due to licensing issues (even just to check IF there are licensing issues).

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

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


More information about the openjfx-dev mailing list