Selecting a font to generate a PDF with Chinese characters on Android

135 views
Skip to first unread message

Support

unread,
Mar 6, 2013, 5:01:15 PM3/6/13
to pdfne...@googlegroups.com
Q:
 
When I generate the PDF using PDFNet SDK for Android, there are some Chinese characters that could not be shown normally. Is it the limitation of the library or is there anything that I implemented wrong? You could reach the attachment for my demo code.  
 
Font fnt = Font.create(doc.getSdfObj(), "Arial Unicode", "Hello World! 官话 北方话");
 
see the attached file for full test code.
 
-----------------------
A:
 

Is "Arial Unicode" present in your system/device? Your code is correct, but there are some points you must take into account. When you pass "Arial Unicode" the SDK will try to use this font (it can be embedded or not). If this is not the case (ie, Arial Unicode is not embedded nor available in the system), the SDK will *try* to find a font in the system that matches the set of characters you passed in the function. This does not always return a font that covers all characters, since you may use different characters in the text that were not passed in the function, or the fonts available have partial coverage. Finally, if the SDK does not find any fonts, it will fallback to one of the internal fonts of the SDK.

 

In my tests I don't get all the characters when using "Arial Unicode", but if I use "DroidSansFallback" it works fine.

PDFUtil.java
Reply all
Reply to author
Forward
0 new messages