summaryrefslogtreecommitdiffstats
path: root/src/driver/svg.php
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-10-04 12:32:58 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-10-04 12:32:58 +0000
commit77164b43d94618e02f7a1c89708baca72758ca3d (patch)
treec997d9f5c3bf73cce630b859171587e27721deb4 /src/driver/svg.php
parenta39691f135871fd24f67eb121278a82f9318a756 (diff)
downloadzetacomponents-graph-77164b43d94618e02f7a1c89708baca72758ca3d.zip
zetacomponents-graph-77164b43d94618e02f7a1c89708baca72758ca3d.tar.gz
- Added text shadow to font options
- Added text shadow support in SVG and GD driver
Diffstat (limited to 'src/driver/svg.php')
-rw-r--r--src/driver/svg.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/driver/svg.php b/src/driver/svg.php
index 8830dfa..459c60d 100644
--- a/src/driver/svg.php
+++ b/src/driver/svg.php
@@ -694,6 +694,30 @@ class ezcGraphSvgDriver extends ezcGraphDriver
break;
}
+ // Optionally draw text shadow
+ if ( $text['font']->textShadow === true )
+ {
+ $textNode = $this->dom->createElement( 'text', $string );
+ $textNode->setAttribute( 'id', $text['id'] );
+ $textNode->setAttribute( 'x', $position->x + $this->options->graphOffset->x + $text['font']->textShadowOffset );
+ $textNode->setAttribute( 'text-length', $this->getTextWidth( $string, $size ) . 'px' );
+ $textNode->setAttribute( 'y', $position->y + $this->options->graphOffset->y + $text['font']->textShadowOffset );
+ $textNode->setAttribute(
+ 'style',
+ sprintf(
+ 'font-size: %dpx; font-family: %s; fill: #%02x%02x%02x; fill-opacity: %.2f; stroke: none;',
+ $size,
+ $text['font']->name,
+ $text['font']->textShadowColor->red,
+ $text['font']->textShadowColor->green,
+ $text['font']->textShadowColor->blue,
+ 1 - ( $text['font']->textShadowColor->alpha / 255 )
+ )
+ );
+ $this->elements->appendChild( $textNode );
+ }
+
+ // Finally draw text
$textNode = $this->dom->createElement( 'text', $string );
$textNode->setAttribute( 'id', $text['id'] );
$textNode->setAttribute( 'x', $position->x + $this->options->graphOffset->x );
@@ -711,7 +735,6 @@ class ezcGraphSvgDriver extends ezcGraphDriver
1 - ( $text['font']->color->alpha / 255 )
)
);
-
$this->elements->appendChild( $textNode );
$text['position']->y += $size * $this->options->lineSpacing;
OpenPOWER on IntegriCloud