svn: /pear/packages/Image_Canvas/trunk/Image/Canvas/ SVG.php
| From: | Stefan Neufeind | Date: | Sat, 26 Dec 2009 19:33:25 +0000 |
| Subject: | svn: /pear/packages/Image_Canvas/trunk/Image/Canvas/ SVG.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-58380@lists.php.net to get a copy of this message | ||
neufeind Sat, 26 Dec 2009 19:33:25 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=292672
Log:
* #16833: patch for newlines in SVG addText()
* #16925: Angled text improperly displayed in SVG (Note: a first fix; might need further
testing/adjustments)
Bugs: http://pear.php.net/bugs/16833 (unknown)
http://pear.php.net/bugs/16925 (unknown)
Changed paths:
U pear/packages/Image_Canvas/trunk/Image/Canvas/SVG.php
Modified: pear/packages/Image_Canvas/trunk/Image/Canvas/SVG.php
===================================================================
--- pear/packages/Image_Canvas/trunk/Image/Canvas/SVG.php 2009-12-26 19:30:18 UTC (rev 292671)
+++ pear/packages/Image_Canvas/trunk/Image/Canvas/SVG.php 2009-12-26 19:33:25 UTC (rev 292672)
@@ -694,7 +694,7 @@
function textWidth($text)
{
if ((isset($this->_font['vertical'])) &&
($this->_font['vertical'])) {
- return $this->_font['size'];
+ return $this->_font['size'] * count(explode("\n",$text));
} else {
return round($this->_font['size'] * 0.7 * strlen($text));
}
@@ -712,7 +712,7 @@
if ((isset($this->_font['vertical'])) &&
($this->_font['vertical'])) {
return round($this->_font['size'] * 0.7 * strlen($text));
} else {
- return $this->_font['size'];
+ return $this->_font['size'] * count(explode("\n",$text));
}
}
@@ -793,7 +793,7 @@
'x="0" ' .
'y="0" ' .
(isset($this->_font['angle']) &&
($this->_font['angle'] > 0) ?
- 'transform="rotate(' . (($this->_font['angle'] + 180) %
360) . ')" ' :
+ 'transform="rotate(' . (((-1) * $this->_font['angle'])
% 360) . ')" ' :
''
) .
'style="' .
@@ -806,7 +806,7 @@
) . ';' . $align . '"' .
($attrs ? ' ' . $attrs : '') .
'>' .
- htmlspecialchars($text) .
+ ('<tspan x="0" dy="0em">'.
implode('</tspan><tspan x="0" dy="1em">',
explode("\n",htmlspecialchars($text))).'</tspan>') .
'</text>' . "\n" .
$this->_indent . '</g>',
$params