RFR: 8185261: Font fallback sometimes doesn't work in Swing text components
Sergey Bylokhov
serb at openjdk.java.net
Tue Feb 1 19:54:12 UTC 2022
On Tue, 1 Feb 2022 18:38:39 GMT, Dmitry Batrak <dbatrak 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.
src/java.desktop/share/classes/java/awt/Font.java line 464:
> 462: * should be copied to derived fonts.
> 463: */
> 464: private transient boolean withFallback;
I wonder how it will work if the Font was read from the system, then serialized/deserialized and then used?
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?
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?
-------------
PR: https://git.openjdk.java.net/jdk/pull/7313
More information about the client-libs-dev
mailing list