FontSettingsDefaultInstance Property

Static default font settings.

Namespace:  Aspose.Words.Fonts
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.8.0


public static FontSettings DefaultInstance { get; }

Property Value

Type: FontSettings


This instance is used by default in a document unless FontSettings is specified.


Demonstrates how to receive notifications of font substitutions by using IWarningCallback.
// Load the document to render
Document doc = new Document(MyDir + "Document.docx");

// Create a new class implementing IWarningCallback and assign it to the PdfSaveOptions class
HandleDocumentSubstitutionWarnings callback = new HandleDocumentSubstitutionWarnings();
doc.WarningCallback = callback;

// We can choose the default font to use in the case of any missing fonts
FontSettings.DefaultInstance.SubstitutionSettings.DefaultFontSubstitution.DefaultFontName = "Arial";

// For testing we will set Aspose.Words to look for fonts only in a folder which doesn't exist. Since Aspose.Words won't
// find any fonts in the specified directory, then during rendering the fonts in the document will be substituted with the default 
// font specified under FontSettings.DefaultFontName. We can pick up on this substitution using our callback
FontSettings.DefaultInstance.SetFontsFolder(string.Empty, false);

// Pass the save options along with the save path to the save method
doc.Save(ArtifactsDir + "Font.SubstitutionNotification.pdf");

See Also