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!

6 Years
Discussion Span
Last Post by jiraiya

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);

Hope this helps. Good luck!

This question has already been answered. Start a new discussion instead.
Be sure to adhere to our posting rules.