RFR: 8185261: Font fallback sometimes doesn't work in Swing text components

Dmitry Batrak dbatrak at openjdk.java.net
Tue Feb 1 21:26:05 UTC 2022


On Tue, 1 Feb 2022 19:47:59 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> The proposed fix makes fonts with and without fallback components distinguishable (in terms of `equals` method), so that
>> font metrics cache (and other similar code) can handle them separately. This is achieved by adding a new boolean field
>> to `Font` class, specifically denoting fonts with fallback components. The latter ones don't need to pretend to be
>> 'created' fonts anymore, to preserve their `Font2D` handle.
>> It's not possible to use the existing `createdFont` field in `equals` implementation, as JCK requires a 'real' created
>> font (the one obtained using `Font.createFont` method) to be equal to the same font after serialization and
>> deserialization.
>
> test/jdk/javax/swing/JEditorPane/JEditorPaneFontFallback.java line 2:
> 
>> 1: /*
>> 2:  * Copyright 2022 JetBrains s.r.o.
> 
> It seems that different files use different style of "Copyright 2022 JetBrains s.r.o", is the current correct?

To my knowledge, it's correct. It's also used in other JetBrains source code currently.

> test/jdk/javax/swing/JEditorPane/JEditorPaneFontFallback.java line 28:
> 
>> 26:  * @bug 8185261
>> 27:  * @summary Tests that font fallback works reliably in JEditorPane
>> 28:  * @key headful
> 
> Is the test depends on the headful libraries? Don't we need to test both headful and headless cases?

Indeed, the test will work just as fine in a headless environment. Copied that line without fixing. Will remove it.

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

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



More information about the client-libs-dev mailing list