SetUseTTF
Prev | PHPlot Function Reference | Next

## SetUseTTF

SetUseTTF — Set the default font type

## Synopsis

    $plot->SetUseTTF($ttf)

## Description

`SetUseTTF` sets the default font type to TrueType fonts or built-in GD fonts, and re-initializes all font settings.

## Parameters

`$ttf`

  True to use TrueType fonts by default, False to use built-in GD fonts by default.

## Notes

Changing the font type re-initializes all the font settings to the defaults.

The default is False, to use the built-in GD fonts.

There must be a valid default font before enabling TrueType fonts with SetUseTTF, or PHPlot will abort with an error because it cannot find the default font. There are three ways to properly set up TrueType fonts to avoid this error:

- Call SetDefaultTTFont with the full pathname to a TrueType font file to use as the default. Since SetDefaultTTFont automatically selects TrueType fonts as the default, you don't need to call SetUseTTF if you use this option.

- Call SetTTFPath with the path to a directory where you have stored TrueType fonts, then call SetDefaultTTFont with the filename (e.g. `arial.ttf`) of the TrueType font file to use as the default. Since SetDefaultTTFont automatically selects TrueType fonts as the default, you don't need to call SetUseTTF if you use this option either.

- Modify the built-in values for the default TrueType font, and the default font directory (if needed), in `phplot.php` at installation time as described in Section 1.2, “Installing”. If the built-in defaults are sufficient to find the font file, you can use SetUseTTF to enable TrueType fonts.

After enabling TrueType fonts, you can use SetFont or SetFontTTF to select fonts and sizes for individual text elements in the plot. You can also use SetFontGD to use GD fonts for one or more elements, overriding the default font type.

## History

Through PHPlot-5.0.5, this function enabled or disabled the use of TrueType font text, since all text on a graph had to be either TrueType or all GD. Starting with PHPlot-5.0.6, this function selects the default font type (and still re-initializes all fonts). Both GD and TrueType font text can now be used on a graph.

Prev | Up | Next
SetTransparentColor | Home | SetXAxisPosition