diff options
author | Morris Jobke <hey@morrisjobke.de> | 2014-06-11 01:07:32 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2014-06-11 01:07:32 +0200 |
commit | e89f1784a3294e8e5f9a56a639fe480a74eac592 (patch) | |
tree | 3251ef21ee2b52ecb71203aa2d22552546209db9 | |
parent | 077a542d59ea5c992ebb1b3ac0e6117f6289582c (diff) | |
parent | e047e28ac569873f07508f20ed0b97dc35b90495 (diff) | |
download | nextcloud-server-e89f1784a3294e8e5f9a56a639fe480a74eac592.tar.gz nextcloud-server-e89f1784a3294e8e5f9a56a639fe480a74eac592.zip |
Merge pull request #8972 from owncloud/use_imagettftext_take2
make text preview backend use imagettftext, fixes #8087
-rw-r--r-- | core/fonts/OpenSans-Regular.ttf | bin | 0 -> 217360 bytes | |||
-rw-r--r-- | lib/private/preview/txt.php | 8 |
2 files changed, 6 insertions, 2 deletions
diff --git a/core/fonts/OpenSans-Regular.ttf b/core/fonts/OpenSans-Regular.ttf Binary files differnew file mode 100644 index 00000000000..db433349b70 --- /dev/null +++ b/core/fonts/OpenSans-Regular.ttf 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; |