Exemple #1
0
Fichier : G.php Projet : roojs/pear
 function fromNode($node)
 {
     parent::fromNode($node);
     //----------- applyDynamic...
     // look for
     if (empty($this->children)) {
         return;
     }
     if (empty($this->dynamic)) {
         return;
     }
     $settings = array('rows' => $this->rows, 'cols' => $this->cols, 'dynamic' => $this->dynamic);
     //look for the bounding box..
     $boundingbox = false;
     foreach (array_keys($this->children) as $k) {
         if (!is_a($this->children[$k], 'XML_SvgToPDF_Rect')) {
             continue;
         }
         if (@$this->children[$k]->nonprintable == 'true') {
             $boundingbox = clone $this->children[$k];
             $this->children[$k]->style['fill'] = 'none';
             // unset($this->children[$k]);
         }
     }
     if (!$boundingbox) {
         return;
     }
     //echo "<PRE>";print_r($boundingbox );
     $this->boundingbox = $boundingbox;
     $this->settings = $settings;
     $this->shiftChildren($this->boundingbox->x, $this->boundingbox->y);
 }
Exemple #2
0
 function fromNode($node)
 {
     parent::fromNode($node);
     static $trans = false;
     if (!$trans) {
         $trans = array_flip(get_html_translation_table(HTML_ENTITIES));
     }
     if (@$this->content) {
         if (strpos($this->content, '&') !== false) {
             $this->content = strtr($this->content, $trans);
             $this->content = str_replace('&apos;', "'", $this->content);
         }
         if (false === strpos($this->content, '{')) {
             return;
         }
         preg_match_all('/\\{([a-z_]+(\\(\\))?)\\}/i', $this->content, $matches);
         //if (false !== strpos($this->content,'(')) {
         //    echo "<PRE>";print_R($matches);
         //    exit;
         //}
         $this->args = $matches[1];
         foreach ($this->args as $v) {
             $this->content = str_replace('{' . $v . '}', '%s', $this->content);
         }
         //$this->content = preg_replace('/\{('.implode('|',$matches[1]).')\}/','%s',$this->content);
     }
 }
Exemple #3
0
 function transform()
 {
     parent::transform();
     if (empty($this->transform)) {
         return;
     }
     if (preg_match('/scale\\(([0-9e.-]+),([0-9e.-]+)\\)/', $this->transform, $args)) {
         $xscale = $args[1];
         // do we use this??? = what do do about 'e'?
         $yscale = $args[2];
         $this->style['font-size'] *= $args[1];
     }
 }
Exemple #4
0
 function fromNode($node)
 {
     parent::fromNode($node);
     // look for
     if (!@$this->children) {
         return;
     }
     $settings = array('rows' => 1, 'cols' => 1);
     $isDynamic = false;
     foreach (array_keys($this->children) as $k) {
         if (!is_a($this->children[$k], 'XML_SvgToPDF_Text')) {
             continue;
         }
         if (strpos($this->children[$k]->children[0]->content, '=') === false) {
             continue;
         }
         foreach ($this->children[$k]->children as $o) {
             list($l, $r) = explode('=', $o->content);
             $settings[$l] = $r;
         }
         unset($this->children[$k]);
         $isDynamic = true;
         break;
     }
     if (!$isDynamic) {
         return;
     }
     //look for the bounding box..
     $boundingbox = false;
     foreach (array_keys($this->children) as $k) {
         if (!is_a($this->children[$k], 'XML_SvgToPDF_Rect')) {
             continue;
         }
         if (@$this->children[$k]->nonprintable == 'true') {
             $boundingbox = $this->children[$k];
             // $this->children[$k]->style['fill'] = 'none';
             unset($this->children[$k]);
         }
     }
     if (!$boundingbox) {
         return;
     }
     $this->boundingbox = $boundingbox;
     $this->settings = $settings;
     $this->shiftChildren($this->boundingbox->x, $this->boundingbox->y);
 }
Exemple #5
0
 function fromXmlNode($node)
 {
     parent::fromXmlNode($node);
     $d = explode(' ', trim($this->d));
     $i = 0;
     $data = array();
     while ($i < count($d)) {
         $action = $d[$i];
         switch (strtolower($action)) {
             case 'c':
                 // ????
                 $data[] = array('L', $d[$i + 3], $d[$i + 4]);
                 $i += 7;
                 break;
             case 'm':
                 // move
             // move
             case 'l':
                 // line
                 $data[] = array($action, $d[$i + 1], $d[$i + 2]);
                 $i += 3;
                 break;
             case 'h':
                 // move horizontal
             // move horizontal
             case 'v':
                 // move horizontal
                 $data[] = array($action, $d[$i + 1]);
                 $i += 2;
                 break;
             case 'z':
                 // close path..
                 $data[] = array($action);
                 $i++;
                 break;
             default:
                 echo "oops found something odd in path? '{$action}'";
                 echo $this->d;
                 exit;
                 break;
         }
     }
     $this->d = $data;
 }
Exemple #6
0
 function fromXmlNode($node)
 {
     parent::fromXmlNode($node);
     $this->x = false;
     $this->y = false;
     $this->content = $node->textContent;
     /*
     if (isset($this->x)) {
            unset($this->x); 
     }
     if (isset($this->y)) {
            unset($this->y); 
     }
     */
     static $trans = false;
     if (!$trans) {
         $trans = array_flip(get_html_translation_table(HTML_ENTITIES));
     }
     if (strlen($this->content)) {
         // convert &amp; etc.
         if (strpos($this->content, '&') !== false) {
             $this->content = strtr($this->content, $trans);
             $this->content = str_replace('&apos;', "'", $this->content);
             $this->content = preg_replace_callback('/&#(\\d+);/m', array($this, 'content_replace'), $this->content);
         }
         if (!empty($node->language)) {
             // todo - other conversions....
             $this->content = mb_convert_encoding($this->content, 'BIG-5', 'UTF-8');
         }
         // dynamic parts..
         if (false === strpos($this->content, '{')) {
             return;
         }
         preg_match_all('/\\{([a-z0-9_.]+(\\(\\))?)\\}/i', $this->content, $matches);
         $this->args = $matches[1];
         foreach ($this->args as $v) {
             $this->content = str_replace('{' . $v . '}', '%s', $this->content);
         }
         //$this->content = preg_replace('/\{('.implode('|',$matches[1]).')\}/','%s',$this->content);
     }
 }