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

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Thu Feb 21 22:19:46 UTC 2019


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


-- 
Best regards, Sergey.


More information about the 2d-dev mailing list