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 familyTypeNote
FF_FONT0Builtin fontA very small font, only one style
FF_FONT1Builtin fontA medium sized font
FF_FONT2Builtin fontThe largest bit mapped font
FF_ARIALTTF fontArial font
FF_VERDANATTF fontVerdana font
FF_COURIERTTF fontFix pitched courier
FF_BOOKTTF fontBookman
FF_COMICTTF fontComic sans
FF_TIMESTTF fontTimes New Roman
FF_GEORGIATTF fontGeorgia
FF_TREBUCHETTF fontTrebuche
FF_VERATTF fontGnome Vera font, Available from http://www.gnome.org/fonts/
FF_VERAMONOTTF fontGnome Vera Mono font, Available from http://www.gnome.org/fonts/
FF_VERASERIFTTF fontGnome Vera Serif font, Available from http://www.gnome.org/fonts/
FF_CHINESETTF fontInstalled chinese font
FF_SIMSUNTTF fontInstalled chinese font
FF_BIG5TTF fontInstalled 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