pdfChangeFontStyle
Change the style of the currently active font FAMILY, fully
| Category | Font selection |
|---|---|
| Note | functionally 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
BOOL32 __stdcall pdfChangeFontStyle(PPDF IPDF, uint32_t Style);
function pdfChangeFontStyle(const IPDF: PPDF; Style: Cardinal): LongBool; stdcall; external 'LumasPdf.dll';
Parameters
| Parameter | Type | Description |
|---|---|---|
IPDF | PPDF | Instance handle. |
Style | Cardinal | 0=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 also — pdfChangeFontStyleEx
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Core
pdfChangeFontStyle
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.