FontInfo

Overview

FontInfo is a class in Aspose.PDF FOSS for .NET.

Information about a font used in a PDF.

This class provides 3 methods for working with FontInfo objects in .NET programs. Available methods include: FromFontData, GetGlyphWidth, MeasureString. All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package. Properties: BaseFont, DecodedFontName, DefaultHelvetica, Encoding, FontName, IsAccessible, and 8 more.

Properties

NameTypeAccessDescription
DefaultHelveticaFontReadDefault Helvetica font for detached text fragments.
ResourceNamestringReadResource name in the page’s font dictionary (e.g., “F1”).
BaseFontstringReadThe base font name (e.g., “Helvetica”, “ABCDEF+ArialMT”).
FontNamestringReadNormalized font name — strips subset prefix (ABCDEF+) and comma separators.
DecodedFontNamestringReadDecoded font name as a human-readable display name.
UniqueIdstringReadUnique identifier combining resource name and base font.
SubtypestringReadFont subtype (Type1, TrueType, Type0, Type3, etc.).
Encodingstring?ReadEncoding name (WinAnsiEncoding, Identity-H, etc.).
IsEmbeddedboolRead/WriteWhether the font is embedded in the PDF.
IsSubsetboolRead/WriteWhether the font is a subset (name starts with XXXXXX+).
IsItalicboolReadWhether the font is italic.
IsBoldboolReadWhether the font is bold.
IsCidboolReadWhether the font is a CID (Type0) font — used for Arabic, CJK, etc.
IsAccessibleboolReadWhether the font program is available — either embedded in the PDF, already loaded as source data, or installed on the system under the same name (resolvable via FindFont).

Methods

SignatureDescription
FromFontData(fontData: FontData)Create a FontInfo from a FontData (system font found via FontRepository.FindFont).
GetGlyphWidth(charCode: int)Get the width of a character code in 1/1000 text space units.
MeasureString(text: string, fontSize: double)Measure the width of a string in points, given a font size.

See Also