We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Word to PDF with SimSun font

Hi,


I am trying to convert a file with Chinese characters to PDF. The source document is a Word doc created on a Mac. The rendering is happening on Linux. The PDF is showing block characters for some of the characters in the document. The three attachments show the source document, and the PDF when converted on the Mac and on the Linux box.

I am guessing that on Linux, the font substitution is not grabbing a font that has the required characters. Is there a way for me to determine what substitution is happening? Any suggestion of a font that can cover the character set? I have installed Google’s Noto fonts but that has not helped.

Thanks

Ok, I found out how to determine what font substitutions are happening. Now to see if I can change the substitution.

Adding a callback, I am seeing this on the font substitution:


Font substitution: Font ‘SimSun’ has not been found. Using ‘النيل’ font instead. Reason: first available font.

I have added the following line to the code:
com.aspose.words.FontSettings.getDefaultInstance().setDefaultFontName(“Noto Sans CJK SC”);
but that does not seem to be picked up.

Turns out if I specify a full font name, it works. For example:


Is there a way to not have to specify “Regular” but rather have the system determine font weight?
com.aspose.words.FontSettings.getDefaultInstance().setFontSubstitutes(“SimSun”, “Noto Sans CJK SC Regular”);

Hi Shawn,

Thanks for your inquiry. Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts that are used in your document on the machine where you're converting documents to Pdf. Please refer to the following articles:

How Aspose.Words Uses True Type Fonts

Please read the members of FontSettings class. You can specify the font's sources or folders using FontSettings.SetFontsSources and FontSettings.SetFontsFolders methods to achieve your requirements. You may use FontSettings.SetFontSubstitutes method to override substitute (alternative) font names for given original font name.

Please let us know if you have any more queries.