Default font for graphics changed from Vera to LiberationSans-Regular.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 15 Nov 2010 15:25:06 +0000 (15:25 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 15 Nov 2010 15:25:06 +0000 (15:25 +0000)
CHANGELOG.txt
reporting/fonts/LiberationSans-Regular.ttf [new file with mode: 0644]
reporting/fonts/Vera.ttf [deleted file]
reporting/includes/class.graphic.inc
reporting/rep102.php
reporting/rep202.php
reporting/rep706.php
reporting/rep707.php

index 56dc02dec8e1be9520adcc1bfe119a1d43f365cd..7fd1b14ea54373bba543fc9243ba83f7c610c141 100644 (file)
@@ -24,6 +24,14 @@ $ -> Affected files
 $ /purchasing/includes/ui/po_ui.inc
 # Fixed text encoding in graphics
 $ /reporting/includes/class.graphic.inc
+! Default font for graphics changed from Vera to LiberationSans-Regular
+$ /reporting/fonts/LiberationSans-Regular.ttf (new)
+  /reporting/fonts/Vera.ttf (removed)
+  /reporting/includes/class.graphic.inc
+  /reporting/rep102.php
+  /reporting/rep202.php
+  /reporting/rep706.php
+  /reporting/rep707.php
 
 13-Nov-2010 Janusz Dobrowolski
 + New hooks system added
diff --git a/reporting/fonts/LiberationSans-Regular.ttf b/reporting/fonts/LiberationSans-Regular.ttf
new file mode 100644 (file)
index 0000000..2de1063
Binary files /dev/null and b/reporting/fonts/LiberationSans-Regular.ttf differ
diff --git a/reporting/fonts/Vera.ttf b/reporting/fonts/Vera.ttf
deleted file mode 100644 (file)
index 58cd6b5..0000000
Binary files a/reporting/fonts/Vera.ttf and /dev/null differ
index 30daf8a1ee0b00fe714af5408fb7349267cddaf7..d10cc5dbb0b8752ce860eff19ba06cce435957b6 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;
+               putenv('GDFONTPATH='.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' ? 'FreeSans' : 'LiberationSans-Regular';
 
+        $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)
index 7892e2ebc310b686cb9ed67fedb083c8375d4dfd..2daae18d0406c6846f44e9e2fdfc88228b602562 100644 (file)
@@ -230,7 +230,6 @@ function print_aged_customer_analysis()
                $pg->type      = $graphics;
                $pg->skin      = $graph_skin;
                $pg->built_in  = false;
-               $pg->fontfile  = $path_to_root . "/reporting/fonts/Vera.ttf";
                $pg->latin_notation = ($decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != ".");
                $filename = company_path(). "/images/test.png";
                $pg->display($filename, true);
index f921d308ff0292f82a1374249ef0ad8e799f1a5a..c77b657b89e1b021fe658b06c778f479e7419378 100644 (file)
@@ -236,7 +236,6 @@ function print_aged_supplier_analysis()
                $pg->type      = $graphics;
                $pg->skin      = $graph_skin;
                $pg->built_in  = false;
-               $pg->fontfile  = $path_to_root . "/reporting/fonts/Vera.ttf";
                $pg->latin_notation = ($decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != ".");
                $filename = company_path(). "/pdf_files/test.png";
                $pg->display($filename, true);
index 674e25027cdf2a72692200443968212ca8cde232..ef975869b821ddbfee174542a1f2ac7b1fcf0cba 100644 (file)
@@ -306,7 +306,6 @@ function print_balance_sheet()
                $pg->type      = $graphics;
                $pg->skin      = $graph_skin;
                $pg->built_in  = false;
-               $pg->fontfile  = $path_to_root . "/reporting/fonts/Vera.ttf";
                $pg->latin_notation = ($decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != ".");
                $filename = company_path(). "/pdf_files/test.png";
                $pg->display($filename, true);
index 73180d2e1a6e229e0d0d1319ee4e7febcb9557e2..68b62694944c0f2928156c88b612523851a4c25b 100644 (file)
@@ -324,7 +324,6 @@ function print_profit_and_loss_statement()
                $pg->type      = $graphics;
                $pg->skin      = $graph_skin;
                $pg->built_in  = false;
-               $pg->fontfile  = $path_to_root . "/reporting/fonts/Vera.ttf";
                $pg->latin_notation = ($decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != ".");
                $filename = company_path(). "/pdf_files/test.png";
                $pg->display($filename, true);