3

[编辑] 这发生在带有 Java 1.5 的 OSX 上!(但也可能发生在 Windows 上!)

我的 Java Swing 程序的日语用户似乎无法在 JTextFields 中编写日语符号。实际上他们可以写它们但看不到它们。他们只看到以某种方式表明我认为字体不支持这些符号的块。

我出于各种原因设置了自己的字体(“Lucida Sans”,Font.PLAIN,12)——我不想改变。我的问题是:

  1. 如果我不设置此字体,JTextFields 会显示日文符号吗?

  2. 我是否可以检测到我的字体完全支持哪些语言环境并仅在这些情况下设置它,但为所有其他情况(如 Locale.Japan)保留标准 Java 字体?

  3. 你有什么其他的建议?

谢谢您的帮助!

4

2 回答 2

3

would the JTextFields show japanese Symbols without me setting this Font?

Most likely since the JRE will choose the default.

could I detect which Locale's are fully supported by my Font and only set it in those cases but leave the standard Java font for all other cases like Locale.Japan?

Yes, in theory, although easier would be to test if this font can display a locale specific character using the the canDisplay(char) method in Font. If it don't, you may switch to the default.

do you have any other suggestions?

Here's a link on this topic that may help

Do you have a link for your product?

于 2009-05-21T22:48:40.173 回答
2

正是出于这个原因,我的国际化应用程序根据语言环境设置其字体。要回答您的问题:

  1. 这可能取决于所使用的 Windows 版本。这是安装了日文字体的美国版,还是在日本销售的版本?我不知道你的问题的确切答案,但我希望答案是,“这取决于。”

  2. 我不知道有任何标准方法可以做到这一点。我发现了一个很好的工具来调查这种事情: BabelMap。这将准确地告诉您任何给定字体都支持哪些字符。

  3. 其他建议:根据区域设置设置字体,至少对于选择区域设置。

于 2009-05-21T22:26:16.490 回答