AddTrueTypeFontFromFile
Text, Fonts
Description
Embeds a TrueType, OpenType/TrueType or OpenType/CFF font into the document. The TrueType font is specified by the file name and does not have to be installed as a system font
This function is functionally identical to AddOpenTypeFontFromFile
WOFF 1.0 and WOFF2 web font files are accepted as well: the container is unpacked once in memory before parsing, and the embedded font program carries the resulting sfnt rather than the web container
WOFF2 unpacking requires Windows 10 version 1703 or later; malformed containers, inconsistent declared sizes and decoded programs above 512 MiB are rejected
Raw TrueType and OpenType/TrueType files can use a temporary file during the legacy Windows loading path; call SetTempPath to select its location. Web font containers use the in-memory path instead
Supported CFF2 input is normalized to CFF1, including static CFF2 without fvar. See AddOpenTypeFontFromFile for default-instance and zero-axis behavior
Syntax
Delphi
Function TPDFlib.AddTrueTypeFontFromFile(Const FileName: WideString): Integer;
ActiveX
Function PDFlib::AddTrueTypeFontFromFile(FileName As String) As Long
DLL
int DLAddTrueTypeFontFromFile(int InstanceID, const wchar_t* FileName);
int DLAddTrueTypeFontFromFileA(int InstanceID, const char* FileName);
Parameters
| FileName | The full path and file name of the TrueType font file to embed |
|---|
Return values
| 0 | The font could not be embedded |
|---|---|
| Non-zero | The ID of the font that was successfully added. This ID can be used with the SelectFont function to select the font |