Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor: Enable display of characters unsupported by chosen editor font #7753

Merged
merged 1 commit into from
Oct 12, 2024

Conversation

matthiasblaesing
Copy link
Contributor

It was noticed, that in some contexts Swing was able to display characters unsupported by the currently chosen font. The problem was observed with emojis. Investigation showed, that the problem appears if a font is explicitly constructed via the constructor, but vanishes if the font is accessed via StyleContext#getFont.

The difference is that StyleContext#getFont returns a CompositeFont, that fallsback to other fonts for undefined glyphs.

As CompositeFont is located in the sun.font package, it can't be accessed directly. Instead the font acccess via the DefaultStyleContext is used.

Before:
Bildschirmfoto vom 2024-09-15 17-27-56

After:
Bildschirmfoto vom 2024-09-15 17-35-26

It was noticed, that in some contexts Swing was able to display
characters unsupported by the currently chosen font. The problem was
observed with emojis. Investigation showed, that the problem appears if
a font is explicitly constructed via the constructor, but vanishes if
the font is accessed via StyleContext#getFont.

The difference is that StyleContext#getFont returns a CompositeFont,
that fallsback to other fonts for undefined glyphs.

As CompositeFont is located in the sun.font package, it can't be
accessed directly. Instead the font acccess via the DefaultStyleContext
is used.
@matthiasblaesing matthiasblaesing added Platform [ci] enable platform tests (platform/*) UI User Interface ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Sep 15, 2024
@apache apache locked and limited conversation to collaborators Sep 15, 2024
@apache apache unlocked this conversation Sep 15, 2024
@mbien mbien added this to the NB24 milestone Sep 16, 2024
@matthiasblaesing
Copy link
Contributor Author

I intent to merge this next weekend. If anyone wants to object, now would be a good time.

Copy link
Member

@mbien mbien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember testing this and it worked, must have forgotten to approve the PR

@matthiasblaesing matthiasblaesing merged commit 01a871f into apache:master Oct 12, 2024
32 checks passed
@matthiasblaesing matthiasblaesing deleted the fix_fallback_font branch October 18, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Platform [ci] enable platform tests (platform/*) UI User Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants