pdfUpdateTrueTypeSubsettedFont
Mark additional characters as "used" in the current TrueType
| Category | Font subsetting |
|---|---|
| Note | current-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
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);
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
| Parameter | Type | Description |
|---|---|---|
IPDF | PPDF | Instance handle. |
SubsetChars | string | Characters 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)
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);
Core
pdfUpdateTrueTypeSubsettedFontW
pdfUpdateTrueTypeSubsettedFont
pdfUpdateTrueTypeSubsettedFontA
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.