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

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue Apr 28 21:38:22 UTC 2020


On 4/28/20 1:28 pm, Philip Race wrote:
> 
> 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
Yes but it makes it a little bit more useful, it least it will always return correct max
advance for the first characters.

> 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.

Isn't such applications is not broken already if the getMaxAdvance() returns
the size smaller than the any of getWidths()? My suggestion is to increase max
maxAdvance if it is positive but smaller than getWidths.

> 
> -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.
>>
>>


-- 
Best regards, Sergey.


More information about the 2d-dev mailing list