Esempio n. 1
0
 /**
  * Overloaded method for drawing special label
  *
  * @param resource $im
  */
 protected function drawText($im)
 {
     parent::drawText($im);
     if (strlen($this->isbn_created) > 0) {
         $pA = $this->getMaxSize();
         $pB = BCGBarcode1D::getMaxSize();
         $w = $pA[0] - $pB[0];
         if ($this->isbn_textfont instanceof BCGFont) {
             $textfont = clone $this->isbn_textfont;
             $textfont->setText($this->isbn_created);
             $xPosition = $w / 2 - $textfont->getWidth() / 2 + $this->offsetX * $this->scale;
             $yPosition = $this->offsetY * $this->scale - BCGBarcode1D::SIZE_SPACING_FONT;
             $textfont->draw($im, $this->colorFg->allocate($im), $xPosition, $yPosition);
         } elseif ($this->isbn_textfont !== 0) {
             $xPosition = $w / 2 - strlen($this->isbn_created) / 2 * imagefontwidth($this->isbn_textfont) + $this->offsetX * $this->scale;
             $yPosition = $this->offsetY * $this->scale - BCGBarcode1D::SIZE_SPACING_FONT - imagefontheight($this->isbn_textfont);
             imagestring($im, $this->isbn_textfont, $xPosition, $yPosition, $this->isbn_created, $this->colorFg->allocate($im));
         }
     }
 }
Esempio n. 2
0
 /**
  * Overloaded method for drawing special label.
  *
  * @param resource $im
  */
 protected function drawText($im)
 {
     parent::drawText($im);
     if (strlen($this->isbn_created) > 0) {
         $pA = $this->getMaxSize();
         $pB = BCGBarcode1D::getMaxSize();
         $w = $pA[0] - $pB[0];
         if ($this->getISBNFont() instanceof BCGFont) {
             $textfont = clone $this->getISBNFont();
             $textfont->setText($this->isbn_created);
             $xPosition = max(0, $w / 2 - $textfont->getWidth() / 2 + ($this->offsetX - $this->ean13offsetX) * $this->scale);
             $yPosition = $this->offsetY * $this->scale - BCGBarcode1D::SIZE_SPACING_FONT + 1;
             // +1 for anti-aliasing
             $textfont->draw($im, $this->colorFg->allocate($im), $xPosition, $yPosition);
         } elseif ($this->getISBNFont() !== 0) {
             $xPosition = $w / 2 - strlen($this->isbn_created) / 2 * imagefontwidth($this->getISBNFont()) + ($this->offsetX - $this->ean13offsetX) * $this->scale;
             $yPosition = $this->offsetY * $this->scale - BCGBarcode1D::SIZE_SPACING_FONT - imagefontheight($this->getISBNFont());
             imagestring($im, $this->getISBNFont(), $xPosition, $yPosition, $this->isbn_created, $this->colorFg->allocate($im));
         }
     }
 }