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

Free Support Forum - aspose.com

Font altName is removed after saving on Linux/Mac

I have
issues with font substitutions on Linux and Mac. When saving a docx file, the embedded altName is removed. The problem is that we read and write files multiple times and we need a stable substitution. This bug is not reproduced on windows.

BugShiftedBoxes - Copy.zip (18.8 KB)

var fileName = "BugShiftedBoxes - Copy.docx"
using (var file = new FileStream(fileName, FileMode.Open))
{
    var doc1 = new Document(file);
    Console.Out.WriteLine("Original");
    Console.Out.WriteLine(doc1.FontInfos[5].Name);
    Console.Out.WriteLine(doc1.FontInfos[5].AltName);
// Interstate Light
// Calibri

    var docxStream = new MemoryStream();
    doc1.Save(docxStream, SaveFormat.Docx);

    Console.Out.WriteLine("Original after saving (same object)");
    Console.Out.WriteLine(doc1.FontInfos[5].Name);
    Console.Out.WriteLine(doc1.FontInfos[5].AltName);
// Interstate Light
// Calibri

    var doc2 = new Document(docxStream);
    Console.Out.WriteLine("Read (substitution disappeared)");
    Console.Out.WriteLine(doc2.FontInfos[5].Name);
    Console.Out.WriteLine(doc2.FontInfos[5].AltName);
// Interstate Light
// <none>
}

If I run the production code, I get the following output:
Font substitution: Font ‘Interstate Light’ has not been found. Using ‘Calibri’ font instead. Reason: alternative name from document.
Font substitution: Font ‘Interstate Light’ has not been found. Using ‘Liberation Sans’ font instead. Reason: font info substitution.

@oleksii.pokotylo.pwc.com

In case you are using old version of Aspose.Words, we suggest you please try the latest version of Aspose.Words for .NET 19.11. Hope this helpsyou.

Please note that Aspose.Words requires TrueType fonts when rendering document to fixed-page formats (JPEG, PNG, PDF or XPS).

The shared code example does not generate these warnings. Could you please share the code example along with document that you are using to reproduce this issue at our end? We will investigate the issue and provide you more information on it.

Thanks, it works with 19.11.

@oleksii.pokotylo.pwc.com

Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.