Adjust Leading
sittard - June 17, 2009 - 10:04
| Project: | Textimage |
| Version: | 6.x-2.1 |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed |
Jump to:
Description
Is it possible to adjust the leading (the vertical space between lines of text) ?

#1
Not at this stage, but it is something that I would like to implement in the future.
#2
Looking forward to seeing that - thanks for the quick reply!
#3
Any progress on this?
#4
I have absolutely zero time to work on textimage at the moment, but I would be happy to accept patches.
#5
got my Leading up and running ...
haven't implemented anything in the admin yet , but straight up, HARDCODED into the module code cause I needed it fast.
maybe someone else can work on the admin part so you can adjust leading dynamically ...
so, in the module around line 746 replace this line :
imagettftext($image, $fontsize, $q_angle, $x, $y, $fore, $font, $text);by this block
$lines=explode("\n",$text);for($i=0; $i< count($lines); $i++)
{
$newY=$y+($i * $fontsize * 1.2); //this 1.2 is the leading factor which you can set accordingly
imagettftext($image, $fontsize, $q_angle, $x, $newY, $fore, $font, $lines[$i]);
}
#6
worked a bit more on this
it seemed I needed to make some changes in the character spacing (tracking) too ...
$lines=explode("\n",$text);for($i=0; $i< count($lines); $i++)
{
$x = 0; //init $x pos to zero for each new line.
$newY=$y+($i * $fontsize * 1.2); //this 1.2 is the leading factor which you can set accordingly
for ($j = 0; $j <strlen($lines[$i]); $j++) {
$arr = imagettftext($image, $fontsize, $q_angle, $x, $newY, $fore, $font, $lines[$i]{$j});
$x = $arr[4]+0; //this 0 is the tracking coefficient ... put in any other number to see the difference
}
}