AddTrueTypeFont

Text, Fonts

Description

Adds a TrueType font to the document. The font must be installed on the system. If the font is not embedded, then the reader of the PDF document must have the font installed on their system too. If the font is embedded, then the reader does not need the font installed on their system.

Embedding a font makes the PDF file much larger. Some fonts are not licensed to be embedded.

Syntax

Delphi

function TPDFlib.AddTrueTypeFont(Const FontName: WideString; Embed: Integer): Integer;

ActiveX

Function PDFlib::AddTrueTypeFont(FontName As String, Embed As Long) As Long

DLL

int DLAddTrueTypeFont(int InstanceID, wchar_t * FontName, int Embed);

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') 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]. A codepage can also be specified (for example 'Arial [Bold] {1250}') which allows other encodings to be used. Possible code pages are: {0} Direct mapping {437} OEM_CHARSET {850} OEM_CHARSET {852} OEM_CHARSET {874} THAI_CHARSET {1250} EASTEUROPE_CHARSET {1251} RUSSIAN_CHARSET {1252} ANSI_CHARSET {1253} GREEK_CHARSET {1254} TURKISH_CHARSET {1255} HEBREW_CHARSET {1256} ARABIC_CHARSET {1257} BALTIC_CHARSET {1258} VIETNAMESE_CHARSET {1361} JOHAB_CHARSET Specifies whether to embed the font or not: 0 = Don't embed the font 1 = Embed the font
Embed

Return values

0The font could not be added. This may mean that the font is not licensed to be embedded, or that the font could not be found.
Non-zeroThe ID of the font that was successfully added. This ID can be used with the SelectFont function to select the font