On Tue, 22 Feb 2022 08:59:52 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

> Font comparison in JComponent.setFont() uses `font != oldFont` check which is 
> not correct as per Object equality essence. The correct way of checking font 
> equality is to use "equals" as is done in 
> [GlyphLayout](https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/sun/font/GlyphLayout.java#L144)
>  , 
> [StandardGlyphVector](https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/sun/font/StandardGlyphVector.java#L657)
>  etc
> 
> Existing jtreg, jck test are green.

I am not sure if what used to be done before was correct..I guess we should 
ignore null font and don't do expensive repaint. Even 
[Graphics.setFont](https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/java/awt/Graphics.html#setFont(java.awt.Font))
 spec says " A null argument is silently ignored"

-------------

PR: https://git.openjdk.java.net/jdk/pull/7571

Reply via email to