views:

135

answers:

2

For a scientific application I want to design an input form which lets the user enter certain parameters. Some of them are designated using greek letters, some of them have latin letters. The parameter names should be displayed using ordinary JLabel controls.

On Windows, the Tahoma font (which is used for Labels by default) contains both latin and greek letters, so I simply set the Text property of the label to a greek (unicode) string and everything works fine.

I'm wondering if this works also without modifications on Linux and OSX systems resp. for which Java/OS versions this would work.

Also I'm curious if there's an easy way to show subscripts in labels ("\eta_0" in TeX), but this is not that important for my application ...

+4  A: 

I have no doubt that the vast majority of Unicode fonts includes the Greek block.

On all platforms, and for all locales.

When there are missing Unicode blocks, it's for space-saving concerns. The 50 or so characters in the Greek block is nothing compared with the thousands of east Asian characters (which my last Linux desktop actually included by default, btw).

Speaking of fancy Unicode: http://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts

Of course, despite any confidence that you or I may have, you should test your application on as many configurations as you can before deploying. Java tries its best, but in practice I've always found a few things that needed tweeking.

Gunslinger47
Thanks for the answer, I'll go on with this approach. Of course, I'll test it as soon as I have access to different target systems but I hope that there will be no bad surprises (how often has that been said??) :)
MartinStettner
+1  A: 

@Gunslinger47's answer is dispositive, but you might also look at this game on various target platforms. It displays glyphs from several Unicode character code charts, 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);
    ...
}
trashgod