Nunito Sans font installed in OS is not used when converting .docx into .pdf

Hi,

I am using the Nunito Sans font
NunitoSans_10pt-Regular.zip (52.7 KB) in my docx, nunito_sans_no_fonts_embedded.docx (14.2 KB) where I haven’t embedded the font, instead I have installed the font on OS level.

When converting the .docx to .pdf using Aspose, I get the following where wrong font is used:
nunito_sans_no_fonts_embedded.pdf (15.4 KB)

When I do embed the font in the .docx: nunito_sans_embedded.docx (226.8 KB) after converting to PDF I get correct PDF with the correct font: nunito_sans_embedded.pdf (11.9 KB)

So the question is why Aspose doesn’t see the font, which is correctly installed in Windows (OS), since when I open the .docx without embedded font, Word does show the text in correct font.

My code looks something like:

Document doc = new Document(docxStream, getDefaultLoadOptions());
doc.save(output, getPdfSaveOpts(pdfSettings));

@avandenhoogen Most likely the problem occurs because the font is not properly installed or is not accessible. If Aspose.Words cannot find the fonts used in the document the fonts are substituted. This might lead into the layout differences due to differences in fonts metrics. You can implement IWarningCallback to get a notification when font substitution is performed.
The following articles can be useful for you:
https://docs.aspose.com/words/java/specify-truetype-fonts-location/
https://docs.aspose.com/words/java/install-truetype-fonts-on-linux/

I put the font into separate folder and used the following code for tesintg:

Document doc = new Document("C:\\Temp\\in.docx");
doc.setWarningCallback(new FontSubstitutionWarningCollector());
doc.setFontSettings(new FontSettings());
doc.getFontSettings().setFontsSources(new FontSourceBase[] { new SystemFontSource(), new FolderFontSource("C:\\Temp\\fonts", true) });
doc.save("C:\\Temp\\out.pdf");
private static class FontSubstitutionWarningCollector implements IWarningCallback {
    public void warning(WarningInfo info) {
        if (info.getWarningType() == WarningType.FONT_SUBSTITUTION) {
            System.out.println(info.getDescription());
        }
    }
}