| Category | Font loading |
|---|---|
| Note | Embed/CP accepted but unused (see Remarks) |
Purpose — Load a font directly from an in-memory buffer (TrueType data).
Description — Unlike pdfSetFont's multi-tier name-resolution chain, this loads the font bytes you supply directly — no system/alt-font/bundled-fallback search. Always registers as an embedded TrueType entry (embedding is not optional through this call regardless of the Embed parameter — see Remarks) and makes it the active font.
Declarations
int32_t __stdcall pdfLoadFont(PPDF IPDF, void* Buffer, uint32_t BufSize, int32_t Style, double Size, BOOL32 Embed, int32_t CP);
function pdfLoadFont(const IPDF: PPDF; const Buffer: Pointer; BufSize: Cardinal; Style: Integer; Size: Double; Embed: LongBool; CP: Integer): Integer; stdcall; external 'LumasPdf.dll';
Parameters
| Parameter | Type | Description |
|---|---|---|
IPDF | PPDF | Instance handle with an open document. |
Buffer | Pointer | Raw font file bytes (TrueType). |
BufSize | Cardinal | Byte length of Buffer. |
Style | Integer | Accepted for ABI compatibility; the loaded font program dictates its own actual style — this does not select among style variants within the buffer (there is only one font in the buffer). |
Size | Double | Initial point size, becomes the current font size. |
Embed | BOOL32 | Accepted but not read — loading from a buffer always results in an embedded font; there is no non-embedded path through this call. |
CP | Integer | Accepted but not read. |
Return value — 1-based font handle on success; 0 if the buffer can't be parsed as a supported font or no document is open.
See also — pdfLoadFontEx
C# (P/Invoke)
public static extern int pdfLoadFont(IntPtr IPDF, IntPtr Buffer, uint BufSize, int Style, double Size, [MarshalAs(UnmanagedType.Bool)] bool Embed, int CP);
Core
pdfLoadFont
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.