All graph objects that uses text allows you to specify the font to be used by
calling a SetFont()
method and specifying three parameters.
The font family. This could for example be "Arial", "Times roman" for
TTF fonts or "Bitmap font medium size" when using bit-mapped fonts. The
font family is specified by using a symbolic constant that starts with
the prefix "FF_
" (for Font Family). A list of all supported font
families are shown in Table 8.2.
The font style. This specifies if the font should be emphasized as
italic, bold, or bold-italic. By default all fonts are rendered with the
"normal" style. The fonts style is specified with a symbolic constant
that starts with the prefix "FS_
" (for Font Style). The supported font styles are:
Table 8.1. Supported Font Styles
Font style specifier | Description |
---|---|
FS_NORMAL | Normal font style |
FS_BOLD | Bold font style |
FS_ITALIC | Italic font style |
FS_BOLDITALIC | Bold + Italic style for font families that support this |
Please note that not all font families support all available styles.
The font size. This is specified as an integer and depicts the size of the font given in typographic points (pt).
Table 8.2. Supported Latin Font family specifiers
Font family name | Type | Comment | Bold | Italic | BI |
---|---|---|---|---|---|
FF_FONT0 | Bitmap | A very small font | |||
FF_FONT1 | Bitmap | A medium sized font | |||
FF_FONT2 | Bitmap | The largest bit mapped font | |||
FF_ARIAL | TTF | Arial font | |||
FF_VERDANA | TTF | Verdana font | |||
FF_COURIER | TTF | Fixed pitched Courier new font | |||
FF_BOOK | TTF | Bookman | |||
FF_COMIC | TTF | Comic sans | |||
FF_TIMES | TTF | Times New Roman | |||
FF_GEORGIA | TTF | Georgia | |||
FF_TREBUCHE | TTF | Trebuche | |||
FF_VERA | TTF | Gnome Vera font. All Vera family fonts are available from http://www.gnome.org/fonts/
| |||
FF_VERAMONO | TTF | Gnome Vera Mono font | |||
FF_VERASERIF | TTF | Gnome Vera Serif font | |||
FF_DV_SANSSERIF | TTF | DejaVu Font family. The DejaVu fonts are modifications of the
Bitstream Vera fonts designed to extend this original for
greater coverage of Unicode, as well as providing more styles.
These fonts are available from http://dejavu-fonts.org/
| |||
FF_DV_SANSSERIFMONO | TTF | DejaVu Font family. | |||
FF_DV_SANSSERIFCOND | TTF | DejaVu Font family. | |||
FF_DV_SERIF | TTF | DejaVu Font family. | |||
FF_DV_SERIFCOND | TTF | DejaVu Font family. | |||
FF_CHINESE, FF_BIG5 | TTF |
Chinese font (both symbolic names can be used). The actual font file name used for the Chinese font is
" | |||
FF_SIMSUN | TTF |
Chinese font. The actual font file name is
" | |||
FF_MINCHO | TTF |
Japanese font. The actual font file name is
" | |||
FF_PMINCHO | TTF |
Japanese font. The actual font file name is
" | |||
FF_GOTHIC | TTF |
Japanese font. The actual font file name is
" | |||
FF_PGOTHIC | TTF |
Japanese font. The actual font file name is
" | |||
FF_DAVID | TTF |
Hebrew font. The actual font file name is
" | |||
FF_MIRIAM | TTF |
Hebrew font. The actual font file name is
" | |||
FF_AHRON | TTF |
Hebrew font. The actual font file name is
" |
Depending on what versions of the DejaVu fonts are installed on the system there are two naming conventions for the font files in common practice. The library will try both naming convention to see if it can find the font files.
In Figure 8.1 all latin fonts are shown.