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!

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!

Thank you very much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.