SetFontGD
Prev | PHPlot Function Reference | Next

## SetFontGD

SetFontGD — Select a GD font to use for a plot element

## Synopsis

    $plot->SetFontGD($elem, $font, [$line_spacing])

## Description

`SetFontGD` selects a GD font to use for one plot element (for example, the title). This function supplements SetFont, which selects a GD or TTF font depending on the currently selected font type. SetFontGD always selects a GD font, even if TrueType fonts are in use.

## Parameters

`$elem`

  The name of the element to change the font for. Use one of the following strings: 'title', 'legend', 'generic', 'x_label', 'y_label', 'x_title', or 'y_title'.

`$font`

  Selects the GD font to use. This is a number between 1 and 5 which selects one of the built-in GD fonts. Font 1 is the smallest, and font 5 is the largest.

`$line_spacing`

  Optional line spacing adjustment for this text element. For GD fonts, this is the number of pixels between lines. If not specified, the value set by SetLineSpacing is used.

## Notes

See Section 3.8, “Text Fonts”, SetFont for more information about fonts, and SetLineSpacing for more information about line spacing.

The `generic` font is used for pie chart segment labels, message image text (see DrawMessage), error image text, and can be used from callbacks (see Section 4.4.5, “Using Callbacks to Annotate Plots”). However, changing this font has no effect on error image text, because the PHPlot error handler resets the font to the default before displaying the error.

Use SetUseTTF (or SetDefaultTTFont, which calls it) to set the default font type. Use SetFont to specify the font to use for an element using the default font type. Use SetFontGD and SetFontTTF to specify the font of an element using the specific type of font.

## History

This function was added at PHPlot-5.0.6, along with SetFontTTF, to allow mixing GD and TrueType fonts in the same graph.

Prev | Up | Next
SetFont | Home | SetFontTTF