/**
  * Construct a text table object
  * @param numeric $max_width -- the maximum width of the table
  * @param I2CE_FontMetric $font_metric 
  * @param I2CE_Hyphen $hyphen  -- default is null
  * @param int $algorithm -- the word wrapping algorithm: default = 'Greedy'
  * @param I2CE_Encoding encoding -- the encoding we want to use
  * @param numeric $col_spacing -- the spacing used between the columns. Default to 0
  * @param string $widthstyle -- how we determine the width  of the columns.  Defaults to 'Header'
  */
 public function __construct($max_table_width, &$font_metric, &$hyphen = null, &$encoding, $col_spacing = 0, $widthstyle = 'Header', $algorithm = 'Greedy')
 {
     parent::__construct($font_metric, $hyphen, $encoding, $algorithm);
     $widths = array();
     $this->widthstyle = $widthstyle;
     $this->encoding = $encoding;
     $this->font_metric = $font_metric;
     $this->max_table_width = $max_table_width;
     $this->col_spacing = $col_spacing;
     $this->min_cell_width = 0;
 }
Example #2
0
 /**
  *Puts in a wordwrapped text cell
  *@param I2CE_TextCell $text_cell
  *@param string $text
  */
 protected function displayTextCell($text_cell, $text)
 {
     if (!$text_cell instanceof I2CE_TextCell) {
         return;
     }
     if (!($fm = $this->text_table->getFontMetric()) instanceof I2CE_FontMetric) {
         return;
     }
     if ($fm instanceof I2CE_FontMetricMultiDirection) {
         $fm->setDirection('H');
         //UGLY!!!
     }
     $adj = ($fm->getDescender() + $fm->getLinegap()) / (1000 * $this->k);
     $line_height = $fm->getFontSize() / $this->k + $adj;
     if ($this->line_spacing > 0) {
         $line_height = $line_height * $this->line_spacing;
     }
     $width = $text_cell->getWidth();
     $lines = $text_cell->getLineBreaks($text);
     foreach ($lines as $line) {
         $this->Cell($width, $line_height, $line, 0, 1, 'L');
     }
 }