diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-06-02 14:43:09 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-06-02 14:43:09 +0000 |
commit | b6efb38bbd2ef8d9f9ac110b852ac36711b8c7a7 (patch) | |
tree | ece31ec907520b7bf0a6843894b0cc83ce77b407 /src/driver | |
parent | c2757a0ecfaa7337c34370b831ec7c739ff93e89 (diff) | |
download | zetacomponents-graph-b6efb38bbd2ef8d9f9ac110b852ac36711b8c7a7.zip zetacomponents-graph-b6efb38bbd2ef8d9f9ac110b852ac36711b8c7a7.tar.gz |
- Fixed issue with custom fonts for single elements
Diffstat (limited to 'src/driver')
-rw-r--r-- | src/driver/gd.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/driver/gd.php b/src/driver/gd.php index f7fdb96..4ae4ee2 100644 --- a/src/driver/gd.php +++ b/src/driver/gd.php @@ -258,6 +258,7 @@ class ezcGraphGdDriver extends ezcGraphDriver foreach ( $this->strings as $text ) { $size = $text['options']->minimalUsedFont; + $font = $text['options']->font; $drawColor = $this->allocate( $text['options']->color ); $completeHeight = count( $text['text'] ) * $size + ( count( $text['text'] ) - 1 ) * $this->options->lineSpacing; @@ -276,24 +277,24 @@ class ezcGraphGdDriver extends ezcGraphDriver $yOffset = 0; break; } - + // Render text with evaluated font size foreach ( $text['text'] as $line ) { $string = implode( ' ', $line ); - $boundings = imagettfbbox( $size, 0, $this->options->font->font, $string ); + $boundings = imagettfbbox( $size, 0, $font, $string ); $text['position']->y += $size; switch ( true ) { case ( $text['align'] & ezcGraph::LEFT ): - imagettftext( $image, $size, 0, $text['position']->x, $text['position']->y + $yOffset, $drawColor, $this->options->font->font, $string ); + imagettftext( $image, $size, 0, $text['position']->x, $text['position']->y + $yOffset, $drawColor, $font, $string ); break; case ( $text['align'] & ezcGraph::RIGHT ): - imagettftext( $image, $size, 0, $text['position']->x + ( $text['width'] - $boundings[2] ), $text['position']->y + $yOffset, $drawColor, $this->options->font->font, $string ); + imagettftext( $image, $size, 0, $text['position']->x + ( $text['width'] - $boundings[2] ), $text['position']->y + $yOffset, $drawColor, $font, $string ); break; case ( $text['align'] & ezcGraph::CENTER ): - imagettftext( $image, $size, 0, $text['position']->x + ( ( $text['width'] - $boundings[2] ) / 2 ), $text['position']->y + $yOffset, $drawColor, $this->options->font->font, $string ); + imagettftext( $image, $size, 0, $text['position']->x + ( ( $text['width'] - $boundings[2] ) / 2 ), $text['position']->y + $yOffset, $drawColor, $font, $string ); break; } |