View Issue Details

IDProjectCategoryView StatusLast Update
0010995mantisbtreportspublic2014-02-14 02:37
Reporterkabadi Assigned Todhx  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Target Version1.2.4Fixed in Version1.2.4 
Summary0010995: Graphs Plugin: Unable to read/find font
Description

I get the above error for all graphs on Linux server.

I see config_defaults has an entry,
$g_system_font_folder = 'c:/winnt/fonts/';

That isn't going to work on my hosted linux server.

Any ideas?

Tagspatch
Attached Files
0001-Fix-10995-Unable-to-read-or-find-fonts-when-using-Jp.patch (1,753 bytes)   
From e7fd93db2be85398f84f472e7635495e6284219f Mon Sep 17 00:00:00 2001
From: David Hicks <hickseydr@optusnet.com.au>
Date: Sat, 18 Sep 2010 13:35:09 +1000
Subject: [PATCH] Fix #10995: Unable to read or find fonts when using JpGraph

The logic inside the graph_get_font() function of
MantisGraph/core/graph_api.php was completely broken when using JpGraph.

Thanks to Kirill Krasnov for the initial patch.
---
 plugins/MantisGraph/core/graph_api.php |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/plugins/MantisGraph/core/graph_api.php b/plugins/MantisGraph/core/graph_api.php
index 7a1a196b..1749c17 100644
--- a/plugins/MantisGraph/core/graph_api.php
+++ b/plugins/MantisGraph/core/graph_api.php
@@ -51,12 +51,9 @@ if( OFF == plugin_config_get( 'eczlibrary' ) ) {
 }
 
 function graph_get_font() {
-	$t_font = plugin_config_get( 'font', '' );
+	$t_font = plugin_config_get( 'font', 'arial' );
 
 	if ( plugin_config_get( 'eczlibrary' ) == ON ) {
-		$ttf_dir = '';
-		$t_font = '';
-
 		$t_font_map = array(
 			'arial' => 'arial.ttf',
 			'verdana' => 'verdana.ttf',
@@ -70,21 +67,10 @@ function graph_get_font() {
 		);
 
 		if( isset( $t_font_map[$t_font] ) ) {
-			$t_font = $t_font_map[$t_font];
+			return $t_font_map[$t_font];
 		} else {
-			$t_font = 'arial.ttf';
-		}
-
-
-		$t_font_path = get_font_path();
-		if( empty($t_font_path) ) {
-			error_text('unable to load font(s)', 'unable to load font(s)');
-		}
-		$f = $t_font_path . $t_font;
-		if( file_exists($f) === false || is_readable($f) === false ) {
-			error_text('unable to read/find font', 'unable to read/find font');
+			return 'arial.ttf';
 		}
-		return $f;
 	} else {
 		$t_font_map = array(
 			'arial' => FF_ARIAL,
-- 
1.7.2.3

Relationships

has duplicate 0010808 closeddhx Mantis Graphs cannot work well 
has duplicate 0011741 closeddhx Mantis Graphs 1.0 unable to read/find font 
has duplicate 0010720 closeddhx JpGraphs have issues 
has duplicate 0012364 closeddhx The font configuration of MantisGraph 1.0 does not work 
related to 0012725 closedvboctor Solution to "font file not readable/does not exist" seems not to work for JPGraph 

Activities

thraxisp

thraxisp

2009-10-01 21:10

reporter   ~0023048

Have you looked at http://www.mantisbt.org/manual/manual.troubleshooting.jpgraph.php ?

dhx

dhx

2009-10-04 19:56

reporter   ~0023053

I can confirm that in the master branch, the MantisGraph plugin does not appear to use $g_system_font_path when finding fonts for the ezC graphing library. The $g_system_font_path setting does work correctly with jpGraph however.

gfleischer

gfleischer

2009-11-16 20:37

reporter   ~0023731

Last edited: 2009-11-16 20:42

I use jpgraph v3.0.6

I added this to my config_inc.php
$g_use_jpgraph = ON;
$g_jpgraph_path ='/var/www/toto.net/jpgraph/src/';
$g_system_font_path = '/usr/share/fonts/truetype';

Changes with $g_font_per_captcha = 'liberation.ttf' was not working. After the renaming/coping of liberation.ttf files to arial.ttf the graphs working.
The $g_system_font_path and the timeout in the php5.ini (http://www.mantisbt.org/manual/manual.troubleshooting.jpgraph.php) may be important.

vboctor

vboctor

2010-01-02 00:49

manager   ~0024021

Targeted to 1.3.x.

dhx

dhx

2010-09-17 23:46

reporter   ~0026760

I have attached a patch modified from one Kirill Krasnov provided on the developer mailing list.

I would appreciate if someone (or multiple people) could confirm whether the patch solves this issue because I commit it.

Remember to set the system font path configuration option in config_defaults_inc.php first!

Also please provide the version of MantisBT you're using when you provide feedback on the patch.

Thanks

dhx

dhx

2010-10-18 07:16

reporter   ~0027064

No response = assuming this is fixed with the commit of the patch.

If it isn't fixed... please reopen.

Thanks

atrol

atrol

2012-07-28 09:54

developer   ~0032390

For all users that tried to set the mentioned $g_system_font_path
This option does not exist, the right option is $g_system_font_folder

Related Changesets

MantisBT: master 3bb92717

2010-09-17 23:35

dhx


Details Diff
Fix 0010995: Unable to read or find fonts when using JpGraph

The logic inside the graph_get_font() function of
MantisGraph/core/graph_api.php was completely broken when using JpGraph.

Thanks to Kirill Krasnov for the initial patch.
Affected Issues
0010995
mod - plugins/MantisGraph/core/graph_api.php Diff File

MantisBT: master-1.2.x ed4de9ae

2010-09-17 23:35

dhx


Details Diff
Fix 0010995: Unable to read or find fonts when using JpGraph

The logic inside the graph_get_font() function of
MantisGraph/core/graph_api.php was completely broken when using JpGraph.

Thanks to Kirill Krasnov for the initial patch.
Affected Issues
0010995
mod - plugins/MantisGraph/core/graph_api.php Diff File

MantisBT: master 10557b04

2010-10-18 07:47

dhx


Details Diff
Fix 0010995: Correct font paths and error messages for ezGraph

We need to return errors as an image so that they appear within an <img>
tag within HTML. Furthermore, the function needs to return the full path
to the font file in use. This is in contrast to the JpGraph mode where
we only need to return the file name of the font file. This discrepancy
would be good to avoid in the future if possible.
Affected Issues
0010995
mod - plugins/MantisGraph/core/graph_api.php Diff File

MantisBT: master-1.2.x 3f87254d

2010-10-18 07:47

dhx


Details Diff
Fix 0010995: Correct font paths and error messages for ezGraph

We need to return errors as an image so that they appear within an <img>
tag within HTML. Furthermore, the function needs to return the full path
to the font file in use. This is in contrast to the JpGraph mode where
we only need to return the file name of the font file. This discrepancy
would be good to avoid in the future if possible.
Affected Issues
0010995
mod - plugins/MantisGraph/core/graph_api.php Diff File