Esempio n. 1
0
 /**
  * Init the PDF Font
  *
  * @return void
  */
 public function fontSet()
 {
     $family = strtolower($this->value['font-family']);
     $b = $this->value['font-bold'] ? 'B' : '';
     $i = $this->value['font-italic'] ? 'I' : '';
     $u = $this->value['font-underline'] ? 'U' : '';
     $d = $this->value['font-linethrough'] ? 'D' : '';
     $o = $this->value['font-overline'] ? 'O' : '';
     // font style
     $style = $b . $i;
     if ($this->defaultFont) {
         if ($family == 'arial') {
             $family = 'helvetica';
         } elseif ($family == 'symbol' || $family == 'zapfdingbats') {
             $style = '';
         }
         $fontkey = $family . $style;
         if (!$this->pdf->isLoadedFont($fontkey)) {
             $family = $this->defaultFont;
         }
     }
     if ($family == 'arial') {
         $family = 'helvetica';
     } elseif ($family == 'symbol' || $family == 'zapfdingbats') {
         $style = '';
     }
     // complete style
     $style .= $u . $d . $o;
     // size : mm => pt
     $size = $this->value['font-size'];
     $size = 72 * $size / 25.4;
     // apply the font
     $this->pdf->SetFont($family, $style, $this->value['mini-size'] * $size);
     $this->pdf->setTextColorArray($this->value['color']);
     if ($this->value['background']['color']) {
         $this->pdf->setFillColorArray($this->value['background']['color']);
     } else {
         $this->pdf->setFillColor(255);
     }
 }