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

Free Support Forum - aspose.com

Font Was Changed after Loading on Linux

Hi,
I faced a font-changing issue with Aspose.Slides .Net 5.0 version 21.10 on Linux. In the sample file, the font is PMingLiU, but after loading and saving, the font of the output file is changed to Arial. I used FontsLoader.LoadExternalFonts to load the PMingLiU from a custom folder, but the issue was still there. Can you investigate and give me advice? font_changed.zip (8.4 MB)

Thanks.

@dunghnguyen,
Thank you for contacting support.

Unfortunately, I was unable to reproduce the problem you described. Please share screenshots with the expected result.

This is screenshot: image.png (123.6 KB)

In the attached zip, I included the original file and the processed file. Can you check it again?
Thanks.

@dunghnguyen,
I have tested the case you described using the FontsLoader.LoadExternalFonts method and without one on Windows 10 and Ubuntu 18.04. I got the same results for all experiments, the PMingLiU font did not change. We need more information on how to reproduce this case.

Hi @Andrey_Potapov
I can reproduce the issue on env: Ubuntu 18.04 WSL2, .Net 5.0, Aspose.Slides 21.10, msttcorefonts installed, libgdiplus 6.0.5 installed. I just run the sample application in the attached zip.
Can you instruct me how to debug to verify the font loading is correct when opening the ppt file?

For more information, when I’m running this snippet:
using (var presentation = new Presentation(inFile))
{
foreach (var font in presentation.FontsManager.GetFonts())
{
Console.WriteLine(font.FontName);
}
SaveFormat format = SaveFormat.Ppt;
presentation.Save(tempFile, format);
}
the font name list is:
Arial
新細明體
Wingdings
Calibri
Times New Roman

Another point, when I debug the processing with the attached sample, the result as this screenshot image.png (49.1 KB)
the info of LatinFont, EastAsiaFont, SymbolFont are null. So I think the font was fallback to Arial when saving ppt. Is it correct and expected?

@dunghnguyen,
Please check messages about font substitutions by using a warning callback as shown below:

var loadOptions = new LoadOptions();
loadOptions.WarningCallback = new FontWarningHandler();

FontsLoader.LoadExternalFonts(new string[] { "font" });

using (var presentation = new Presentation(inputFilePath, loadOptions))
{
    presentation.Save(outputFilePath, SaveFormat.Ppt);
}

More details: Getting Warning Callbacks for Fonts Substitution
API Reference: IWarningCallback Interface

I was tried with the code snippet in Getting Warning Callbacks for Fonts Substitution page and saved the thumbnails. I don’t see any warning about the font, but the result images have different font and layout with the input ppt file. image.png (260.1 KB)

@dunghnguyen,
Could you please specify the version of PowerPoint which are used to open the PPT files?