/**
  * 
  * Drow Cell Border 
  * 
  * @param int $startLine
  * @param int $width
  * 
  * @return SirShurf_Pdf_TableSet_Cell
  */
 private function _drowCellBorder($startLine, $width)
 {
     $lineLeading = intval($this->_font->getLineHeight() / $this->_font->getUnitsPerEm());
     if ($this->getOption('border-left')) {
         $colors = explode(',', $this->getOption('border-left'));
         $this->_pdfTableSet->getCurrentObject()->setLineColor(new Zend_Pdf_Color_Rgb($colors[0], $colors[1], $colors[2]));
         // Draw the right border.
         $top = $this->_pdfTableSet->getCurrentRow() + $this->_fontSize;
         $this->_pdfTableSet->getCurrentObject()->drawLine($startLine, $top, $startLine, $this->_pdfTableSet->getCurrentRow() - $lineLeading);
     }
     if ($this->getOption('border-right')) {
         $colors = explode(',', $this->getOption('border-right'));
         $this->_pdfTableSet->getCurrentObject()->setLineColor(new Zend_Pdf_Color_Rgb($colors[0], $colors[1], $colors[2]));
         // Draw the right border.
         $top = $this->_pdfTableSet->getCurrentRow() + $this->_fontSize;
         $this->_pdfTableSet->getCurrentObject()->drawLine($startLine + $width, $top, $startLine + $width, $this->_pdfTableSet->getCurrentRow() - $lineLeading);
     }
     if ($this->getOption('border-top')) {
         $colors = explode(',', $this->getOption('border-top'));
         $this->_pdfTableSet->getCurrentObject()->setLineColor(new Zend_Pdf_Color_Rgb($colors[0], $colors[1], $colors[2]));
         // Draw the top border.
         $top = $this->_pdfTableSet->getCurrentRow() + $this->_fontSize;
         $this->_pdfTableSet->getCurrentObject()->drawLine($startLine, $top, $startLine + $width, $top);
     }
     if ($this->getOption('border-buttom')) {
         $colors = explode(',', $this->getOption('border-buttom'));
         $this->_pdfTableSet->getCurrentObject()->setLineColor(new Zend_Pdf_Color_Rgb($colors[0], $colors[1], $colors[2]));
         // Draw the buttom border.
         $this->_pdfTableSet->getCurrentObject()->drawLine($startLine, $this->_pdfTableSet->getCurrentRow() - $lineLeading, $startLine + $width, $this->_pdfTableSet->getCurrentRow() - $lineLeading);
     }
     return $this;
 }
 public function render($x)
 {
     // Font Size
     if ($this->getOption('size')) {
         $this->setFont($this->_fontType, $this->getOption('size'));
     }
     // Set the font.
     if ($this->getOption('bold')) {
         $font = $this->_fontBold;
     } else {
         $font = $this->_font;
     }
     // How far to move it on the X axis for the next column.
     $offset = $this->_width;
     // Wrap the text if necessary
     $text = $this->_wrapText($this->getText(), $offset, $font, $this->_fontSize);
     $numLines = count($text);
     // Set Text Color
     if ($this->getOption('color')) {
         $colors = explode(',', $this->getOption('color'));
         $this->_pdfTableSet->getCurrentObject()->setFillColor(new Zend_Pdf_Color_Rgb($colors[0], $colors[1], $colors[2]));
     } else {
         $this->_pdfTableSet->getCurrentObject()->setFillColor(new Zend_Pdf_Color_Rgb(0, 0, 0));
     }
     // Set the font to be used.
     $this->_pdfTableSet->getCurrentObject()->setFont($font, $this->_fontSize);
     // Safe to add any borders now.
     // Border-Right
     if ($this->getOption('border-right')) {
         $colors = explode(',', $this->getOption('border-right'));
         $this->_pdfTableSet->getCurrentObject()->setLineColor(new Zend_Pdf_Color_Rgb($colors[0], $colors[1], $colors[2]));
         // Draw the right border.
         $top = $this->_pdfTableSet->getCurrentRow() + $this->_fontSize;
         $this->_pdfTableSet->getCurrentObject()->drawLine($x + $offset, $top, $x + $offset, $this->_pdfTableSet->getCurrentRow());
     }
     // Draw the text.
     // Perform the alignment calculations. Has to be done after text-wrapping.
     $align = $this->getOption('align');
     $length = $this->_getWidth($this->getText(), $font, $this->_fontSize);
     $length10 = $this->_getWidth($this->getText(), $font, 10);
     switch ($align) {
         case 'center':
             // Center Align
             $leftBound = $x + ($offset - $length) / 2;
             break;
         case 'right':
             // Right Align
             $leftBound = $x + ($offset - $length);
             break;
         default:
             // Left Align
             $leftBound = $x;
             break;
     }
     // Border @todo: make this an option later. Mostly for debuging position.
     /*$borderHeight = $this->_currentHeight;
       foreach($text as $key => $line) {
           $top = $borderHeight + $row->getHeight();
           $pdf->pages[$this->_currentPage]->drawRectangle($x, $top, $x + $offset, $borderHeight, $fillType = Zend_Pdf_Page::SHAPE_DRAW_STROKE);
           if($key < ($numLines-1)) {
               // Move the line pointer down the page.
               $borderHeight -= $row->getHeight();
           }
       }*/
     // Underline: @todo: make this an option later.
     //$pdf->pages[$this->_currentPage]->drawLine($x, $this->_currentHeight-1, $x + $offset, $this->_currentHeight-1);
     // Finally, draw the text in question.
     $tempHeight = $this->_pdfTableSet->getCurrentRow();
     foreach ($text as $key => $line) {
         $this->_pdfTableSet->getCurrentObject()->drawText($line, $leftBound + $this->getOption('indent-left'), $tempHeight, 'UTF-8');
         if ($key < $numLines - 1) {
             // Move the line pointer down the page.
             $tempHeight -= $this->getHeight();
         }
     }
     // Move the x-axis cursor, plus any padding.
     $x += $offset;
     // Restore Font Size to default.
     if ($this->getOption('size')) {
         $this->setFont();
     }
     // Move the line height pointer by the number of actual lines drawn (> 1 when line wrapping).
     $this->setLineHeight($numLines);
     return $x;
 }