[OpenJDK 2D-Dev] RFR 8218854: FontMetrics.getMaxAdvance may be less than the maximum FontMetrics.charWidth

Phil Race philip.race at oracle.com
Fri Feb 22 19:31:02 UTC 2019



On 2/22/19 11:10 AM, Martin Balao wrote:
> Hi Phil, Sergey,
>
> Thanks for your feedback.
>
> I'll propose a new Webrev moving the test location as suggested by
> Sergey, handling NPE when there are no fonts -test should pass IMO- and
> making explicit imports.
>
> Do you want me to exclude Solaris from the test?

I suppose we could do it that way.
Mainly we don't want to push a test that we know fails ..

I was proposing to just exclude point sizes < 3 .. I think there must be 
some rounding issues
as we approach the limit of 1 pixel ...
FWIW I checked that it is freetype 2.6.3 installed on that Solaris 11.3 
SPARC system which
doesn't seem that different than what I see on RH systems but there are 
also a ton of
config options and I don't know how it was built.



-phil.

>
> Kind regards,
> Martin.-
>
>
>
> On 2/21/19 10:48 PM, Philip Race wrote:
>> Oh two other things.
>>
>> 1) The change should be pushed to jdk/client not jdk/jdk
>> 2) If you are making changes anyway maybe enumerate the imports rather
>> than wild-carding..
>>
>> -phil.
>>
>> On 2/21/19, 5:47 PM, Philip Race wrote:
>>> I submitted a test job to see what it did on our test platforms :
>>> Solaris, WIndows, Mac as well as Linux
>>> and I got lot of failures on Solaris .. 38 of them .. a sample below
>>> but not just for obscure fonts,
>>> it included Arial (in various styles), Arial Black, Arial Narrow ...
>>>
>>> They are all at char width 1 or 2 .. since Arial is also available on
>>> Mac + Windows and didn't
>>> fail there I wonder if it is due to the freetype installed on Solaris ?
>>>
>>> Not sure what to do ... exclude the smallest sizes for now ?
>>>
>>> -phil.
>>>
>>> Testing java.awt.Font[family=AR PL ShanHeiSun Uni,name=AR PL ShanHeiSun Uni,style=bolditalic,size=1] in FT_LOAD_TARGET_MONO
>>> getMaxAdvance: 2
>>> Max char width: 1
>>> PASSED
>>> .........................
>>> Testing java.awt.Font[family=AlArabiya,name=AlArabiya,style=bolditalic,size=1] in FT_LOAD_TARGET_MONO
>>> getMaxAdvance: 2
>>> Max char width: 1
>>> PASSED
>>> .........................
>>> Testing java.awt.Font[family=AlBattar,name=AlBattar,style=bolditalic,size=1] in FT_LOAD_TARGET_MONO
>>> getMaxAdvance: 2
>>> Max char width: 1
>>> PASSED
>>> .........................
>>> Testing java.awt.Font[family=AlHor,name=AlHor,style=bolditalic,size=1] in FT_LOAD_TARGET_MONO
>>> getMaxAdvance: 2
>>> Max char width: 1
>>> PASSED
>>> .........................
>>> Testing java.awt.Font[family=AlManzomah,name=AlManzomah,style=bolditalic,size=1] in FT_LOAD_TARGET_MONO
>>> getMaxAdvance: 2
>>> Max char width: 1
>>> PASSED
>>> ....
>>>
>>>
>>>
>>>
>>> On 2/21/19, 2:19 PM, Sergey Bylokhov wrote:
>>>> Hi, Martin.
>>>>
>>>> What exceptions do you expect below? I think any exception will means
>>>> a bug in jdk, no?
>>>>
>>>>          try {
>>>>              GraphicsEnvironment e =
>>>>                  GraphicsEnvironment.getLocalGraphicsEnvironment();
>>>>              fonts = e.getAllFonts();
>>>>          } catch (Exception e) {}
>>>>
>>>> Even if you skip an Exception, you will get NPE later at line "103
>>>> for (Font f : fonts) {"
>>>>
>>>> BTW probably the test can be moved to the "java/awt/FontMetrics/"
>>>> folder.
>>>>
>>>> On 21/02/2019 13:27, Martin Balao wrote:
>>>>> Hi Phil,
>>>>>
>>>>> On 2/19/19 10:34 PM, Philip Race wrote:
>>>>>> One more thing about the test, I am not sure why you need to use
>>>>>> sun.font.FontDesignMetrics directly ?
>>>>>>
>>>>>> Isn't it enough to create a BufferedImage and get an appropriate
>>>>>> FRC and FM by setting the properties on the graphics for that ?
>>>>>>
>>>>> Yes, that's better, there's no need to use an internal API here.
>>>>>
>>>>> Webrev.02:
>>>>>
>>>>>    *
>>>>> http://cr.openjdk.java.net/~mbalao/webrevs/8218854/8218854.webrev.02/
>>>>>    *
>>>>> http://cr.openjdk.java.net/~mbalao/webrevs/8218854/8218854.webrev.02.zip
>>>>>
>>>>>
>>>>> Are we good to go with Webrev.02?
>>>>>
>>>>> Thanks,
>>>>> Martin.-
>>>>>
>>>>



More information about the 2d-dev mailing list