API referenceFonts

pdfSetFontFlags

Override the /Flags bitmask written into every font's

CategoryFont-descriptor flags
Notereal, but global to the whole document, not per-font (see Remarks)

Purpose — Override the /Flags bitmask written into every font's /FontDescriptor for the rest of the document.

Description — Builds a single PDF /FontDescriptor /Flags value from the boolean inputs (bit values: FixedPitch $01, Serif $02, Symbolic $04/Nonsymbolic $20 — mutually exclusive, Script $08, Italic $40, AllCap $10000, SmallCap $20000, ForceBold $40000) and stores it as FontFlagsOverride. Confirmed consumed at multiple serialization call sites (EffFontFlags), each of which uses the override in place of its own computed default when the override is non-zero.

Declarations

C
int32_t __stdcall pdfSetFontFlags(PPDF IPDF, int32_t Fixed, int32_t Serif, int32_t Symbolic, int32_t Script, int32_t Italic, int32_t AllCap, int32_t SmallCap, int32_t ForceBold);
Delphi
function pdfSetFontFlags(const IPDF: PPDF; Fixed, Serif, Symbolic, Script, Italic, AllCap, SmallCap, ForceBold: Integer): Integer; stdcall; external 'LumasPdf.dll';

Parameters

ParameterTypeDescription
IPDFPPDFInstance handle.
FixedIntegerNon-zero sets FixedPitch ($01).
SerifIntegerNon-zero sets Serif ($02).
SymbolicIntegerNon-zero sets Symbolic ($04); zero sets Nonsymbolic ($20) instead — always exactly one of the two is set.
ScriptIntegerNon-zero sets Script ($08).
ItalicIntegerNon-zero sets Italic ($40).
AllCapIntegerNon-zero sets AllCap ($10000).
SmallCapIntegerNon-zero sets SmallCap ($20000).
ForceBoldIntegerNon-zero sets ForceBold ($40000).

Return value1 on a valid handle; 0 on an invalid handle.

Remarks — one override for the whole document, not per-font. Once set (to any non-zero combination), this override replaces the computed /Flags default for every font descriptor written from that point forward — there is no per-font variant of this call. There is also no way to clear the override back to "use each font's own computed default" other than by tracking that you need to call this again with all-zero arguments (which, note, still produces a *non-zero* effective flags value — Nonsymbolic $20 — since Symbolic=0 unconditionally sets that bit; a true "no override" state isn't reachable through this call once any override has been applied, since FontFlagsOverride <> 0 is the only "override active" test and $20 alone satisfies it).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfSetFontFlags(IntPtr IPDF, int @Fixed, int Serif, int Symbolic, int Script, int Italic, int AllCap, int SmallCap, int ForceBold);
Area
Fonts
Category

Setters

Exported names

pdfSetFontFlags

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.