Java 区域设置字体问题..?

发布于 2024-07-20 05:56:30 字数 439 浏览 2 评论 0原文

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

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

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

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

  2. 我能否检测到我的字体完全支持哪些区域设置,并仅在这些情况下设置它,而为所有其他情况(如 Locale.Japan)保留标准 Java 字体?

  3. 您还有其他建议吗?

感谢您的帮助!

[EDIT] this happend on OSX with Java 1.5! (but may also happen on Windows!)

It seems japanese users of my Java Swing program cannot write japanese symbols in JTextFields. Actually they can write them but do not see them. They only see blocks which somehow indicates I think that the font does not support these symbols.

I set my own font for various reasons ("Lucida Sans", Font.PLAIN, 12) - which I wouldn't like to change. My questions are:

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

  2. 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?

  3. do you have any other suggestions?

Thank you for your help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

本宫微胖 2024-07-27 05:56:30

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

很可能是因为 JRE 将选择默认值。

我能否检测我的字体完全支持哪些区域设置,并仅在这些情况下设置它,而为所有其他情况(如 Locale.Japan)保留标准 Java 字体?

是的,理论上,尽管更容易使用 canDisplay(char) 方法。 如果没有,您可以切换到默认值。

您还有其他建议吗?

这里有一个关于此主题的链接可能会有所帮助

您有您的产品的链接吗?

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?

蓝梦月影 2024-07-27 05:56:30

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

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

  2. 我不知道有什么标准方法可以做到这一点。 我发现了一个用于调查此类事情的出色实用程序:BabelMap。 这将准确地告诉您任何给定字体支持哪些字符。

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

For this very reason, my internationalized application sets its font depending on the locale. To answer your questions:

  1. This probably depends on which version of Windows is being used. Is this the US edition with Japanese fonts installed, or is this the version sold in Japan? I don't know the exact answer to your question, but I expect that the answer is, "It depends."

  2. I don't know of any standard way to do this. I have found a wonderful utility for investigating this kind of thing: BabelMap. This will tell you exactly what characters are supported by any given font.

  3. Other suggestions: Set your font depending on Locale, at least for select Locales.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文