FontInfo

FontInfo class

Specifies information about a font used in the document.

To learn more, visit the Working with Fonts documentation article.

public class FontInfo

Properties

NameDescription
AltName { get; set; }Gets or sets the alternate name for the font.
Charset { get; set; }Gets or sets the character set for the font.
Family { get; set; }Gets or sets the font family this font belongs to.
IsTrueType { get; set; }Indicates that this font is a TrueType or OpenType font as opposed to a raster or vector font. Default is true.
Name { get; }Gets the name of the font.
Panose { get; set; }Gets or sets the PANOSE typeface classification number.
Pitch { get; set; }The pitch indicates if the font is fixed pitch, proportionally spaced, or relies on a default setting.

Methods

NameDescription
GetEmbeddedFont(EmbeddedFontFormatEmbeddedFontStyle)Gets a specific embedded font file.
GetEmbeddedFontAsOpenType(EmbeddedFontStyle)Gets an embedded font file in OpenType format. Fonts in Embedded OpenType format are converted to OpenType.

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 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");
}

See Also