API referenceFonts

pdfUpdateTrueTypeSubsettedFont

Mark additional characters as "used" in the current TrueType

CategoryFont subsetting
Notecurrent-font-only, BMP-only (see Remarks)

Purpose — Mark additional characters as "used" in the current TrueType font's subset, so the eventual embedded subset (built at serialization time) includes their glyphs.

Description — For each character in SubsetChars, looks up its glyph ID via the font's Unicode BMP cmap and records the (GID → code) mapping used by the subsetter. Characters with no glyph in the font are silently skipped (don't count toward the returned total).

Declarations

C
int32_t __stdcall pdfUpdateTrueTypeSubsettedFont(PPDF IPDF, const char* SubsetChars);
int32_t __stdcall pdfUpdateTrueTypeSubsettedFontA(PPDF IPDF, const char* SubsetChars);
int32_t __stdcall pdfUpdateTrueTypeSubsettedFontW(PPDF IPDF, const wchar_t* SubsetChars);
Delphi
function pdfUpdateTrueTypeSubsettedFontA(const IPDF: PPDF; SubsetChars: PAnsiChar): Integer; stdcall; external 'LumasPdf.dll';
function pdfUpdateTrueTypeSubsettedFontW(const IPDF: PPDF; SubsetChars: PWideChar): Integer; stdcall; external 'LumasPdf.dll';

Parameters

ParameterTypeDescription
IPDFPPDFInstance handle.
SubsetCharsstringCharacters to ensure are included in the current font's subset.

Return value — Count of characters that resolved to a real glyph and were added; 0 if no font is active or the active font isn't TrueType.

Remarks — Like pdfSaveFontToFile, this has no font handle parameter — it always targets whatever font is currently selected. Only Basic Multilingual Plane characters (UTF-16 code units, not full code-point-aware surrogate-pair handling) are consulted against the font's cmap — a supplementary-plane character passed as a surrogate pair is looked up one UTF-16 unit at a time against the BMP cmap, which will not resolve to its intended glyph.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfUpdateTrueTypeSubsettedFontW(IntPtr IPDF, IntPtr SubsetChars);
public static extern int pdfUpdateTrueTypeSubsettedFont(IntPtr IPDF, IntPtr SubsetChars);
public static extern int pdfUpdateTrueTypeSubsettedFontA(IntPtr IPDF, IntPtr SubsetChars);
Area
Fonts
Category

Core

Exported names

pdfUpdateTrueTypeSubsettedFontW pdfUpdateTrueTypeSubsettedFont pdfUpdateTrueTypeSubsettedFontA

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.