Skip to content
Snippets Groups Projects
Commit e89f1784 authored by Morris Jobke's avatar Morris Jobke
Browse files

Merge pull request #8972 from owncloud/use_imagettftext_take2

make text preview backend use imagettftext, fixes #8087
parents 077a542d e047e28a
No related branches found
No related tags found
No related merge requests found
File added
...@@ -40,13 +40,17 @@ class TXT extends Provider { ...@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment