Fonts on Mono/OSX

Testing on an asp.net application in Mono/OSX/Sierra with Aspose Slides version 17.7.

If I create a blank PPTX (single slide, containing a single shape only) in powerpoint on OSX, then try the following:

Presentation sourcePPT = new Presentation(filePath);
for (var i = 0; i < sourcePPT.Slides.Count; i++)
{
    Image image = sourcePPT.Slides[i].GetThumbnail(1f, 1f);
    image.Save($"Media/Thumbs/{i}.png", ImageFormat.Png);
}

I receive the error: “Cannot find any fonts installed on the system.”

I then tried explicitly defining the font location:

FontsLoader.LoadExternalFonts(new string[] { "/Library/Fonts" });
Presentation sourcePPT = new Presentation(fileInfo.FullName);
for (var i = 0; i < sourcePPT.Slides.Count; i++)
{
    Image image = sourcePPT.Slides[i].GetThumbnail(1f, 1f);// SaveAsImage();
    image.Save($"Media/Thumbs/{i}.png", ImageFormat.Png);
}

And receive the error: “An item with the same key has already been added.”:

in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/throwhelper.cs:72 at System.Collections.Generic.Dictionary2[TKey,TValue].Insert (TKey key, TValue value, System.Boolean add) [0x0007c] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:336 at System.Collections.Generic.Dictionary2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:192 at Aspose.Slides.FontsLoader.

I presume I receive this second error because it is already aware of the fonts in the /Library/Fonts path. But then I don’t understand why I’m receiving the first error.

I also tried copying all fonts in /Library/Fonts to a new directory, and setting that directory in LoadExternalFonts but that produced the same error.

The fonts under /Library/System are whatever the default are on a new OSX Sierra machine (it’s a clean install from a few days ago)

Can you help?

@pfrew,

I have observed your comments. Can you please provide sample project and source fonts that you are using on your end so that i may further investigate to help you out.

Hi,

Here is a link to download the solution: https://www.sendspace.com/file/mqa60x

This is a asp.net mono console project, built in Visual Studio Express for OSX. If compiling, you’ll need to re-add the the aspose slides package, as I removed that to reduce the filesize.

There are no fonts (or text) in the presentation I’m testing. It’s just a single slide with some shapes inside. I get the same exceptions regardless. I included this presentation in the bin folder (/bin/release).

@pfrew,

I have observed your comments and like to share that copying all from from Fonts directory and pasting them to target directory and loading that target directory using LoadExternalFonts will not help. You need to make sure that you need to make those fonts available in custom font loading directory that have actually been used in your presentation. Can you please make sure if all fonts used in your presentation are available on your end.

There is no text/fonts in the presentation I’m testing (available in download above).

@pfrew,

We are sorry for your inconvenience. An issue with ID SLIDESNET-39185 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed.