diff --git a/src/PHPImage.php b/src/PHPImage.php index 85e2eaf..7d21797 100644 --- a/src/PHPImage.php +++ b/src/PHPImage.php @@ -937,7 +937,7 @@ public function text($text, $options=array()){ foreach($lines as $index => $line){ // Get Y offset as it 0 Y is the lower-left corner of the character $testbox = imageftbbox($fontSize, $angle, $fontFile, $line); - $offsety = abs($testbox[7]); + $offsety = $fontSize; $offsetx = 0; $actualWidth = abs($testbox[6] - $testbox[4]); $actualHeight = $lineHeight; diff --git a/test/examples/line-height.jpg b/test/examples/line-height.jpg new file mode 100644 index 0000000..eb7d262 Binary files /dev/null and b/test/examples/line-height.jpg differ diff --git a/test/font/arial.ttf b/test/font/arial.ttf old mode 100755 new mode 100644 diff --git a/test/line-height.php b/test/line-height.php new file mode 100644 index 0000000..d8bd017 --- /dev/null +++ b/test/line-height.php @@ -0,0 +1,19 @@ +setDimensionsFromImage($bg); +$image->draw($bg); +$image->setFont('./font/arial.ttf'); +$image->setTextColor(array(255, 255, 255)); +$image->rectangle(40, 40, 120, 120, array(0, 0, 0), 0.5); +$image->textBox('Ваша фобия на сегодня астрофобия', array( + 'width' => 400, + 'fontSize' => 48, + 'x' => 50, + 'y' => 50 +)); + +$image->snapshot('./examples/line-height.jpg');