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

Free Support Forum - aspose.com

List of Fonts Applied on a Presentation

Hi,

When we use aspose to extract thumbnails from the slides, what decides the font of the content in the image.

Consider the following snippet:

for (int i = 0; i < m_Presentation.Slides.Count; i++)
{
    var thumbnail = m_Presentation.Slides[i].GetThumbnail(1, 1);
    var outPath = "pathtofile" + "snapshot_slide_" + (i + 1) + ".png";
    thumbnail.Save(outPath, ImageFormat.Png);
}

Kindly Apply this snippet on any presentation containing text, Windows 10 .NET Framework 4.
Any presentation has a lot of fonts defined inside along with fallback fonts.

  • Will Aspose reflect all the fonts used in presentation or

  • is Aspose limited by a predefined set of fonts in our machine consuming the Aspose libraries.

  • Is Aspose limited by a internally defined (aspose) set of fonts ?

  1. If there is a predefined list of fonts that Aspose allows: could you share the list ?

  2. If there are API to add new fonts : could you share the API ?
    If there are API to exclude certain fonts completely from the presentation : could you share them?

  3. Could we also know the difference between fonts and embedded fonts in a presentation, they are mentioned often in the documentation ?

Regards,
Raman

@sraman,
Thank you for posting your questions.

Applying fonts when converting presentation slides to images is a complex process. First, it is checked whether a substitution font itself needs to be replaced if it is specified for some font in a presentation. Such a font can be replaced because, although it is available in the operating system, it does not contain the corresponding glyph for a character, for example. Based on a base font, or rather on the basis of its visual characteristics, character family, and language, a suitable table with candidate fonts is determined, from which we can get the desired character for replacement. Embedded fonts in the presentation are also taken into account. Further, a specific substitution font is selected in the following sequence:

  1. Fallback fonts are checked first if any.
  2. The default font specified in the ISaveOptions.DefaultRegularFont property is taken into account.
  3. The candidate fonts mentioned in the warning callback and selected as suitable by visual characteristics are taken into account.
  4. Special fonts are checked last, depending on which Unicode block the character is in.

Of all the fonts in the specified order, the first one is selected that is available and contains a glyph to replace the problem character if any. If no suitable font is found, the search continues among the system fonts.

Hi Andrey,

Does that mean aspose looks for fonts installed in the machine(that contains aspose.slides dll) ?
Is there a place where i can find definitions of embedded ,fallback,default, special font,substitution font.
I had gone through the article mentioned above before, but couldnt find the definitions.

Is font finding process same as the one followed in powerpoint ?
where can I find the corresponding fallback/special/substituion/embedded/default font for a presentation ?

Regards,
Raman

@sraman,
I will gather information for you and reply a little later.

@sraman,

Yes, Aspose.Slides uses system fonts from the operating system and applies replacement operations when a font is missed.

You can get the embedded fonts like this:

IFontData[] embeddedFonts = presentation.FontsManager.GetEmbeddedFonts();

You can specify the fallback, default, and substitution fonts. They will be searched for in accessible places (embedded fonts, system fonts, external fonts, etc.). Please share more information about your requirements if it does not help.

Aspose.Slides is developed according to ECMA-376 standards to produce the same results as in PowerPoint as much as possible.

You can specify the fonts by name. The fonts are selected from the embedded fonts, system fonts, and external fonts. The external fonts are specified like this:

FontsLoader.LoadExternalFonts(folders);

It would be great if you could describe your goals in more detail if that does not help.

Hi Andrey,

Thanks for the information.

  • what is the meaning of embedded ,fallback,default, special font,substitution font ?

  • After a presentation is loaded within Aspose, Is it possible to add a new font zip to the presentation not installed in the windows system ? After the font is loaded, will it be treated just like any other font ?
    Kindly note that we dont want to install certain font zip on windows, but just want to apply them to selective presentation.

Regards,
Raman

@sraman,

Please read the following articles:

If you have any questions, please write in more detail what specifically interests you.

You can add a font that is not installed in the operating system from a file into a presentation as shown below:

using var presentation = new Presentation("example.pptx");

var fontData = File.ReadAllBytes("my_font.ttf"); // from a local file
presentation.FontsManager.AddEmbeddedFont(fontData, EmbedFontCharacters.All);

presentation.Save("output.pptx", SaveFormat.Pptx);

After that, if the presentation contains some contents with the font, PowerPoint will display the contents correctly. The output documents will also display the font when exporting the presentation to PDF, images, etc.

API Reference: AddEmbeddedFont(byte[], EmbedFontCharacters) method

Hi Andrey,

Thanks for the code, that really helps. We found a similar snippet using external fonts, whats the difference ?

While the article summarizes how to use different fonts, it did not have the definition.

Could you clarify if our understanding is correct:

The specified font is applied on the text.
If not available in the system the fallback font specified is used.
If fallback fonts are not present, default font is used
There are some fonts which are not installed in the system but can be added to
Aspose runtime , these are called custom fonts.
If custom fonts are placed within the pptx , they are called embedded fonts.

Could not understand, what substitution fonts are ?
Are external fonts same as emedded fonts ?
Could we get a document of font application logic ?

Regards,
Raman

@sraman,
Thank you for posting your questions. I need time to gather information for you, I will reply to you as soon as possible.

@sraman,

External fonts are used for Presentation instances that contain the fonts. For example, if you are converting a presentation to PDF or images, the text may not look right if some font is missing from the operating system or embedded fonts. But if you load such a font as an external one, it will be applied to the output documents. The external fonts are not saved into presentation files.

I’ve added a ticket with ID SLIDESNET-43626 to our issue-tracking system. We will describe the sequence of applying fonts for presentations in more detail as soon as possible for you.

When a presentation is converted to PDF or presentation slides are rendered to images, for example, you can replace a font with another. This can be done always or when the font is not available. Text with a specific font will have the font you specify applied to it.

It looks like the full logic of applying fonts has not been described in our documentation yet. I’ve added a ticket to our issue-tracking system to improve the PowerPoint Fonts chapter. We apologize for any inconvenience.