## 4.9 TrueType fonts

The PDF plugin can use TrueType fonts. There are two types of TrueType fonts: The first format, which uses the ".ttf" extension, contains only one font in its file. The second format, which uses the ".ttc" extension, contains multiple fonts in its file. That is why doc:LoadTTFont() has a parameter which is used to specify the index of the font to load. If the additional parameter `embedding` is set to `True` when invoking doc:LoadTTFont(), the subset of the font is embedded into the PDF file. If not, only the marix data is stored in the PDF file. In this case a viewer application may use an alternative font if it cannot find the font.

Here is an example:

    fontname = doc:LoadTTFont("arial.ttf", True)
    hfont = doc:GetFont(fontname, "CP1250")
    page:SetFontAndSize(hfont, 10.5)

Note that the plugin can use only TrueType fonts which have a Unicode cmap and one of the following tables: "OS/2", "cmap", "cvt ", "fpgm", "glyf", "head", "hhea", "hmtx", "loca", "maxp", "name", "post", "prep".

Show TOC