FontsManager
Contents
[
Hide
]FontsManager class
Manages fonts across the presentation.
public class FontsManager : IFontsManager
Properties
| Name | Description |
|---|---|
| FontFallBackRulesCollection { get; set; } | Represents a user’s collection of FontFallBack rules for managing of collections of fonts for proper substitutions by fallback functionality Read/write IFontFallBackRulesCollection. |
| FontSubstRuleList { get; set; } | Font substitutions to use when rendering. Read/write IFontSubstRuleCollection. |
| PreferRegisteredFontsOverEmbedded { get; set; } | Specifies whether registered fonts should be preferred over embedded fonts with the same font name and style. When enabled, matching embedded fonts are temporarily replaced with corresponding registered fonts during export. |
Methods
| Name | Description |
|---|---|
| AddEmbeddedFont(byte[], EmbedFontCharacters) | Adds the embedded font Keep in mind when copying any fonts that most fonts are copyrighted. First locate the license of a font before hand and verify they can be freely transferred to another machine.An ArgumentException can be thrown if font data is null or this font is already embedded |
| AddEmbeddedFont(IFontData, EmbedFontCharacters) | Adds the embedded font Keep in mind when copying any fonts that most fonts are copyrighted. First locate the license of a font before hand and verify they can be freely transferred to another machine.An ArgumentException can be thrown if font data is null or this font is already embedded |
| GetEmbeddedFonts() | Returns the fonts embedded in the presentation |
| GetFontBytes(IFontData, FontStyleType) | Retrieves the byte array representing the font data for a specified font style and font data. |
| GetFontEmbeddingLevel(byte[], string) | Determines the embedding level of a font from the given byte array and font name. |
| GetFonts() | Returns the fonts used in the presentation |
| GetSubstitutions() | Gets the information about fonts that will be replaced on the presentation’s rendering. |
| GetSubstitutions(int[]) | Gets the information about fonts that will be replaced during rendering of the specified slides. |
| RemoveEmbeddedFont(IFontData) | Removes the embedded font |
| ReplaceFont(IFontSubstRule) | Replace font in presentation using information provided in FontSubstRule |
| ReplaceFont(IFontSubstRuleCollection) | Replace font in presentation using information provided in collection of FontSubstRule |
| ReplaceFont(IFontData, IFontData) | Replace font in presentation |
Examples
The following example shows how to add embedded fonts to PowerPoint Presentation.
[C#]
// Load presentation
using (Presentation presentation = new Presentation("Fonts.pptx"))
{
// Load source font to be replaced
IFontData sourceFont = new FontData("Arial");
IFontData[] allFonts = presentation.FontsManager.GetFonts();
IFontData[] embeddedFonts = presentation.FontsManager.GetEmbeddedFonts();
foreach (IFontData font in allFonts)
{
if (!embeddedFonts.Contains(font))
{
presentation.FontsManager.AddEmbeddedFont(font, EmbedFontCharacters.All);
}
}
// Save the presentation
presentation.Save("AddEmbeddedFont_out.pptx", SaveFormat.Pptx);
}
See Also
- interface IFontsManager
- namespace Aspose.Slides
- assembly Aspose.Slides