API referenceFonts

pdfSetFontEx

Same resolution chain as [pdfSetFont](#api-pdfsetfont), with

CategoryFont selection
NoteStyle here uses the correct convention (see Remarks); Embed/CP still unused

Purpose — Same resolution chain as pdfSetFont, with Style typed as a plain Integer rather than TFStyle.

Description — Identical implementation to pdfSetFontA/W — the only difference is the ABI's declared type for Style.

Declarations

C
int32_t __stdcall pdfSetFontExA(PPDF IPDF, const char* Name, int32_t Style, double Size, BOOL32 Embed, TCodepage CP);
int32_t __stdcall pdfSetFontExW(PPDF IPDF, const wchar_t* Name, int32_t Style, double Size, BOOL32 Embed, TCodepage CP);
Delphi
function pdfSetFontExA(const IPDF: PPDF; const Name: PAnsiChar; Style: Integer; Size: Double; Embed: LongBool; CP: TCodepage): Integer; stdcall; external 'LumasPdf.dll';
function pdfSetFontExW(const IPDF: PPDF; const Name: PWideChar; Style: Integer; Size: Double; Embed: LongBool; CP: TCodepage): Integer; stdcall; external 'LumasPdf.dll';

Parameters

ParameterTypeDescription
IPDFPPDFInstance handle.
NamestringFont family/PostScript name.
StyleIntegerThe correct convention for this implementation: 0=regular, 1=bold, 2=italic, 3=bold+italic. Because this parameter is typed as plain Integer (not TFStyle) in the ABI, using the simple bit values here is consistent with the type — the mismatch documented for pdfSetFontA/W is really about that entry point's misleading TFStyle type, not about this function.
SizeDoublePoint size.
EmbedBOOL32Accepted but not read — same as pdfSetFont.
CPTCodepageAccepted but not read — same as pdfSetFont.

Return value — Same semantics as pdfSetFont.

Remarks — Prefer this entry point over pdfSetFontA/W when you need programmatic bold/italic selection, precisely because its Integer typing matches what the implementation actually checks.

See alsopdfSetFont

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfSetFontExA(IntPtr IPDF, [MarshalAs(UnmanagedType.LPStr)] string Name, int Style, double Size, [MarshalAs(UnmanagedType.Bool)] bool Embed, TCodepage CP);
public static extern int pdfSetFontExW(IntPtr IPDF, [MarshalAs(UnmanagedType.LPWStr)] string Name, int Style, double Size, [MarshalAs(UnmanagedType.Bool)] bool Embed, TCodepage CP);
Area
Fonts
Category

Setters

Exported names

pdfSetFontExA pdfSetFontExW

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.