Pop\Graph\Graph::setFont PHP Method

setFont() public method

Set the font to use from the available fonts
public setFont ( string $font = null ) : Graph
$font string
return Graph
    public function setFont($font = null)
    {
        if (null !== $font && !array_key_exists($font, $this->fonts)) {
            throw new Exception('That font is not available.');
        }
        $this->font = $font;
        return $this;
    }

Usage Example

Example #1
0
 public function testAddAndSetFont2()
 {
     $this->setExpectedException('Pop\\Graph\\Exception');
     $g = new Graph($this->pdfOptions);
     $g->addFont(__DIR__ . '/../tmp/times.ttf');
     $g->setFont('bogus');
 }