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
| Name | Type | Access | Description |
|---|---|---|---|
DefaultHelvetica | Font | Read | Default Helvetica font for detached text fragments. |
ResourceName | string | Read | Resource name in the page’s font dictionary (e.g., “F1”). |
BaseFont | string | Read | The base font name (e.g., “Helvetica”, “ABCDEF+ArialMT”). |
FontName | string | Read | Normalized font name — strips subset prefix (ABCDEF+) and comma separators. |
DecodedFontName | string | Read | Decoded font name as a human-readable display name. |
UniqueId | string | Read | Unique identifier combining resource name and base font. |
Subtype | string | Read | Font subtype (Type1, TrueType, Type0, Type3, etc.). |
Encoding | string? | Read | Encoding name (WinAnsiEncoding, Identity-H, etc.). |
IsEmbedded | bool | Read/Write | Whether the font is embedded in the PDF. |
IsSubset | bool | Read/Write | Whether the font is a subset (name starts with XXXXXX+). |
IsItalic | bool | Read | Whether the font is italic. |
IsBold | bool | Read | Whether the font is bold. |
IsCid | bool | Read | Whether the font is a CID (Type0) font — used for Arabic, CJK, etc. |
IsAccessible | bool | Read | Whether 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
| Signature | Description |
|---|---|
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. |