protected function TextFit($text, $x, $y, $w, $h, $attribs = NULL, $styles = NULL) { $pos = array('onload' => "textFit(evt,{$x},{$y},{$w},{$h})"); if (is_array($attribs)) { $pos = array_merge($attribs, $pos); } $txt = $this->Element('text', $pos, $styles, $text); /** Uncomment to see the box $rect = array('x' => $x, 'y' => $y, 'width' => $w, 'height' => $h, 'fill' => 'none', 'stroke' => 'black'); $txt .= $this->Element('rect', $rect); **/ $this->AddFunction('textFit'); return $txt; }