Fixes in sales reports to use debtor_trans.tax_included field instead of trans_tax_de...
[fa-stable.git] / reporting / includes / class.graphic.inc
index 30daf8a1ee0b00fe714af5408fb7349267cddaf7..75e035192d25f6e52c9bd2d8dade4921585c4a12 100644 (file)
@@ -147,12 +147,18 @@ class graph
     var $h3d = 15; // 3D height
        var $built_in = true;
        var $fontfile = "";
-
+       var $encoding;
+       
     function graph()
     {
+               $this->encoding = $_SESSION['language']->encoding;
+               $path = dirname(__FILE__).'/../fonts/';
 
-        $this->x = $this->y = $this->z = array();
+               // 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;
@@ -946,12 +952,11 @@ class graph
                if ($alt && strlen($string) > 12)
                        $string = substr($string, 0, 12);
 
-               $encoding = $_SESSION['language']->encoding;
-               if ($encoding != 'UTF-8') {
+               if ($this->encoding != 'UTF-8') {
                        if (function_exists('iconv'))
-                               $string = iconv($encoding, 'UTF-8', $string);
+                               $string = iconv($this->encoding, 'UTF-8', $string);
                        else
-                               $string = mb_convert_encoding($string, 'UTF-8', $encoding);
+                               $string = mb_convert_encoding($string, 'UTF-8', $this->encoding);
                }
 
        if ($this->built_in)