Hello all,
I have a question regarding using the FontSelector with the
CJK support.
I’m retrieving data from a database in UTF-8 format
which may be Chinese or Japanese. I’ve created a FontSelector to
handle this text:
FontSelector selector =
new FontSelector();
selector.addFont(FontFactory.getFont(FontFactory.HELVETICA, size, style));
selector.addFont(FontFactory.getFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED, size, style));
selector.addFont(FontFactory.getFont("MSung-Light", "UniCNS-UCS2-H", BaseFont.NOT_EMBEDDED, size, style));
selector.addFont(FontFactory.getFont("HeiseiMin-W3", "UniJIS-UCS2-H", BaseFont.NOT_EMBEDDED, size, style));
However, when the text is Japanese, it’s still using
the Chinese font (ex selector.process(“\u0420\u0430\u0431\u043e\u0442\u0430”);).
Is there a way based on just the unicode string that I can determine the correct
font to use?
Thanks!
-Jason Gritman