views:

62

answers:

3

Not long ago I asked a question attempting to identify a certain unicode character for use in a GUI. I got the character I was looking for, but it didn't work in the Swing GUI I was building.

So, SO Community, I pose of you these questions:

What sort of limitations does Swing/Java have for Unicode support? Are there certain subsets of unicode that are completely supported and what should I stay away from when designing in the future?

EDIT: After applying the 'Arial Unicode MS' font as suggested by Alan Moore, everything seemed to clear up. Seems odd that I should have to set a 3rd party font to make all the unicode characters show up though.

+4  A: 

Normally when glyphs don't display properly in a UI, it's because you're using a font that doesn't have that glyph, not because there is a problem with the unicode support in any toolkit you're using. Very, VERY few fonts have all glyphs - you need to make sure you choose a font that has coverage in the code points you care about.

Nick Bastin
A: 

Java 1.6 should have support for all Unicode characters. IIRC 1.5 didn't have methods to handle multi-char UTF-16 characters (new APIs were added to 1.6).

The characters from the question you posted show up just fine in the Java editor I use. Make sure the font you're using supports that character; the built-in JDK fonts support a lot of characters, but definitely not all. Take a look at the java.awt.Font.canDisplay() methods.

vanza
1.5 added support for Unicode 4.0, while 1.6 enhanced unicode regexps but is otherwise unchanged. Every version of Java has had complete unicode character set support for the version of unicode that was current at the time. (There were a couple small bugs in 1.4.2 with bound latin-b and arabic presentation forms-b)
Nick Bastin
+2  A: 

See Sun Java 6 fonts Supported Fonts for details on the limitations of the logical fonts. Sun's choices were probably due to a mixture of pragmatism and licensing. Note that the documentation says you can provision fallback fonts by adding them to the JRE lib/fonts/fallback directory.

McDowell
FYI: see the _Java Internationalization FAQ_ for more info: http://java.sun.com/javase/technologies/core/basic/intl/faq.jsp
McDowell