Greek / Latin Scientific JLabel in Java Swing Application
For a scientific application, I want to create an input form that allows the user to enter certain parameters. Some of them are designated by Greek letters, some of them have Latin letters. Parameter names should be displayed using normal controls JLabel
.
On Windows, the Tahoma font (which is the default for shortcuts) contains both Latin and Greek letters, so I just set the Text property of the label to a Greek (unicode) string and everything works fine.
I am wondering if this also works unchanged on Linux and OSX systems, respectively. for which it will work with Java / OS versions.
Also I'm curious if there is an easy way to show indexes in labels ("\ eta_0" in TeX), but this is not that important for my application ...
a source to share
I have no doubt that the vast majority of Unicode fonts include a Greek block.
On all platforms and locales.
When Unicode blocks are missing, it is for space conservation issues. 50 or so characters in a Greek block is nothing compared to the thousands of East Asian characters (which my last Linux desktop actually included by default, by the way).
Speaking of fantastic Unicode: http://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts
Of course, although you or I have confidence, you should test your application for as many configurations as you can before deploying. Java does its best, but in practice I've always found a few things that required tweeking.
a source to share
@ Gunslinger47's answer is dispositive, but you can also watch this game on different target platforms. It displays glyphs from several Unicode character codes, including Greek.
enum GlyphSet {
ASCII(0x0021, 0x007E), Greek(0x0370, 0x03FF), Letters(0x2100, 0x214F),
Operators(0x2200, 0x22FF), Miscellany(0x2300, 0x23FF), Borders(0x2500, 0x257F),
Symbols(0x2600, 0x26FF), Dingbats(0x2700, 0x27BF), Arrows(0x2900, 0x297F);
...
}
a source to share