EmbedFontProgramFromFile

Text, Fonts

Description

Embeds a TrueType/OpenType font program directly from a specified font file on disk.

Syntax

Delphi

Function TPDFlib.EmbedFontProgramFromFile(Const FontName, FileName: WideString): Integer;

Parameters

FontNameThe name to register the font under.
FileNameThe absolute or relative path to the TrueType/OpenType font file (.ttf, .ttc, .otf).

Return values

0The font program could not be embedded
Non-zeroSuccess indicator

Remarks

A glyf-based TrueType program goes into TrueType and CIDFontType2 fonts as FontFile2; a CIDFontType0 font receives only an OpenType CFF program, written as FontFile3 /OpenType

A CFF program is written as an OpenType font file, a stream type introduced in PDF 1.6, so a document below PDF 1.6 is raised to that version; when LockSaveVersion pins a lower version, saving fails with LastErrorCode 602 instead