PHP GD 库,如何在另一个文本块之后粘贴文本

PHP GD Library, how to paste text after another text block

我需要使用 GD 库将一个文本粘贴到另一个文本之后。 Example here。我尝试按照以下方式进行

$text = wordwrap($text, 80, "\n");
$count = substr_count($text, "\n");
$string_number = 14;
$pos = 0;
if ($count >= $string_number) {
    for ($i = 0; $i < 14; $i++) {
        $pos = stripos($text, "\n", $pos) + 1;
    }
    $text = substr($text, 0, $pos);
    //Attempt to calculate coordinates of a text block
    $text_cord = imagettfbbox(14, 0, $font_300_path, $text);
    //And paste text after the end coordinate
    imagettftext($image, 14, 0, 130, $text_cord[3], $blue, font_300_path, 'Need to paste');
 }

imagettftext($image, 14, 0, 130, 293, $black, $font_300_path, $text);

但如果我这样做,我会得到 this

那么,我的问题是,如何在另一个文本块之后粘贴文本?

问题已解决。我只是用 font_size * line_height * number_of_new_lines 找到结束坐标