API referenceFonts

pdfChangeFontStyle

Change the style of the currently active font FAMILY, fully

CategoryFont selection
Notefunctionally identical to pdfChangeFontStyleEx; same bit-convention warning applies

Purpose — Change the style of the currently active font FAMILY, fully re-resolving the face (not just flipping a flag).

Description — Stores the style, then — if a current font and its originally-requested family name are known — calls pdfSetFont's full resolution chain again with the new style. This means a style change can genuinely swap the underlying font file (e.g. from the regular TrueType file to a distinct bold TrueType file if one is installed), not just set a render flag. Uses the same bit-0=Bold/bit-1= Italic convention documented in the chapter-level note, despite this parameter's Cardinal ABI type (not TFStyle) — the named fsBold/ fsItalic constants now map onto these same two bits (fixed 2026-07-12), so passing them here works correctly too.

Declarations

C
BOOL32 __stdcall pdfChangeFontStyle(PPDF IPDF, uint32_t Style);
Delphi
function pdfChangeFontStyle(const IPDF: PPDF; Style: Cardinal): LongBool; stdcall; external 'LumasPdf.dll';

Parameters

ParameterTypeDescription
IPDFPPDFInstance handle.
StyleCardinal0=regular, 1=bold, 2=italic, 3=bold+italic (bit-level, same convention as pdfSetFontEx).

Return value — Always TRUE on a valid handle (there is no current-font precondition — with no active font, the style is simply recorded for next time).

Remarks — verified duplicate. pdfChangeFontStyleEx calls the exact same ChangeFontStyle method with no difference in behavior; the two entry points are interchangeable in this build.

See alsopdfChangeFontStyleEx

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Fonts
Category

Core

Exported names

pdfChangeFontStyle

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.