Pop\Graph\Graph::addFont PHP 메소드

addFont() 공개 메소드

Add a font to available fonts
public addFont ( string $font ) : Graph
$font string
리턴 Graph
    public function addFont($font)
    {
        if ($this->adapter instanceof Pdf) {
            $this->adapter->addFont($font);
            $this->font = $this->adapter->getLastFontName();
            $this->fonts[$this->font] = $this->font;
        } else {
            $this->font = $font;
            if (strpos($this->font, DIRECTORY_SEPARATOR) !== false) {
                $this->font = substr($this->font, strrpos($this->font, DIRECTORY_SEPARATOR) + 1);
            }
            if (strpos($this->font, '.') !== false) {
                $this->font = substr($this->font, 0, strrpos($this->font, '.'));
            }
            $this->fonts[$this->font] = $font;
        }
        return $this;
    }

Usage Example

예제 #1
0
 public function testAddPieChart()
 {
     $pie = array('x' => 320, 'y' => 240, 'w' => 200, 'h' => 100);
     $percents = array(array(10, new Rgb(200, 15, 15)), array(8, new Rgb(80, 5, 10)), array(12, new Rgb(80, 180, 100)), array(18, new Rgb(50, 125, 210)), array(22, new Rgb(80, 180, 10)), array(18, new Rgb(100, 125, 210)), array(12, new Rgb(80, 180, 10)));
     $this->setExpectedException('Pop\\Http\\Exception');
     $g = new Graph($this->pdfOptions);
     $g->addFont('Arial')->setFontColor(new Rgb(128, 128, 128))->showText(true)->createPieChart($pie, $percents, 20)->output();
 }
All Usage Examples Of Pop\Graph\Graph::addFont