Free Support Forum - aspose.com

Paragraph line space incorrect after adding ttc font in font folder

Hi,

I use the following code to do mail merge and convert to PDF file.

Document document = new Document("resources/doc/template_001.docx");

FontSettings fontSettings = FontSettings.getDefaultInstance();

fontSettings.setFontsFolder("additional/fonts", true);

document.setFontSettings(fontSettings);

document.getMailMerge().execute(new String[]{"fullname", "company", "address", "address2", "city"},
		new Object[]{"FullName", "Company", "Address", "Address2", "City"});

document.save("resources/out/pdf/template_001.pdf");

sample.zip (46.5 KB)

I found something weird. If I add any true type collection file (ex: msjh.ttc, msjhl.ttc, msjhbd.ttc from Microsoft Windows 10) in the additional font folder. The line space of paragraph will not be correctly formatted.

Please check the attached

  1. template_001.docx: the template of the word document for mail merging and converting
  2. template_001_without_ttc: not put any ttc file in “additional/fonts” folder, the line spacing is matching with the original word template.
  3. template_001_with_ttc: put any ttc file in “additional/fonts” folder, the line spacing doesn’t format correctly.

Can you fix the problem? Thanks for help.

@fubon.com

Thanks for your enquiry. Kindly add ‘Calibri’ font in ‘additional/fonts’ folder because Aspose.Words requires TrueType fonts to render document to fixed-page formats.

Please refer to the following article about using fonts in rendering documents.

Specifying Multiple Font Folders

Hi,

I following the instruction to add ‘Calibri’ font to ‘additional/fonts’ to test PDF file. The result is the same. If the ‘additional/fonts’ folder include any ttc file, the line spacing will be incorrect. Due to the program will deploy to linux environment and will not install the extra fonts to system font folder. We have to put all fonts in additional font folder, and assign the font folder as the only source of fonts. Please help to check ttc font issue. Thanks for your help.

@fubon.com

Please zip and attach additional fonts folder here for our testing. We will investigate the issue and provide you more information.

Hi,

The attached ttc fonts is from Microsoft Windows 10 Traditional Chinese version. Put any of the ttc font in ‘additional/fonts’ will cause line spacing format incorrectly. Thanks for your help.

msjhbd.zip (8.9 MB)
msjhl.zip (7.3 MB)

@fubon.com,

Please first check the following article:
How to Receive Notification of Missing Fonts and Font Substitution during Rendering

If you receive missing font warnings, then you need to place those missing fonts in your fonts folder. Hope, this helps.

Hi,

After add font substitution rule in the program. The line spacing can be correctly formatted. Thanks for your help.

@fubon.com,

It is great you were able to find what you were looking for. Please let us know any time you have any further queries.