Display text with characters from multiple languages

Hi,

I am using PDF Java library with version 23.9. I have a question regarding how to display a text with characters from multiple languages. Here is a quick example:

Document document = new Document() ;
Page page = document.getPages().add() ;
		
TextFragment frag = new TextFragment("Hello World测试") ;
page.getParagraphs().add(frag) ; 
		
document.save("fontTest.pdf") ;	
document.close() ;

The Chinese characters will be displayed as squares in the resulting PDF files. Is there a way that different fonts will be automatically picked to display characters from different languages, so that we do not need to specify the proper fonts ourselves?

@stata

In such cases, you need to make sure that the font that supports maximum language characters is present and installed in the system e.g. Arial Unicode MS. We tested in our environment with the mentioned font present and issue did not occur.

fontTest.pdf (174.2 KB)

Hi,

Thank you for your response. Indeed, Arial Unicode MS font contains a larger group of glyphs. However, it cannot cover all the Unicode characters, such as U+051E. I am wondering whether there is a way that the library can use multiple fonts automatically to display a text that contains characters from multiple languages. For example, it uses Helvetica for ASCII characters, and uses Arial Unicode MS for Chinese characters, and finally it automatically picks up another font for other characters that Arial Unicode MS that cannot display.

@stata

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-56287

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.