954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Handling Chinese & Japanese characters

Hi everyone,

I've written a small program to convert combinations of English characters into their corresponding Chinese and Japanese equivalents, and it's working on my computer at home, so so far so good.

However, I'd also like it to work on computers which don't have Chinese or Japanese fonts installed, but I'm not sure how to go about doing this, or even if it's possible.

Is there a way to have the necessary Chinese/Japanese fonts contained within the Java program?

Any advice on how to start going about this would be a huge help!

jiraiya
Light Poster
29 posts since Mar 2010
Reputation Points: 10
Solved Threads: 0
 

I can't give you all the details, but in short: "yes".

When you package your app into a .jar file you can also put any truetype fonts you need in the same jar (subject to copyright etc, of course). You then read the font file and create the font in your app with something like:

InputStream in = getClass().getResourceAsStream("myTruetypeFont.ttf");
Font myTruetypeFont= Font.createFont(Font.TRUETYPE_FONT, in);
in.close();

Hope this helps. Good luck!

JamesCherrill
Posting Genius
Moderator
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
 
moutanna
Posting Whiz
387 posts since Oct 2009
Reputation Points: 16
Solved Threads: 58
 

Thank you very much!

jiraiya
Light Poster
29 posts since Mar 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You