[OpenJDK 2D-Dev] RFR: 8221305: java/awt/FontMetrics/MaxAdvanceIsMax.java fails on MacOS + Solaris

Philip Race philip.race at oracle.com
Tue Apr 28 20:28:06 UTC 2020


You mean make sure maxAdvance is always at least as large as the
largest returned by getWidths() ?

getWidths() is almost as useless as getMaxAdvance().
I grimace every time I look at it and can only imagine it was added as a 
sort
of performance cache.
It only returns the advances of the first 256 characters, and it does not
even care whether those characters are supported by the font.
Very often they are not as there's a bunch of unprintable code points in 
there.


And max advance is NOT only about the advance of the first 256 
characters anyway

So that would be completely artificial and you'd be potentially introducing
a change that would cause apps to layout differently to keep an useless test
working.

-phil.

On 4/28/20, 1:07 PM, Sergey Bylokhov wrote:
> Hi, Phil.
>
> Why we cannot change the implementation of getMaxAdvance() and
> make a quick check of the FontMetrics.getWidths() the same as in the
> test? I think it does not break the new spec and the test will pass.
>
> On 4/28/20 12:38 pm, Philip Race wrote:
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8221305
>> Webrev: http://cr.openjdk.java.net/~prr/8221305/
>>
>> Now that we have resolved
>> JDK-8230672 : Specification for java.awt.FontMetrics.getMaxAdvance() 
>> is too prescriptive.
>> with an approved CSR, the assertion being tested by 
>> java/awt/FontMetrics/MaxAdvanceIsMax.java is not enforceable.
>>
>> The test should just be retired.
>>
>>
>> -phil.
>
>


More information about the 2d-dev mailing list