SetUseTTF — Enables or disables use of TrueType fonts
$plot->SetUseTTF($ttf
)
SetUseTTF
enables (or disables) the use of TrueType
fonts instead of the built-in GD fonts. TrueType fonts generally look
better and can be scaled and rotated, but require more memory and
processing power to render.
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. There are three ways to properly set up TrueType fonts to avoid this error, starting with PHPlot-5.0rc3:
Call SetDefaultTTFont with the full pathname to a TrueType font file to use as the default. Since SetDefaultTTFont automatically enables TrueType fonts, 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 enables TrueType fonts, 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 to select fonts and sizes for individual text elements in the plot.