Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
4e8e69dc
Commit
4e8e69dc
authored
Jul 28, 2014
by
Georg Ehrke
Browse files
implement a txt preview fallback for the case that ttf is not support
parent
11214219
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/private/preview/txt.php
View file @
4e8e69dc
...
...
@@ -44,13 +44,20 @@ class TXT extends Provider {
$fontFile
.
=
'/../../../core'
;
$fontFile
.
=
'/fonts/OpenSans-Regular.ttf'
;
$canUseTTF
=
function_exists
(
'imagettftext'
);
foreach
(
$lines
as
$index
=>
$line
)
{
$index
=
$index
+
1
;
$x
=
(
int
)
1
;
$y
=
(
int
)
(
$index
*
$lineSize
);
imagettftext
(
$image
,
$fontSize
,
0
,
$x
,
$y
,
$textColor
,
$fontFile
,
$line
);
if
(
$canUseTTF
===
true
)
{
imagettftext
(
$image
,
$fontSize
,
0
,
$x
,
$y
,
$textColor
,
$fontFile
,
$line
);
}
else
{
$y
-=
$fontSize
;
imagestring
(
$image
,
1
,
$x
,
$y
,
$line
,
$textColor
);
}
if
((
$index
*
$lineSize
)
>=
$maxY
)
{
break
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment