FontInfo Class

Specifies information about a font used in the document.

Inheritance Hierarchy

SystemObject
  Aspose.Words.FontsFontInfo

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

Syntax

public class FontInfo

The FontInfo type exposes the following members.

Properties

  NameDescription
Public propertyCode exampleAltName
Gets or sets the alternate name for the font.
Public propertyCode exampleCharset
Gets or sets the character set for the font.
Public propertyCode exampleFamily
Gets or sets the font family this font belongs to.
Public propertyCode exampleIsTrueType
Indicates that this font is a TrueType or OpenType font as opposed to a raster or vector font. Default is true.
Public propertyCode exampleName
Gets the name of the font.
Public propertyCode examplePanose
Gets or sets the PANOSE typeface classification number.
Public propertyCode examplePitch
The pitch indicates if the font is fixed pitch, proportionally spaced, or relies on a default setting.

Methods

  NameDescription
Public methodEquals (Inherited from Object.)
Public methodCode exampleGetEmbeddedFont
Gets a specific embedded font file.
Public methodGetEmbeddedFontAsOpenType
Gets an embedded font file in OpenType format. Fonts in Embedded OpenType format are converted to OpenType.
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodToString (Inherited from Object.)

Remarks

You do not create instances of this class directly. Use the FontInfos property to access the collection of fonts defined in a document.

Examples

Shows how to print the details of what fonts are present in a document.
Document doc = new Document(MyDir + "Embedded font.docx");

FontInfoCollection fonts = doc.FontInfos;

// 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
for (int i = 0; i < fonts.Count; i++)
{
    Console.WriteLine($"Font index #{i}");
    Console.WriteLine($"\tName: {fonts[i].Name}");
    Console.WriteLine($"\tIs {(fonts[i].IsTrueType ? "" : "not ")}a trueType font");
}

See Also