GUI:如何确定是否支持某些Unicode字符?

时间:2022-07-07 20:19:10

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

我注意到,Metal L&F不支持Unicode中的某些箭头字符,而Nimbus和GTK L&Fs支持它们。

Unsupported characters are just displayed as: ...

不支持的字符只显示为:……

Can I

我可以

  1. either look up (manually), which L&F supports which Unicode chars,
  2. 可以查询(手动),L&F支持哪些Unicode字符,
  3. or find it out at runtime?
  4. 或者在运行时发现它?

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?"

编辑:或者,如果它只依赖于L&F的默认字体,我的问题可能应该是:“我如何查找,哪些Java字体支持哪些Unicode字符?”

3 个解决方案

#1


11  

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.

您可以使用canDisplay方法来测试java.awt。字体对象可以显示给定的字符。通常可以使用getFont()方法从GUI组件获取字体。

#2


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.

如果知道哪个unicode块包含所需的箭头,可以在这里查找。不幸的是,似乎没有一个新的JDK页面。

#3


0  

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

使用这段代码可以使用几乎所有的Unicode ta。setFont(新java.awt。字体(“Segoe UI Emoji”,1,20);

#1


11  

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.

您可以使用canDisplay方法来测试java.awt。字体对象可以显示给定的字符。通常可以使用getFont()方法从GUI组件获取字体。

#2


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.

如果知道哪个unicode块包含所需的箭头,可以在这里查找。不幸的是,似乎没有一个新的JDK页面。

#3


0  

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

使用这段代码可以使用几乎所有的Unicode ta。setFont(新java.awt。字体(“Segoe UI Emoji”,1,20);