Thursday, September 11, 2008

JPGraph Error

I asked a colleague of mine to set up a PHP-Syslog-NG (http://code.google.com/p/php-syslog-ng/) as the central logging system of all our devices and servers. He did this on a FreeBSD 7.0 and everything started working fine but the "Graph" section which works with JPGraph couldn't draw any Graphs and it came up with this message: "JpGraph Error Font file "/usr/share/fonts/truetype/msttcorefonts/verdana.ttf" is not readable or does not exist..
After some digging into the codes and configs I got over the problem following the bellow steps:
  1. Install TrueType font on FreeBSD (XfStt).
  2. Fetch the "verdana.ttf" font and place it in the directory that XfStt created for TrueType fonts.
  3. Change the default "TTF_DIR" parameter.
Step 1:
An easy way to use TrueType fonts in BSD is to install XfStt which is available through ports collection at "/usr/ports/x11-servers/Xfstt/".
After the installation a directory will be created for TrueType fonts at "/usr/local/lib/X11/fonts/TrueType/".
Step 2:
downloading verdana.ttf and placing it in "/usr/local/lib/X11/fonts/TrueType/".
I fetched my copy from "http://www.afosteo.org/Download/Fonts/"
Step 3:
The final step is to point JPgraph TTF_DIR parameter inside the jpg-config.inc configuration file to to proper location.
jpg-config.inc is located at "/usr/svr/php-syslog-ng/html/includes/jpgraph"

Labels: , , ,

4 Comments:

At 11:58 PM, Anonymous Anonymous said...

I just had the same problem with Jpgraph in Debian, setting up LogZilla. Two reasons for failure: Jpgraph looks for fonts that dont exist, Debian Lenny does not provide verdana.ttf font file (in any package).

Solution: (for Debian Lenny)
as root:

mkdir /usr/share/fonts/truetype/msttcorefonts

visit http://www.afosteo.org/Download/Fonts/ and download verdana.ttf, copy it to last created folder.

Re-load Logzilla/Jpgraph page - should work OK.

This will not fix the general problem of Debian Lenny not having the msttcorefonts - I'm still waiting on an easy fix for that.

Cheers,
Mike

 
At 9:17 PM, Blogger Oscar Javier said...

This post has been removed by the author.

 
At 9:19 PM, Blogger Oscar Javier said...

This post has been removed by the author.

 
At 9:22 PM, Blogger Oscar Javier said...

1. apt-get install msttcorefonts

2.vim /var/www/jpgraph-2.3/src/jpg-config.inc.php

DEFINE("TTF_DIR","/usr/share/fonts/truetype/msttcorefonts/");

3. /etc/init.d/apache2 restart

 

Post a Comment

<< Home