Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.8.0

Bug #2791 wrong x-axis label position when using ttf font
Submitted: 2004-11-19 09:09 UTC
From: pawel at money dot pl Assigned: nosey
Status: Closed Package: Image_Graph
PHP Version: 4.3.9 OS: linux 2.4
Roadmaps: (Not assigned)    

 [2004-11-19 09:09 UTC] pawel at money dot pl
Description: ------------ Labels for the x-axis are beeing displayed just ON the axis, when I use ttf font. It's not better, when the angle of font is changed (it looks really bad at 270) Reproduce code: --------------- <?php require 'Image/Graph.php'; $graph =& Image_Graph::factory('graph', array(400, 300)); $font =& $graph->addNew('ttf_font', 'arial.ttf'); $font->setSize(9); $font->setAngle(0); $dataset =& Image_Graph::factory('dataset'); $dataset->addPoint('Denmark ', 10); $dataset->addPoint('Norway ', 3); $dataset->addPoint('Sweden ', 8); $dataset->addPoint('Finland ', 5); $plotarea =& $graph->addNew('plotarea'); $ax =& $plotarea->getAxis(IMAGE_GRAPH_AXIS_X); $ax->setFont($font); $plot =&$plotarea->addNew('line', &$dataset); $graph->done(); ?> Expected result: ---------------- Placement of labels should be equal to this represented by the default font


 [2004-11-19 09:42 UTC] pear dot nosey at veggerby dot dk
Granted there is a problem when angling the font at 270 deg, at 0 deg. my Windows box shows if correctly. I wonder if the FreeType for your linux box (or in general) doesn't report the bounds using ImageTTFBox correctly (which I used for placing the font at the right pos)? Could you please test the following: var_dump(imagettfbbox(9, 0, 'arial.ttf', 'Denmark')); var_dump(imagettfbbox(9, 270, 'arial.ttf', 'Denmark')); Thanks...
 [2004-11-19 09:59 UTC] pawel at money dot pl
here is the result: array(8) { [0]=> int(-1) [1]=> int(0) [2]=> int(49) [3]=> int(0) [4]=> int(49) [5]=> int(-11) [6]=> int(-1) [7]=> int(-11) } array(8) { [0]=> int(-2) [1]=> int(-1) [2]=> int(-2) [3]=> int(49) [4]=> int(9) [5]=> int(49) [6]=> int(9) [7]=> int(-1) } Let me know if You want me to send an image that my script generates.
 [2004-11-19 10:41 UTC] pear dot nosey at veggerby dot dk
Your output from ImageTTFbox resembles my results very much (+-2) so that is not the problem. I have looked at it, and have found a problem, which I'll fix ASAP (it is working in my internal-dev-version, not available on CVS though since the PHP guys haven't granted me CVS access yet :)!)