Contents Previous Next

### 4.7.3 Specifying fonts

All graph objects that uses text allows you to specify the font to be used by calling the SetFont() method and specifying three parameters

1. Font family, Specified with a FF_ define
2. Font style, Specified with a FS_ define
3. Font size, Numeric value (only used for TTF fonts)

For the builtin fonts the third, size, parameter is ignored since the size is fixed for the three builtin fonts. The available font families and the corresponding name (in JpGraph 1.7) are listed in the table below.

Font family | Type | Note
FF_FONT0 | Builtin font | A very small font, only one style
FF_FONT1 | Builtin font | A medium sized font
FF_FONT2 | Builtin font | The largest bit mapped font
FF_ARIAL | TTF font | Arial font
FF_VERDANA | TTF font | Verdana font
FF_COURIER | TTF font | Fix pitched courier
FF_BOOK | TTF font | Bookman
FF_COMIC | TTF font | Comic sans
FF_TIMES | TTF font | Times New Roman
FF_GEORGIA | TTF font | Georgia
FF_TREBUCHE | TTF font | Trebuche
FF_VERA | TTF font | Gnome Vera font, Available from http://www.gnome.org/fonts/
FF_VERAMONO | TTF font | Gnome Vera Mono font, Available from http://www.gnome.org/fonts/
FF_VERASERIF | TTF font | Gnome Vera Serif font, Available from http://www.gnome.org/fonts/
FF_CHINESE | TTF font | Installed chinese font
FF_SIMSUN | TTF font | Installed chinese font
FF_BIG5 | TTF font | Installed Chinese BIG5 font (needs iconv())

Please note that not all font families support all styles. The figure below illustrates each of the available font families and what styles you may use.

Figure 1: Illustration of some of the available fonts in JpGraph [src]

We finally show some example of valid font specifications

`$graph ->title->SetFont( FF_FONT2);
$graph->title-> SetFont( FF_FONT2, FS_BOLD);
$graph->title-> SetFont( FF_ARIAL);
$graph->title-> SetFont( FF_ARIAL, FS_BOLD,24);`

Contents Previous Next