SetUseTTF — Set the default font type




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



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


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

  • SetUseTTF(FALSE) resets all text elements to use the built-in GD fonts in the default sizes, and sets GD fonts as the default.

  • SetUseTTF(TRUE) resets all text elements to use TrueType fonts, in the default point sizes, but without changing the default font name (if one was set). It sets TrueType fonts as the default.

  • SetDefaultTTFont(NULL) or SetDefaultTTFont() resets all text elements to use TrueType fonts, in the default point sizes, and also erases any default font name. See SetDefaultTTFont for details.

By default, built-in GD fonts are used.

When you enable TrueType fonts with SetUseTTF, there must be a valid default font. You can use SetDefaultTTFont to establish a default font, but since this also enables TrueType fonts as the default, you need not use SetUseTTF in that case. On some platforms, PHPlot can find a valid default font on its own. See Section 3.8.3, “TrueType Font Selection” for more information on the default font.

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.


Through PHPlot-5.1.2, there was a fixed default font called benjamingothic.ttf, which used to be included with PHPlot, but was removed in 2006. (It was not generally suitable for plotting anyway.) As a result, you had to use SetDefaultTTFont to set a valid default font before enabling TrueType fonts with SetUseTTF(). But since SetDefaultTTFont() itself turned on TrueType fonts, SetUseTTF() was rarely useful. Starting with PHPlot-5.1.3, PHPlot will try a number of sans-serif font names, trying to find a valid font to use as the default. On platforms where this works, SetUseTTF(True) can be used without any other font setup in order to use the default TrueType font for all text.

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. Logo

This version of the manual was produced for the PHPlot Sourceforge project web service site, which requires the logo on each page.

To download a logo-free copy of the manual, see the PHPlot project downloads area.