Font Formatting and Styling Issue After Upgrading Aspose.Words

Hello Aspose Team,

We have encountered an issue after upgrading Aspose.dll from version 22.5.0 to 25.6.0 in our application.

Environment Details:

  • Aspose.Words.dll: Upgraded from 22.5.0 → 25.6.0

  • Aspose.Cells.dll: Upgraded from 22.5.0 → 25.6.0

  • Aspose.Imaging.dll: Upgraded from 22.9.0 → 25.6.0

  • Aspose.Pdf.dll: Upgraded from 22.5.0 → 25.6.1

  • Aspose.Slides…NET.dll: Upgraded from 22.5.0 → 25.6.0

  • Target Framework: .NET Core 3.1

Expected Result:
PDF output should preserve the exact font family, size, and styling from the source DOCX document.

Actual Result:
After upgrading to version 25.6.0, the generated PDF changes fonts (e.g., substituted font family, incorrect weight, and spacing). The same document produces correct output in version 22.5.0 without any code changes.

I have attached:

Screenshot comparing the differences

Could you please investigate and confirm if this is a known change in font handling for the newer version, or advise if additional configuration is required to preserve the original formatting?

Thank you for your assistance.

@Akshay_Mote

It sounds like you’re experiencing font formatting issues after upgrading to Aspose.Words version 25.6.0. This can occur due to changes in how fonts are handled in the newer version, leading to substitutions or alterations in font appearance.

Cause: The issue may arise from missing fonts on the system where the PDF is being generated, as Aspose.Words will substitute unavailable fonts with similar ones, resulting in differences in appearance.

Solution: Here are some steps to troubleshoot and resolve the issue:

  1. Check Font Availability: Ensure that the fonts used in your DOCX document are installed and accessible on the system generating the PDF. If the required fonts are not available, Aspose.Words will substitute them.

  2. Font Settings Configuration: Configure the FontSettings class to specify custom font sources. This helps Aspose.Words locate the correct fonts. Here’s an example:

    FontSettings fontSettings = new FontSettings();
    fontSettings.SetFontsSources(new FontSourceBase[]
    {
        new SystemFontSource(),
        new FolderFontSource("C:\\MyFonts\\", true)
    });
    Document doc = new Document("input.docx");
    doc.FontSettings = fontSettings;
    doc.Save("output.pdf");
    
  3. Check for Warnings: Implement the IWarningCallback interface to capture any font substitution warnings during document processing. This will provide insights into which fonts are being substituted and why.

  4. Review Release Notes: Check the release notes for version 25.6.0 for any documented changes related to font handling that might affect your documents.

  5. Fallback Settings: If you are using specific fonts that may not be available on all systems, consider using font fallback settings to ensure that characters are rendered correctly even if the primary font is not available.

Next Steps: If you continue to face issues, please provide a sample document that demonstrates the problem, and I will assist you further.

Let me know if this helps!

@Akshay_Mote Could you please attach your problematic input and output documents here for testing? We will check the issue and provide you more information.

Usually, the such problems occur because the fonts used in your input document are not available on the machine where document is converted to PDF. The fonts are required to build document layout. If Aspose.Words cannot find the font used in the document, the font is substituted . This might lead into fonts mismatch and document layout differences due to the different fonts metrics. You can implement IWarningCallback to get notifications when font substitution is performed.
Please see our documentation to learn where Aspose.Words looks for fonts:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/