aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2014-06-10 17:29:40 +0200
committerGeorg Ehrke <developer@georgehrke.com>2014-06-10 17:29:40 +0200
commite047e28ac569873f07508f20ed0b97dc35b90495 (patch)
tree331e2be8ba3b5b0ea9b671ee551a1fa1677c2754 /lib
parent6546b589ce8cdf786cc0708a8e8c0de2aa61eb50 (diff)
downloadnextcloud-server-e047e28ac569873f07508f20ed0b97dc35b90495.tar.gz
nextcloud-server-e047e28ac569873f07508f20ed0b97dc35b90495.zip
make text preview backend use imagettftext, fixes #8087
Diffstat (limited to 'lib')
-rw-r--r--lib/private/preview/txt.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/preview/txt.php b/lib/private/preview/txt.php
index c9aa20968d8..063543c6279 100644
--- a/lib/private/preview/txt.php
+++ b/lib/private/preview/txt.php
@@ -40,13 +40,17 @@ class TXT extends Provider {
imagecolorallocate($image, 255, 255, 255);
$textColor = imagecolorallocate($image, 0, 0, 0);
+ $fontFile = __DIR__;
+ $fontFile .= '/../../../core';
+ $fontFile .= '/fonts/OpenSans-Regular.ttf';
+
foreach($lines as $index => $line) {
$index = $index + 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) {
break;