Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] FontSelector and Asian text

Jason Gritman

2007-08-10

Replies:

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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
©2008 junlu.com - Jax Systems, LLC, U.S.A.