diff options
-rwxr-xr-x | libs/pChart/class/pData.class.php | 3 | ||||
-rwxr-xr-x | libs/pChart/class/pDraw.class.php | 16 | ||||
-rwxr-xr-x | libs/pChart/class/pImage.class.php | 14 |
3 files changed, 27 insertions, 6 deletions
diff --git a/libs/pChart/class/pData.class.php b/libs/pChart/class/pData.class.php index 2dfff95444..49d16a33bd 100755 --- a/libs/pChart/class/pData.class.php +++ b/libs/pChart/class/pData.class.php @@ -701,6 +701,7 @@ }
/* Create a dataset based on a formula */
+ /* COMMENTED BY PIWIK to avoid eval()
function createFunctionSerie($SerieName,$Formula="",$Options="")
{
$MinX = isset($Options["MinX"]) ? $Options["MinX"] : -10;
@@ -729,7 +730,7 @@ $this->addPoints($Result,$SerieName);
if ( $AutoDescription ) { $this->setSerieDescription($SerieName,$Formula); }
if ( $RecordAbscissa ) { $this->addPoints($Abscissa,$AbscissaSerie); }
- }
+ }*/
function negateValues($Series)
{
diff --git a/libs/pChart/class/pDraw.class.php b/libs/pChart/class/pDraw.class.php index 2e75aeb725..ef638bbb9e 100755 --- a/libs/pChart/class/pDraw.class.php +++ b/libs/pChart/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/pChart/class/pImage.class.php b/libs/pChart/class/pImage.class.php index a21466afa7..900174d720 100755 --- a/libs/pChart/class/pImage.class.php +++ b/libs/pChart/class/pImage.class.php @@ -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)
|