View unanswered posts | View active topics It is currently Thu Mar 28, 2024 2:46 pm



Reply to topic  [ 1 post ] 
Problem with drawtext function 
Author Message
New pChart user
New pChart user

Joined: Mon Nov 07, 2011 3:18 pm
Posts: 3
Post Problem with drawtext function
Dear programmer,

we found an main Problem in your drawtext function.

the problem ist that wehen you draw 2 strings like:

string1:3
string2:Testg

the 3 and the T are not on the same high. So its allways looks like the 3 is deeper than the T.

For thsi we found an fix:

File:pImage.class.php

function getTextBox (row 209)

Code:
$coords = imagettfbbox($FontSize, 0, $FontName, $Text);
     $coords2 = imagettfbbox($FontSize, 0, $FontName, $Text.'3Bg');

     $a = deg2rad($Angle); $ca = cos($a); $sa = sin($a); $RealPos = array();
     for($i = 0; $i < 7; $i += 2)
      {
       $RealPos[$i/2]["X"] = $X + round($coords[$i] * $ca + $coords[$i+1] * $sa);
       $RealPos[$i/2]["Y"] = $Y + round($coords2[$i+1] * $ca - $coords2[$i] * $sa);
      }

we insert cords2 for the height calculation the other for the width.

this works but it isnt beautiful.

mybe you can fix ths problem better


Mon Nov 19, 2012 1:11 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron