Skip to content

Terminal: Enable display of characters unsupported by chosen terminal font - #9797

Merged
matthiasblaesing merged 2 commits into
apache:masterfrom
matthiasblaesing:terminal_fonts_improvements
Nov 12, 2026
Merged

matthiasblaesing merged 2 commits into
apache:masterfrom
matthiasblaesing:terminal_fonts_improvements

Conversation

@matthiasblaesing

Copy link
Copy Markdown
Contributor

It was noticed that characters were sometime drawn as the "missing glyph". This is mostly noticable with modern terminal applications drawing progressbars and other more special glyphs.

Before:
Bildschirmfoto vom 2026-11-11 20-32-50
Bildschirmfoto vom 2026-11-11 20-38-11

After:
Bildschirmfoto vom 2026-11-11 20-34-33
Bildschirmfoto vom 2026-11-11 20-37-24

… font

It was noticed that characters were sometime drawn as the "missing
glyph". This is mostly noticable with modern terminal applications
drawing progressbars and other more special glyphs.


This is the same approach as taken in b5c194d:

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/*) ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Nov 11, 2026
@mbien

mbien commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

CI seems to be stuck here even before the "waiting for nodes" phase. Will try to cancel and restart it.

edit: cancel isn't working either :(

@apache apache locked and limited conversation to collaborators Nov 12, 2026
@apache apache unlocked this conversation Nov 12, 2026
@mbien mbien added this to the NB33 milestone Nov 12, 2026

@mbien mbien left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

changes look good.

I think this will now create a cascading font which falls back to another font on a per-symbol basis if a symbol isn't found, right?

old dev build (around NB 32 lvl):

image

this PR:
image

@matthiasblaesing

Copy link
Copy Markdown
Contributor Author

@mbien thanks for review. Indeed the composite font is created/used. That fix is transferred/adapted from matthiasblaesing@b5c194d

@matthiasblaesing
matthiasblaesing merged commit 7f771f7 into apache:master Nov 12, 2026
58 of 60 checks passed
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/*)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants