AddOpenTypeFontFromFile
Text, Fonts
Description
This function is identical to AddTrueTypeFontFromFile. Both functions allow a TrueType, OpenType/TrueType or OpenType/CFF font to be added from a raw sfnt, WOFF 1.0 or WOFF2 file
Web font containers are unpacked once in memory and the unwrapped font program is embedded. WOFF2 input requires Windows 10 version 1703 or later
Only Options = 0 is currently supported
Supported CFF2 input is normalized to static CFF1 for embedding. Variable CFF2 uses its default instance; static CFF2 without fvar is also accepted and reports no variation axes. A static CFF2 source exports its resolved CFF1 program through SaveFontToFile
Syntax
Delphi
Function TPDFlib.AddOpenTypeFontFromFile(Const FileName: WideString; Options: Integer): Integer;
ActiveX
Function PDFlib::AddOpenTypeFontFromFile(FileName As String, Options As Long) As Long
DLL
int DLAddOpenTypeFontFromFile(int InstanceID, const wchar_t* FileName, int Options);
int DLAddOpenTypeFontFromFileA(int InstanceID, const char* FileName, int Options);
Parameters
| FileName | The font file name |
|---|---|
| Options | Should be set to 0 |
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 |