API referenceFonts

pdfSetAltFonts

Set the ordered list of fallback font names

CategoryAlternate font substitution
NoteThe A and W variants behave differently — see the chapter note above

Purpose — Set the ordered list of fallback font names pdfSetFont tries when the requested name isn't found installed on the system.

Declarations

C
BOOL32 __stdcall pdfSetAltFontsA(PPDF IPDF, uint32_t ListHandle, PPAnsiChar List, uint32_t Count);
BOOL32 __stdcall pdfSetAltFontsW(void* IPDF, uint32_t ListHandle, PPWideChar List, uint32_t Count);
Delphi
function pdfSetAltFontsA(const IPDF: PPDF; ListHandle: Cardinal; const List: PPAnsiChar; Count: Cardinal): LongBool; stdcall; external 'LumasPdf.dll';
function pdfSetAltFontsW(const IPDF: Pointer; ListHandle: Cardinal; const List: PPWideChar; Count: Cardinal): LongBool; stdcall; external 'LumasPdf.dll';

Parameters

ParameterTypeDescription
IPDFPPDF/PointerInstance handle.
ListHandleCardinalOnly meaningful for the A variant (targets FAltLists[ListHandle-1], the dead mechanism). Ignored by the W variant, which always writes the single global FAltFontNames regardless of this value.
Listarray of stringsFont names to try, in order.
CountCardinalNumber of entries in List.

Return valueTRUE on a valid handle and non-nil list; FALSE otherwise. pdfSetAltFontsA's success additionally requires ListHandle to name an existing, non-deleted list from pdfCreateAltFontList — but success here still has no effect on font resolution, per the chapter note.

Remarks — use pdfSetAltFontsW for real substitution. To make alternate-font fallback actually work, call pdfSetAltFontsW — the ListHandle argument can be any value (it's unused); only List/Count matter. Do not build a pdfCreateAltFontListpdfActivateAltFontListpdfSetAltFontsA sequence expecting it to influence pdfSetFont — it won't.

See alsopdfCreateAltFontList, pdfSetFont

C# (P/Invoke)

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

Setters

Exported names

pdfSetAltFontsW pdfSetAltFontsA

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.