1 diff -Naur jpgraph-1.5.2.org/src/jpgraph_dir.php jpgraph-1.5.2/src/jpgraph_dir.php
2 --- jpgraph-1.5.2.org/src/jpgraph_dir.php 2002-03-01 01:46:17.000000000 +0100
3 +++ jpgraph-1.5.2/src/jpgraph_dir.php 2008-12-09 21:55:28.000000000 +0100
6 // Directory for TTF fonts. Must end with '/'
7 DEFINE("TTF_DIR","/usr/local/fonts/ttf/");
8 +DEFINE("LIBERATION_DIR","/usr/share/fonts/liberation/");
11 diff -Naur jpgraph-1.5.2.org/src/jpgraph_gantt.php jpgraph-1.5.2/src/jpgraph_gantt.php
12 --- jpgraph-1.5.2.org/src/jpgraph_gantt.php 2002-03-01 01:46:17.000000000 +0100
13 +++ jpgraph-1.5.2/src/jpgraph_gantt.php 2008-12-09 21:55:28.000000000 +0100
14 @@ -1157,10 +1157,6 @@
15 $this->iCaptionMargin=$aMarg;
18 - function GetLineNbr() {
22 function GetAbsHeight($aImg) {
26 $this->iProgress = $aProg;
29 - function SetPattern($aPattern,$aColor="blue",$aDensity=98) {
30 + function SetPattern($aPattern,$aColor="blue",$aDensity=100) {
31 $this->iPattern = $aPattern;
32 $this->iColor = $aColor;
33 $this->iDensity = $aDensity;
34 diff -Naur jpgraph-1.5.2.org/src/jpgraph.php jpgraph-1.5.2/src/jpgraph.php
35 --- jpgraph-1.5.2.org/src/jpgraph.php 2002-03-01 01:46:17.000000000 +0100
36 +++ jpgraph-1.5.2/src/jpgraph.php 2008-12-09 21:55:28.000000000 +0100
38 // regenerate the image. Note that even if reading the cache is
39 // disabled the cached will still be updated with the newly generated
40 // image. Set also "USE_CACHE" below.
41 -DEFINE("READ_CACHE",true);
42 +//DEFINE("READ_CACHE",true);
43 +DEFINE("READ_CACHE",false);
45 // Should the cache be used at all? By setting this to false no
46 // files will be generated in the cache directory.
48 // false will still create the image in the cache directory
49 // just not use it. By setting USE_CACHE=false no files will even
50 // be generated in the cache directory.
51 -DEFINE("USE_CACHE",true);
52 +//DEFINE("USE_CACHE",true);
53 +DEFINE("USE_CACHE",false);
55 // If the color palette is full should JpGraph try to allocate
56 // the closest match? If you plan on using background image or
58 DEFINE("FF_COMIC",14);
59 DEFINE("FF_ARIAL",15);
61 +DEFINE("FF_LIBERATION_SANS",17);
64 DEFINE("FS_NORMAL",1);
66 // Check what version of the GD library is being used
68 if(function_exists('imagecopyresampled') ) {
70 + $GLOBALS['gd2'] = true;
71 $copyfunc = "imagecopyresampled";
72 } elseif(function_exists('imagecopyresized')) {
73 $copyfunc = "imagecopyresized";
75 + $GLOBALS['gd2'] = false;
78 JpGraphError::Raise("<b>JpGraph Error:</b> Your PHP installation does not
80 // (top level), i.e it is safe to call this function
81 // from a script that uses JpGraph
82 function GenImgName() {
83 - global $HTTP_SERVER_VARS;
84 $supported = imagetypes();
85 if( $supported & IMG_PNG )
89 elseif( $supported & IMG_JPG )
91 - if( !isset($HTTP_SERVER_VARS['PHP_SELF']) )
92 + if( !isset($_SERVER['PHP_SELF']) )
93 JpGraphError::Raise("<b>JpGraph Error:</b> Can't access PHP_SELF, PHP global variable. You can't run PHP from command line
94 if you want to use the 'auto' naming of cache or image files.");
95 - $fname=basename($HTTP_SERVER_VARS['PHP_SELF']);
96 + $fname=basename($_SERVER['PHP_SELF']);
97 // Replace the ".php" extension with the image format extension
98 return substr($fname,0,strlen($fname)-4).".".$img_format;
102 // Specify a background image
103 function SetBackgroundImage($aFileName,$aBgType=BKIMG_FILLPLOT,$aImgFormat="png") {
104 +/* CB Not any more bugging
106 if( $GLOBALS["gd2"] && !USE_TRUECOLOR ) {
107 JpGraphError::Raise("<b>JpGraph Error:</b>You are using GD 2.x and are
109 using any truetype fonts with truecolor images will result in very
110 poor quality fonts.");
114 $this->background_image = $aFileName;
115 $this->background_image_type=$aBgType;
116 @@ -1064,6 +1068,10 @@
117 $this->img->Rectangle(0,0,$this->img->width-1,$this->img->height-1);
120 + // Set Margin by Christian Bayle
121 + function SetMargin($lm,$rm,$tm,$bm) {
122 + $this->img->SetMargin($lm,$rm,$tm,$bm);
127 @@ -1084,7 +1092,8 @@
128 FF_HANDWRT => TTF_DIR."handwriting",
129 FF_COMIC => TTF_DIR."comic",
130 FF_ARIAL => TTF_DIR."arial",
131 - FF_BOOK => TTF_DIR."bookant");
132 + FF_BOOK => TTF_DIR."bookant",
133 + FF_LIBERATION_SANS => LIBERATION_DIR."LiberationSans-Regular");
137 @@ -3183,7 +3192,7 @@
141 - elseif($this->font_family >= FF_COURIER && $this->font_family <= FF_BOOK) { // TTF font
142 + elseif($this->font_family >= FF_COURIER && $this->font_family <= FF_LIBERATION_SANS) { // TTF font
143 $file = $this->ttf->File($this->font_family,$this->font_style);
145 $bbox=ImageTTFBBox($this->font_size,$angle,$file,$txt);
146 @@ -3208,7 +3217,7 @@
150 - JpGraphError::Raise("<b>JpGraph Error:</b> Unknown font font family specification. ");
151 + JpGraphError::Raise("<b>JpGraph Error:</b> Unknown font family specification: ". $this->font_family);
154 function SetMargin($lm,$rm,$tm,$bm) {
155 @@ -3490,7 +3499,16 @@
158 function FilledCircle($xc,$yc,$r) {
159 - imagefilledellipse($this->img,$xc,$yc,2*$r,2*$r,$this->current_color);
160 + if( $GLOBALS['gd2'] ) {
161 + imagefilledellipse($this->img,$xc,$yc,2*$r,2*$r,$this->current_color);
164 + for( $i=1; $i < 2*$r; $i += 2 ) {
165 + $this->Arc($xc,$yc,$i,$i,0,360);
166 + $this->Arc($xc,$yc,$i+1,$i,0,360);
167 + $this->Arc($xc,$yc,$i+1,$i+1,0,360);
172 // Linear Color InterPolation