SetDefaultTTFont — Set the default TrueType font




SetDefaultTTFont sets the default TrueType font, resets all text elements to use that font, and makes TrueType fonts the default font type.



Name of the TrueType font file to use as default. Specify either a filename in the default TrueType font directory (or one that can be found by GD using its own rules), or the full pathname to a font file. If this parameter is omitted or NULL, the default TrueType font is cleared.


This function selects TrueType fonts as the default font type as if SetUseTTF(True) was called.

The supplied font name is first checked as given. If that does not work, it is checked prefixed with the default TrueType font directory as set with SetTTFPath. If that does not work either, a fatal error results. See Section 3.8.3, “TrueType Font Selection” for more information.

This function resets all elements to use the named font and default sizes, so it undoes all prior SetFont, SetFontGD, and SetFontTTF calls.

Change the font used by individual text elements with SetFont, SetFontGD, and SetFontTTF after using SetDefaultTTFont.

Using SetDefaultTTFont(NULL) or SetDefaultTTFont() will erase the default font, then set TrueType fonts as the default font type and reset all fonts. This will immediately result in PHPlot using its default algorithm to locate a usable TrueType font. On systems where PHPlot is unable to locate a TrueType font without help, SetDefaultTTFont([NULL]) will fail, although using SetTTFPath first may help.


Starting in PHPlot-6.0.0, the argument can be omitted and defaults to NULL, which clears the default font. In previous versions, the argument was required.

Starting with PHPlot-5.1.3, TrueType fonts are validated using GD. This allows GD to apply its own rules to try to locate a font file. On at least some platforms, this allows fonts to be specified by filename only, without having to set the PHPlot default font directory. (Through PHPlot-5.1.2, the existence of the font file was checked, which did not allow GD to try to find the font using its own rules.)

Through PHPlot-5.0.5, setting a default TrueType font with this function also forced all text on the graph to use TrueType text. Starting with PHPlot-5.0.6, it just sets the default font type. Set SetUseTTF for more information on this change.

This behavior of this function was changed significantly at PHPlot-5.0rc3. 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.