katakana + unicode

Accordingly to http://www.chedong.com/tech/hello_unicode.html and other sources Katakana has the unicode range of \u30A0 - \u30FF.

However… I just get squares (missing characters)… but I thought that Java uses quite complete unicode fonts by default.

I even installed japanese fonts for my system and my browser (firebird) displays em correctly now. But it still doesn’t work with Java.

So… is there something I’d forgotten? (eg do I have to use another font than Swing’s default font?)

I think the default font that is used is for most components is ‘dialog’, which maps to Arial in windows. The Arial I have on my system only contains Latin, Greek and Arabic characters. No Japanese ones. So like you already mentioned, I think you will need to use another font than the default one.

Thanks for your reply pepijnve :slight_smile:

But I still hadn’t figured out what I have to do…

So if anyone has some hints or ideas please let me know.

You just have to get yourself a ttf font that actually has the glyphs in it.

Cas :slight_smile:

http://www.alanwood.net/unicode/fonts.html

Thanks pepijnve and cas :slight_smile:

Kinda works…

Font font=new Font(“MS Gothic”,Font.PLAIN,12);
String testStr=new String("\u30A1\u30A2\u30A3");
JLabel testLab=new JLabel(testStr);
testLab.setFont(font);

Well… I have that font, but it’s absolutly useless if it doesn’t work out of the box :-/

It’s purely an operating system problem, not a Java problem. If the OS isn’t localized for Japanese then you can hardly expect it to be able to render Japanese characters. (Which, on a related note, would get you the appropriate fonts - go to a Japanese site and IE prompts you whether you want to install the Japanese language support).

Cas :slight_smile:

I don’t fully agree with you this time, cas.

What’s the meaning of having that unicode/i18n stuff if we can’t use it (to it’s full extend)?

The JRE is shipped with a bunch of fonts… why don’t they include some with more glyphs?

Dunno… that makes me really angry. I thought that Java is a bit more open minded in that area. Why do we have unicode anyways? ASCII is good enough for english :-/

Sorry for ranting, but it’s so brainless and stupid that I even got a headache. It’s as stupid as the region code stuff of DVDs… I really hate artificial language barriers.

afaik, java uses the OS installed fonts… - no fonts of it own (except a Lucide font).

[quote]afaik, java uses the OS installed fonts… - no fonts of it own (except a Lucide font).
[/quote]
/jre/lib/fonts

LucidaBrightDemiBold.ttf
LucidaBrightDemiItalic.ttf
LucidaBrightItalic.ttf
LucidaBrightRegular.ttf
LucidaSansDemiBold.ttf
LucidaSansRegular.ttf
LucidaTypewriterBold.ttf
LucidaTypewriterRegular.ttf

Having a kinda complete font instead of those would make more sense.

And who’s going to pay for the fonts? - they’re not free you know…

Just a wild guess, but maybe you could install a font at runtime? For examply by copying a font file in your font directory (you can get the runtime installation directoy using System.getProperty(“java.home”)).
Maybe there’s more to it than that or not even possible at all, but worth a try I guess.

[quote]And who’s going to pay for the fonts? - they’re not free you know…
[/quote]
Ofcorse I know. But we are talking about a big company wich has a slightly bigger budget as everyone here…

And there is also a japanese version of the SDK
http://java.sun.com/j2se/1.4.2/ja/download.html

So most likely they already own (licensed) such a font.

@erikd

Thanks for the idea, but I can’t do that. I can’t pay a font and it would add to much to the download size.


Ah well… maybe with 1.5… I mean… it’s all there (basically) and it could be worse (as in python), but it’s just a one-way-road right now.

Images for text stuff… oh that feels so great :stuck_out_tongue: