API Reference
OfficeTrueTypeFont
Small managed reader for sfnt fonts that use TrueType glyf outlines, used for dependency-free text rasterization.
Inheritance
- Object
- OfficeTrueTypeFont
Remarks
This type reads font files directly and does not call operating-system graphics or font APIs. It supports the simple glyf/cmap/hmtx path needed by OfficeIMO renderers and falls back cleanly when no suitable platform font file is available.
Usage
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by
- Method OfficeTrueTypeFont.TryLoad
- Method OfficeTrueTypeFont.TryLoad
- Method OfficeTrueTypeFont.TryLoad
- Method OfficeTrueTypeFont.TryLoad
- Method OfficeTrueTypeFont.TryLoad
- Method OfficeTrueTypeFont.TryLoad
- Method OfficeTrueTypeFont.TryLoadDefault
- Method OfficeTrueTypeFont.TryLoadDefault
- Method OfficeTrueTypeFont.TryLoadFontFamily
- Method OfficeTrueTypeFont.TryLoadFontFamily
Accepted by parameters
- Constructor OfficeRasterCanvas.OfficeRasterCanvas
- Constructor OfficeRasterCanvas.OfficeRasterCanvas
- Constructor OfficeRasterCanvas.OfficeRasterCanvas
- Constructor OfficeRasterCanvas.OfficeRasterCanvas
Methods
public virtual Double BaselineOffset(Double fontSize) #DoubleParameters
- fontSize System.Double
public virtual List<List<OfficePoint>> GetTextContours(String text, Double x, Double y, Double fontSize) #List<List<OfficePoint>>Reads flattened fill contours for the supplied text at a top-left baseline box.
Parameters
- text System.String
- x System.Double
- y System.Double
- fontSize System.Double
public virtual List<List<OfficePoint>> GetTextContoursBounded(String text, Double x, Double y, Double fontSize, Int32 maximumPointCount, CancellationToken cancellationToken) #List<List<OfficePoint>>Parameters
- text System.String
- x System.Double
- y System.Double
- fontSize System.Double
- maximumPointCount System.Int32
- cancellationToken System.Threading.CancellationToken
public virtual Double Measure(String text, Double fontSize) #DoubleParameters
- text System.String
- fontSize System.Double
public static OfficeTrueTypeFont TryLoad(String path) #OfficeTrueTypeFontAttempts to load a standalone font or the first suitable face in a font collection.
Parameters
- path System.String
- Path to a TrueType font file, including an OpenType file that uses TrueType glyf outlines.
Returns
The loaded font, or null when the path or font data is invalid or inaccessible.
public static OfficeTrueTypeFont TryLoad(String path, Nullable<Int32> collectionIndex) #OfficeTrueTypeFontAttempts to load a specific face from a font collection.
Parameters
- path System.String
- Path to a TrueType font file or collection, including OpenType fonts that use TrueType glyf outlines.
- collectionIndex System.Nullable{System.Int32}
- Zero-based collection face index, or null to select the first suitable face.
Returns
The loaded font, or null when the path, index, or font data is invalid or inaccessible.
public static OfficeTrueTypeFont TryLoad(String path, Nullable<Int32> collectionIndex, String faceName) #OfficeTrueTypeFontAttempts to load a font face that matches an optional collection index and face name.
Parameters
- path System.String
- Path to a TrueType font file or collection, including OpenType fonts that use TrueType glyf outlines.
- collectionIndex System.Nullable{System.Int32}
- Zero-based collection face index, or null to search the collection.
- faceName System.String
- Preferred family, full, or PostScript face name; null accepts any suitable face.
Returns
The matching font, or null when the file cannot be read or no matching supported face exists.
public static OfficeTrueTypeFont TryLoad(Byte[] data) #OfficeTrueTypeFontAttempts to decode a standalone font or the first suitable face in a font collection.
Parameters
- data System.Byte[]
- Complete TrueType font data, including OpenType data that uses TrueType glyf outlines.
Returns
The decoded font, or null when the data is unsupported or malformed.
public static OfficeTrueTypeFont TryLoad(Byte[] data, Nullable<Int32> collectionIndex) #OfficeTrueTypeFontAttempts to decode a specific face from in-memory font data.
Parameters
- data System.Byte[]
- Complete TrueType font or collection data, including OpenType fonts that use TrueType glyf outlines.
- collectionIndex System.Nullable{System.Int32}
- Zero-based collection face index, or null to select the first suitable face.
Returns
The decoded font, or null when the data or requested index is invalid.
public static OfficeTrueTypeFont TryLoad(Byte[] data, Nullable<Int32> collectionIndex, String faceName) #OfficeTrueTypeFontAttempts to decode a font face matching an optional collection index and face name.
Parameters
- data System.Byte[]
- Complete TrueType font or collection data, including OpenType fonts that use TrueType glyf outlines.
- collectionIndex System.Nullable{System.Int32}
- Zero-based collection face index, or null to search the collection.
- faceName System.String
- Preferred family, full, or PostScript face name; null accepts any suitable face.
Returns
The matching font, or null when the data is malformed, unsupported, or contains no matching face.
public static OfficeTrueTypeFont TryLoadDefault() #OfficeTrueTypeFontAttempts to load a common platform font without using operating-system font APIs.
Returns
The first suitable font found, or null when none can be loaded.
public static OfficeTrueTypeFont TryLoadDefault(out String resolvedPath) #OfficeTrueTypeFontAttempts to load a common platform font file without using platform font APIs.
Parameters
- resolvedPath System.String@
public static OfficeTrueTypeFont TryLoadFontFamily(String fontFamily) #OfficeTrueTypeFontAttempts to load the first resolvable font from a CSS/Office-style font-family fallback list.
Parameters
- fontFamily System.String
public static OfficeTrueTypeFont TryLoadFontFamily(String fontFamily, out String resolvedPath) #OfficeTrueTypeFontAttempts to load the first resolvable font from a CSS/Office-style font-family fallback list.
Parameters
- fontFamily System.String
- resolvedPath System.String@
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public virtual String Fingerprint { get; } #public virtual String DisplayName { get; } #Best-effort display name read from the font name table.
public virtual Nullable<Int32> CollectionIndex { get; } #Collection index when the font was loaded from a TrueType collection.
public virtual Boolean IsOpenTypeCff { get; } #public virtual Boolean ProvidesComplexTextLayout { get; } #