/** * Calculate the left and top offset of the barcode in the * rendering support * * @param float $supportHeight * @param float $supportWidth * @return void */ protected function _adjustPosition($supportHeight, $supportWidth) { $barcodeHeight = $this->_barcode->getHeight(true) * $this->_moduleSize; if ($barcodeHeight != $supportHeight && $this->_topOffset == 0) { switch ($this->_verticalPosition) { case 'middle': $this->_topOffset = floor(($supportHeight - $barcodeHeight) / 2); break; case 'bottom': $this->_topOffset = $supportHeight - $barcodeHeight; break; case 'top': default: $this->_topOffset = 0; break; } } $barcodeWidth = $this->_barcode->getWidth(true) * $this->_moduleSize; if ($barcodeWidth != $supportWidth && $this->_leftOffset == 0) { switch ($this->_horizontalPosition) { case 'center': $this->_leftOffset = floor(($supportWidth - $barcodeWidth) / 2); break; case 'right': $this->_leftOffset = $supportWidth - $barcodeWidth; break; case 'left': default: $this->_leftOffset = 0; break; } } }