[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: RFR: 6742362: JComponent.setFont() font comparison is not correct
From:       Alexey Ivanov <aivanov () openjdk ! java ! net>
Date:       2022-02-23 21:59:13
Message-ID: yf-esU_18UhI_WQvzWtI-eI5gYJAvGl23Guj1A7BI6o=.9621a0e1-00cd-4fb5-9d76-88b3bd12f18b () github ! com
[Download RAW message or body]

On Tue, 22 Feb 2022 08:59:52 GMT, Prasanta Sadhukhan <psadhukhan@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 agree it's safer to leave it unchanged. If a new font instance is set, it's likely \
different, it's safer to repaint the component. If you want to avoid expensive \
repaint, don't change the component font. In the majority of cases, font is set when \
the component is configured before it's made visible.

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

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic