I'd like to choose the right font for the native language of the system I'm
running on.
Instead of:
if (language.equals(Locale.ENGLISH.getLanguage()))
{
fontName = "Arial";
}
else if ((language.equals(Locale.JAPANESE.getLanguage())) ||
(language.equals(Locale.CHINESE.getLanguage())) ||
(language.equals(Locale.KOREAN.getLanguage())))
{
fontName = "MS Gothic";
}
else
...
I'd like to say:
fontName = Locale.getDefault().getDefaultFont(), or somesuch.
Is there such a capability in Java?
-L
Jon Caldwell - 14 Jan 2005 14:44 GMT
> I'd like to choose the right font for the native language of the system I'm
> running on.
[quoted text clipped - 19 lines]
>
> -L
If you have an example of each type of text, perhaps Font's
"canDisplayUpTo" will do the trick:
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Font.html#canDisplayUpTo(java.l
ang.String)
Or maybe a single character from each may be sufficient:
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Font.html#canDisplay(char)