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

Dmitry Batrak dbatrak at openjdk.java.net
Mon May 16 11:05:49 UTC 2022


On Tue, 1 Feb 2022 21:40:53 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.
>
> Dmitry Batrak has updated the pull request incrementally with one additional commit since the last revision:
> 
>   remove 'headful' requirement from test case

Not having a feedback on PR for months is pretty discouraging. If any help in solving this issue isn't going to be accepted, let me know - I'll stop pinging then.

Just in case, let me re-iterate on the available options, as I see them:

- We don't modify `Font.equals` behaviour.
  In this case, modifications will need to be made in font metrics cache code (and, potentially, other affected places going forward as needed). That code would either access `Font2D` instance directly (making the approach available only for JDK-internal code), or we can introduce some public method in `Font` class, e.g. `rendersEquallyTo(Font)`, which can perform `Font2D` comparison internally.

- We do modify `Font.equals` behaviour
  One option here is to use `Font2D` reference for comparison, but this needs to force font resolution before the comparison, and, I'm afraid, that would be too breaking a change. And if we cannot compare `Font2D` instances, we can only add some more state to `Font` object, either 'hidden' or made available via new API method(s).

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

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



More information about the client-libs-dev mailing list