AddSubsettedFont

Text, Fonts

Description

This function is used to embed a "subset" of a font. This means that only the font information for specified characters is embedded, reducing the size of the document. This function also allows any Unicode character to be embedded which means that characters from Chinese, Japanese, Korean and other languages can be used.

The newer AddTrueTypeSubsettedFont function provides more advanced font subsetting functionality.

Syntax

Delphi

function TPDFlib.AddSubsettedFont(Const FontName: WideString; CharsetIndex: Integer; Const SubsetChars: WideString): Integer;

ActiveX

Function PDFlib::AddSubsettedFont(FontName As String, CharsetIndex As Long, SubsetChars As String) As Long

DLL

int DLAddSubsettedFont(int InstanceID, wchar_t * FontName, int CharsetIndex, wchar_t * SubsetChars);

Parameters

FontNameThe name of the TrueType font to install. This can either be the name of the font as shown in the Windows\Fonts folder (for example "Times New Roman Bold") or it can be the font family name with an optional style specifier in square brackets (for example "Times New Roman [BoldItalic]"). Possible optional specifiers are: [Bold], [Italic] or [BoldItalic].
CharsetIndexYou must specify a character set containing the characters you want to subset: 1 = ANSI 2 = Default 3 = Symbol 4 = Shift JIS 5 = Hangeul 6 = GB2312 7 = Chinese Big 5 8 = OEM 9 = Johab 10 = Hebrew 11 = Arabic 12 = Greek 13 = Turkish 14 = Vietnamese 15 = Thai 16 = East Europe 17 = Russian 18 = Mac 19 = Baltic
SubsetCharsA string containing the characters you would like to subset. Repeated characters are ignored. A maximum of 255 characters can be placed in any font subset. Any Unicode character can be embedded, but you must ensure that the character is available in the specified character set.

Return values

0The subsetted font could not be added or the CharSet parameter was out of range
Non-zeroThe FontID of the added font. This ID can be used with the SelectFont function to select the font.