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

John Hendrikx jhendrikx at openjdk.org
Sat Feb 10 17:28:04 UTC 2024


On Sat, 10 Feb 2024 14:40:45 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>>> And on Linux I get similar failures to my Windows system due to no Monaco font.
>> 
>> Was the Tahoma font available there (you can see from the `TextLayoutTest > fail()` test) ?
>> 
>> If so, I could rewrite most of the tests to use the Tahoma font, and then probably disable most of the tests for MacOS, unless we can find a font that is common to all platforms -- searching around the web, I get the impression that the fonts "Arial", "Verdana" and "Times New Roman" may be present on all three platforms.
>> 
>> The test isn't so much a test of the font rendering or engine, but a test of alignment and soft wrapping, so having it run on even one OS is a big win.  Variations in font, sizes, etc, don't really change what code paths are hit, just the resulting widths will be off by a few pixels (still need a specific font to use as baseline though as the test widths are manually picked to match).
>
>> > And on Linux I get similar failures to my Windows system due to no Monaco font.
>> 
>> Was the Tahoma font available there (you can see from the `TextLayoutTest > fail()` test) ?
> 
> It doesn't look like it:
> 
> 
> org.opentest4j.AssertionFailedError: Check if this system test actually runs on the build environment;
> font loaded was [System Regular, System, Regular, System Regular, 12.0]
> and [System Regular, System, Regular, System Regular, 12.0]
> ==> expected: <true> but was: <false>
> 
> 
>> ...searching around the web, I get the impression that the fonts "Arial", "Verdana" and "Times New Roman" may be present on all three platforms.
> 
> That might make sense. Whichever font you do choose, you will want to add an Assumption to check for its existence and skip the tests if not found.

@kevinrushforth @andy-goryachev-oracle 

I've modified the test to use the Arial font instead of Monaco (hoping that at least Arial is available on all systems).  The Tahoma font I kept intact as the original test is doing some special case with it (but it's only one test).  With any luck, 95% of the tests work on all systems now.  The test using Tahoma probably only works on a Windows system.

I've added assumptions as well, so the tests are automatically skipped when fonts are returned that are unexpected.

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

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


More information about the openjfx-dev mailing list