font = doc:LoadTTFont(filename, embedding[, index])
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.
True
, the glyph data of the font is embedded, otherwise only the matrix data is included in PDF file#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.