FontInfo Class

Specifies information about a font used in the document.

ExpandedInheritance Hierarchy

SystemObject
  Aspose.Words.FontsFontInfo

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

ExpandedSyntax

public class FontInfo

The FontInfo type exposes the following members.

ExpandedProperties

  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.

ExpandedMethods

  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodCode exampleGetEmbeddedFont
Gets a specific embedded font file.
Public methodCode exampleGetEmbeddedFontAsOpenType
Gets an embedded font file in OpenType format. Fonts in Embedded OpenType format are converted to OpenType.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)

ExpandedRemarks

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

ExpandedExamples

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

FontInfoCollection allFonts = doc.FontInfos;

// Print all the used and unused fonts in the document.
for (int i = 0; i < allFonts.Count; i++)
{
    Console.WriteLine($"Font index #{i}");
    Console.WriteLine($"\tName: {allFonts[i].Name}");
    Console.WriteLine($"\tIs {(allFonts[i].IsTrueType ? "" : "not ")}a trueType font");
}

ExpandedSee Also