Name
doc:LoadTTFont -- load TrueType font from file
Synopsis
font = doc:LoadTTFont(filename, embedding[, index])
Function
doc:LoadTTFont() loads a TrueType font from an external file and registers it in the document object. If the optional index argument is set to a positive value, this function will load the TrueType font at the specified index from a TrueType collection file instead.

When doc:LoadTTFont() succeeds, it returns the name of a font. Otherwise, it returns Nil and the error handler is called.

Inputs
filename
path to a TrueType font (.ttf) or TrueType font collection (.ttc) file
embedding
if this parameter is set to True, the glyph data of the font is embedded, otherwise only the matrix data is included in PDF file
index
optional: index of font to be loaded from TrueType font collection (defaults to -1)
Results
font
name of the font as a string
Errors
#HPDF_INVALID_DOCUMENT - An invalid document handle was set.

#HPDF_FAILED_TO_ALLOC_MEM - Memory allocation failed.

#HPDF_FONT_EXISTS - The font of the same name has already been registered.

#HPDF_INVALID_TTC_INDEX - The value specified at index parameter exceeds the number of fonts.

#HPDF_INVALID_TTC_FILE - Failed to load .ttc file.

#HPDF_TTF_INVALID_CMAP - Failed to load .ttf file.

#HPDF_TTF_INVALID_FORMAT - Failed to load .ttf file.

#HPDF_TTF_MISSING_TABLE - Failed to load .ttf file.

#HPDF_TTF_CANNOT_EMBEDDING_FONT - The font doesn't allow embedding.


Show TOC