DocumentBaseFontInfos Property
Provides access to properties of fonts used in this document.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.9
Syntax
public FontInfoCollection FontInfos { get; }

Property Value

Type: FontInfoCollection
Remarks

This collection of font definitions is loaded as is from the document. Font definitions might be optional, missing or incomplete in some documents.

Do not rely on this collection to ascertain that a particular font is used in the document. You should only use this collection to get information about fonts that might be used in the document.

Examples
Shows how to save a document with embedded TrueType fonts
[C#]

Document doc = new Document(MyDir + "Document.docx");

FontInfoCollection fontInfos = doc.FontInfos;
fontInfos.EmbedTrueTypeFonts = true;
fontInfos.EmbedSystemFonts = false;
fontInfos.SaveSubsetFonts = false;

doc.Save(ArtifactsDir + "Document.docx");
Examples
Shows how to gather the details of what fonts are present in a document.
[C#]

Document doc = new Document(MyDir + "Document.doc");

FontInfoCollection fonts = doc.FontInfos;
int fontIndex = 1;

// The fonts info extracted from this document does not necessarily mean that the fonts themselves are
// used in the document. If a font is present but not used then most likely they were referenced at some time
// and then removed from the Document.
foreach (FontInfo info in fonts)
{
    // Print out some important details about the font.
    Console.WriteLine("Font #{0}", fontIndex);
    Console.WriteLine("Name: {0}", info.Name);
    Console.WriteLine("IsTrueType: {0}", info.IsTrueType);
    fontIndex++;
}
See Also