make text preview backend use imagettftext, fixes #8087

This commit is contained in:
Georg Ehrke 2014-06-10 17:29:40 +02:00
parent 6546b589ce
commit e047e28ac5
2 changed files with 6 additions and 2 deletions

Binary file not shown.

View File

@ -40,13 +40,17 @@ class TXT extends Provider {
imagecolorallocate($image, 255, 255, 255); imagecolorallocate($image, 255, 255, 255);
$textColor = imagecolorallocate($image, 0, 0, 0); $textColor = imagecolorallocate($image, 0, 0, 0);
$fontFile = __DIR__;
$fontFile .= '/../../../core';
$fontFile .= '/fonts/OpenSans-Regular.ttf';
foreach($lines as $index => $line) { foreach($lines as $index => $line) {
$index = $index + 1; $index = $index + 1;
$x = (int) 1; $x = (int) 1;
$y = (int) ($index * $lineSize) - $fontSize; $y = (int) ($index * $lineSize);
imagestring($image, 1, $x, $y, $line, $textColor); imagettftext($image, $fontSize, 0, $x, $y, $textColor, $fontFile, $line);
if(($index * $lineSize) >= $maxY) { if(($index * $lineSize) >= $maxY) {
break; break;