ASPOSE issue:
Hi,
As .net6 is going out of support this November we started migrating to net8. Our AWS Lambda function that creates PPTX slides worked fine on dotnet6 runtime but once we moved to dotnet8 we started to get exception:
{
"errorType": "InvalidOperationException",
"errorMessage": "Cannot find any fonts installed on the system.",
...
}
I’ve added fontconfig layer to make sure we have fonts but that didn’t worked.
I’ve added loading external font files but that didn’t worked.
I’ve added some debug output to narrow it down:
// Load fonts
var fontsDirectory = "./Fonts/";
FontsLoader.LoadExternalFonts([fontsDirectory]);
FontsLoader.LoadExternalFont(File.ReadAllBytes($"{fontsDirectory}tahoma.ttf"));
var loadOptions = new LoadOptions(LoadFormat.Auto)
{
DefaultRegularFont = "Tahoma"
};
_presentation = new Presentation(loadOptions);
// list all the fonts
var allFonts = FontFamily.Families;
Console.WriteLine($"All fonts (total:{allFonts.Length}):");
foreach (var font in allFonts) Console.WriteLine(font.Name);
// list all the files in the fonts directory
var files = Directory.GetFiles(fontsDirectory);
Console.WriteLine($"Fonts directory: {fontsDirectory}");
foreach (var file in files) Console.WriteLine(file);
// list ASPOSE fonts
var fonts = _presentation.FontsManager.GetFonts();
Console.WriteLine($"Fonts (total:{fonts.Length}):");
foreach (var font in fonts) Console.WriteLine(font.FontName);
The result was:
Screenshot 2024-08-21 at 18.44.08.png (119.8 KB)
- .NET build in method listed available fonts (13 in total)
- External font file is present (.Fonts/tahoma.ttf)
- Loading fonts from the directory and manually does not load any font. (0 in total)
We are using “Aspose.Slides.NET6.CrossPlatform” Version=“24.8.0”. I’ve tested our solution on custom docker image (using official Microsoft dotnet8 base) and there is no issue generating presentation but the _presentation.FontsManager.GetFonts() also returns empty array.