Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@gmail.com>2013-11-13 07:10:28 +0400
committerThomas Steur <thomas.steur@gmail.com>2013-11-13 07:10:28 +0400
commit516c13d9b13ca3b908575eb809f7ad9d9397f0e1 (patch)
tree437fa67ca007fcbc86f633051cfaea625b586beb /libs
parent5c8ba403a8fd8e097b1849d4a12b9a3c4bdde58f (diff)
fixes #4206 it is now possible to render the graphs, fix is verified on the mentioned Piwik instance
Diffstat (limited to 'libs')
-rw-r--r--libs/pChart2.1.3/class/pDraw.class.php16
-rw-r--r--libs/pChart2.1.3/class/pImage.class.php24
2 files changed, 30 insertions, 10 deletions
diff --git a/libs/pChart2.1.3/class/pDraw.class.php b/libs/pChart2.1.3/class/pDraw.class.php
index 8906d7d5d0..fdffa55644 100644
--- a/libs/pChart2.1.3/class/pDraw.class.php
+++ b/libs/pChart2.1.3/class/pDraw.class.php
@@ -1016,17 +1016,27 @@
if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
{
$C_ShadowColor = $this->allocateColor($this->Picture,$this->ShadowR,$this->ShadowG,$this->ShadowB,$this->Shadowa);
- imagettftext($this->Picture,$FontSize,$Angle,$X+$this->ShadowX,$Y+$this->ShadowY,$C_ShadowColor,$FontName,$Text);
+ imagettftext($this->Picture,$FontSize,$Angle,$X+$this->ShadowX,$Y+$this->ShadowY,$C_ShadowColor,$FontName,$this->getEncodedText($Text));
}
$C_TextColor = $this->AllocateColor($this->Picture,$R,$G,$B,$Alpha);
- imagettftext($this->Picture,$FontSize,$Angle,$X,$Y,$C_TextColor,$FontName,$Text);
+ imagettftext($this->Picture,$FontSize,$Angle,$X,$Y,$C_TextColor,$FontName,$this->getEncodedText($Text));
$this->Shadow = $Shadow;
return($TxtPos);
}
+ function getEncodedText($text)
+ {
+ $gdinfo = gd_info();
+ if (!empty($gdinfo['JIS-mapped Japanese Font Support'])) {
+ return mb_convert_encoding($text, "SJIS", "UTF-8");
+ }
+
+ return $text;
+ }
+
/* Draw a gradient within a defined area */
function drawGradientArea($X1,$Y1,$X2,$Y2,$Direction,$Format="")
{
@@ -1388,7 +1398,7 @@
$this->drawArrow($X2,$Y2,$X1,$Y1,$Format);
- $Size = imagettfbbox($FontSize,0,$FontName,$Text);
+ $Size = imagettfbbox($FontSize,0,$FontName,$this->getEncodedText($Text));
$TxtWidth = max(abs($Size[2]-$Size[0]),abs($Size[0]-$Size[6]));
$TxtHeight = max(abs($Size[1]-$Size[7]),abs($Size[3]-$Size[1]));
diff --git a/libs/pChart2.1.3/class/pImage.class.php b/libs/pChart2.1.3/class/pImage.class.php
index 6c9d318ba8..6ad1151b69 100644
--- a/libs/pChart2.1.3/class/pImage.class.php
+++ b/libs/pChart2.1.3/class/pImage.class.php
@@ -97,7 +97,7 @@
imagealphablending($this->Picture,FALSE);
imagefilledrectangle($this->Picture, 0,0,$XSize, $YSize, imagecolorallocatealpha($this->Picture, 255, 255, 255, 127));
imagealphablending($this->Picture,TRUE);
- imagesavealpha($this->Picture,true);
+ imagesavealpha($this->Picture,true);
}
else
{
@@ -190,7 +190,7 @@
/* Return the surrounding box of text area */
function getTextBox_deprecated($X,$Y,$FontName,$FontSize,$Angle,$Text)
{
- $Size = imagettfbbox($FontSize,$Angle,$FontName,$Text);
+ $Size = imagettfbbox($FontSize,$Angle,$FontName,$this->getEncodedText($Text));
$Width = $this->getLength($Size[0],$Size[1],$Size[2],$Size[3])+1;
$Height = $this->getLength($Size[2],$Size[3],$Size[4],$Size[5])+1;
@@ -205,10 +205,20 @@
return($RealPos);
}
+ function getEncodedText($text)
+ {
+ $gdinfo = gd_info();
+ if (!empty($gdinfo['JIS-mapped Japanese Font Support'])) {
+ return mb_convert_encoding($text, "SJIS", "UTF-8");
+ }
+
+ return $text;
+ }
+
/* Return the surrounding box of text area */
function getTextBox($X,$Y,$FontName,$FontSize,$Angle,$Text)
{
- $coords = imagettfbbox($FontSize, 0, $FontName, $Text);
+ $coords = imagettfbbox($FontSize, 0, $FontName, $this->getEncodedText($Text));
$a = deg2rad($Angle); $ca = cos($a); $sa = sin($a); $RealPos = array();
for($i = 0; $i < 7; $i += 2)
@@ -247,7 +257,7 @@
if ( $FontName != NULL )
$this->FontName = $FontName;
-
+
if ( $FontSize != NULL )
$this->FontSize = $FontSize;
}
@@ -332,7 +342,7 @@
if ( $this->ImageMapStorageMode == NULL ) { return(-1); }
if ( is_array($NewTitle) ) { $NewTitle = $this->removeVOIDFromArray($OldTitle, $NewTitle); }
-
+
if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
{
if(!isset($_SESSION)) { return(-1); }
@@ -373,7 +383,7 @@
if ( $this->ImageMapStorageMode == NULL ) { return(-1); }
$Values = $this->removeVOIDFromArray($Title, $Values);
- $ID = 0;
+ $ID = 0;
if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
{
if(!isset($_SESSION)) { return(-1); }
@@ -460,7 +470,7 @@
$Picture = imagecreatetruecolor($this->XSize,$this->YSize);
imagecopy($Picture,$this->Picture,0,0,0,0,$this->XSize,$this->YSize);
-
+
for($i=1;$i<=$Height;$i++)
{
if ( $Y+($i-1) < $this->YSize && $Y-$i > 0 ) { imagecopymerge($Picture,$this->Picture,$X,$Y+($i-1),$X,$Y-$i,$Width,1,$StartAlpha-$AlphaStep*$i); }