GUI: How can I find out if certain Unicode characters are supported?
Asked Answered
H

3

15

I noticed that Metal L&F doesn't support certain arrow characters from Unicode, while Nimbus and GTK L&Fs do support them.

Unsupported characters are just displayed as: ...

Can I

  1. either look up (manually), which L&F supports which Unicode chars,
  2. or find it out at runtime?

EDIT: Or, should it only depend on the L&F's default font, my question perhaps should be:
"how do I find out, which Java font supports which Unicode characters?"

Halland answered 29/12, 2010 at 20:29 Comment(2)
I'm not an expert, but it may be due to the default font Metal/Ocean uses.Bedspring
I am very certain it's the font that determines which characters are supported.Upbraiding
A
15

You can use the canDisplay method to test if a java.awt.Font object can display a given character. You can typically get the font from GUI components using the getFont() method.

Anstice answered 29/12, 2010 at 22:45 Comment(1)
Great! That's it! download.oracle.com/javase/6/docs/api/java/awt/…Halland
D
2

If you know which unicode block contains the arrows you need, you can look it up here. Unfortunately there doesn't seem to be a page for newer JDK's.

Discard answered 29/12, 2010 at 21:5 Comment(1)
Unfortunately, the link is now broken.Densify
G
1

Using this piece of code you use almost every Unicode ta.setFont(new java.awt.Font("Segoe UI Emoji", 1, 20));

Guelph answered 16/5, 2016 at 4:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.