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

Philip Race philip.race at oracle.com
Fri Feb 22 01:47:19 UTC 2019


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.-
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/2d-dev/attachments/20190221/72df3188/attachment.html>


More information about the 2d-dev mailing list