SetFontTTF
Prev | PHPlot Function Reference | Next

## SetFontTTF

SetFontTTF — Select a TrueType font to use for a plot element

## Synopsis

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

## Description

`SetFontTTF` selects a TrueType font and size 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. SetFontTTF always selects a TrueType font, even if TrueType fonts are not the default font type.

## 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'. (The 'generic' font is currently used for pie chart percentage labels and error message images.)

`$font`

  Selects the TrueType font to use. This is the filename (without path, if the font file is in the default TrueType font directory as set with SetTTFPath, or a full pathname) of the TrueType font file. An empty string or NULL can be specified to use the default TrueType font (but see notes below).

`$size`

  The TrueType font size in points. If not specified, a default value of 12 is used.

`$line_spacing`

  Optional line spacing adjustment for this text element. For TrueType text, this is an adjustment factor for the built-in font spacing. See SetLineSpacing for details.

## Notes

See SetFont for more information about fonts. See SetLineSpacing for more information about line spacing.

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 SetFontGD, to allow mixing GD and TrueType fonts in the same graph.

Prev | Up | Next
SetFontGD | Home | SetGridColor