3 /* the actual text container..
5 does a quick bit of parsing to see if it a {template}var ..
8 class XML_SvgToPDF_Tspan extends XML_SvgToPDF_Base {
10 var $content = ''; // applies to tspan only..
13 var $args = array(); // arguments..
16 function fromXmlNode($node) {
17 parent::fromXmlNode($node);
20 $this->content = $node->textContent;
22 if (isset($this->x)) {
25 if (isset($this->y)) {
29 static $trans = false;
31 $trans = array_flip(get_html_translation_table(HTML_ENTITIES));
34 if (strlen($this->content)) {
36 if (strpos($this->content,'&') !== false) {
37 $this->content = strtr($this->content, $trans);
38 $this->content = str_replace(''',"'",$this->content);
40 $this->content = preg_replace_callback('/&#(\d+);/m', array($this, 'content_replace'),
43 if (!empty($node->language)) {
44 // todo - other conversions....
45 $this->content = mb_convert_encoding($this->content,'BIG-5','UTF-8');
49 if (false === strpos($this->content,'{')) {
52 preg_match_all('/\{([a-z0-9_.]+(\(\))?)\}/i',$this->content,$matches);
54 $this->args = $matches[1];
55 foreach($this->args as $v) {
56 $this->content = str_replace('{'.$v.'}', '%s',$this->content);
58 //$this->content = preg_replace('/\{('.implode('|',$matches[1]).')\}/','%s',$this->content);
64 function content_replace($matches) { // php5.2 needs this to be a function...
65 return chr($matches[1]);
69 function shift($x,$y) // disable shifting on text