Method FromFile
- Namespace
- SoftZenPdf
- Assembly
- SoftZenPdf.dll
FromFile(string)
Loads a TrueType font from a file; for a collection (.ttc), the first font in it.
public static TrueTypeFont FromFile(string path)
Parameters
pathstringA
.ttfor.ttcfile (or.otfwith TrueType outlines).
Returns
- TrueTypeFont
The font, ready to be used with DrawText(string, double, double, PdfFont, double, PdfColor?).
Exceptions
- NotSupportedException
The font has CFF outlines, or its licence forbids embedding or subsetting.
- InvalidDataException
The file is not a valid TrueType font.
FromFile(string, int)
Loads one font of a TrueType collection (.ttc) file.
public static TrueTypeFont FromFile(string path, int collectionIndex)
Parameters
pathstringThe collection file (or a single font file, with index 0).
collectionIndexintWhich font of the collection to load, from 0; see CountFonts(byte[]).
Returns
- TrueTypeFont
The font.
Exceptions
- ArgumentOutOfRangeException
collectionIndexis not a font of the file.- NotSupportedException
The font has CFF outlines, or its licence forbids embedding or subsetting.
- InvalidDataException
The file is not a valid TrueType font or collection.