X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Fincludes%2Fclass.graphic.inc;h=75e035192d25f6e52c9bd2d8dade4921585c4a12;hb=90918bc962095868c2c94ca52aff4b353cb68608;hp=02af5f2ad97cb4287a4385a07ee0f1554ccb345a;hpb=bb0ab44f1e86d16179d45c32bef918a7fc485e1e;p=fa-stable.git diff --git a/reporting/includes/class.graphic.inc b/reporting/includes/class.graphic.inc index 02af5f2a..75e03519 100644 --- a/reporting/includes/class.graphic.inc +++ b/reporting/includes/class.graphic.inc @@ -147,11 +147,18 @@ class graph var $h3d = 15; // 3D height var $built_in = true; var $fontfile = ""; - + var $encoding; + function graph() { - $this->x = $this->y = $this->z = array(); + $this->encoding = $_SESSION['language']->encoding; + $path = dirname(__FILE__).'/../fonts/'; + // If you use utf-8 encoding you have to download and install FreeSans.ttf font. + // It is not bundled with application due to its size. + $this->fontfile = $this->encoding=='UTF-8' ? $path.'FreeSans.ttf' : $path.'LiberationSans-Regular.ttf'; + + $this->x = $this->y = $this->z = array(); $this->biggest_x = NULL; $this->biggest_y = NULL; $this->alternate_x = false; @@ -944,6 +951,14 @@ class graph { if ($alt && strlen($string) > 12) $string = substr($string, 0, 12); + + if ($this->encoding != 'UTF-8') { + if (function_exists('iconv')) + $string = iconv($this->encoding, 'UTF-8', $string); + else + $string = mb_convert_encoding($string, 'UTF-8', $this->encoding); + } + if ($this->built_in) { imagestring($img, $size, $x, $y + $alt, $string, $col); @@ -965,6 +980,7 @@ class graph // $angle = -15; //else $angle = 0; + imagettftext($img, $size, $angle, $x, $y + $alt, $col, $this->fontfile, $string); } }