|
Haru Free PDF Library
|
There are several types of fonts available in libHaru.
| Font type | Description |
|---|---|
| Base14 Font | The built-in font of PDF. Can be used for all viewer applications. |
| Type1 Font | A font format used by PostScript. |
| TrueType Font | Widely used outline font format. |
| CID Font | Font format for multi-byte characters. Developed by Adobe. |
The application has to call HPDF_GetFont() to get font handle.
Except for Base14 fonts, one of the following functions must be used to load the font before calling HPDF_GetFont():
Base14 fonts are built into PDF and all viewer applications can display these fonts. Collectively, those fonts are known as the Base 14 fonts.
Application can get a base14 font handle any time by calling HPDF_GetFont(). PDF files which use base14 fonts are smaller than those which use other types of fonts.
Moreover, PDF processing is faster because there is no need to load external fonts. However, base14 fonts are only able to display the latin1 character set. To use other character sets, application must use other fonts.
CourierCourier-BoldCourier-ObliqueCourier-BoldObliqueHelveticaHelvetica-BoldHelvetica-ObliqueHelvetica-BoldObliqueTimes-RomanTimes-BoldTimes-ItalicTimes-BoldItalicSymbolZapfDingbatsType1 is a outline fonts format developed by Adobe. AFM file is required to use external Type1 font with libHaru.
When application uses an external Type1 font, it has to call HPDF_LoadType1FontFromFile() before calling HPDF_GetFont().
Return value of HPDF_LoadType1FontFromFile() is used as font name parameter of HPDF_GetFont().
If a PFA/PFB file is specified at HPDF_LoadType1FontFromFile() call, glyf data of the font is embedded to PDF file. Otherwise, only metrics data of AFM file is embedded.
libHaru can use TrueType fonts. There are two types of TrueType fonts.
The first format, with .ttf extension, contains only one font data in file. This type of font is loaded by HPDF_LoadTTFontFromFile().
The second format, with .ttc extension, contains multiple font data in file. This type of font is loaded by HPDF_LoadTTFontFromFile2().
Function HPDF_LoadTTFontFromFile2() has parameter index to specify which font to load.
If the parameter embedding is set to HPDF_TRUE when HPDF_LoadTTFontFromFile() or HPDF_LoadTTFontFromFile2() get called, the font subset is embedded into PDF file.
If not, only the marix data is stored into a PDF file. In this case viewer application may use an alternative font if it cannot find requestd font.
libHaru can use only TrueType fonts with Unicode cmap and the following tables:CIDFont is a font for multibyte character developed by Adobe.
Two simplified Chinese fonts, one traditional Chinese fonts, four Japanese fonts, and four Korean fonts are available in libHaru.
Application has to call following functions once before using CID fonts.
| Function | Description |
|---|---|
| HPDF_UseCNSFonts() | Enables simplified Chinese fonts SimSun and SimHei |
| HPDF_UseCNTFonts() | Enables traditional Chinese font MingLiU |
| HPDF_UseJPFonts() | Enables Japanese fonts MS-Mincyo, MS-Gothic, MS-PMincyo and MS-PGothic |
| HPDF_UseKRFonts() | Enables Korean fonts Batang, Dotum, BatangChe and DotumChe |