Backup
This commit is contained in:
parent
2d631411cb
commit
96cd1ea48e
@ -125,6 +125,9 @@ class TextRenderer
|
|||||||
$b = (int) ($this->colorB * 255);
|
$b = (int) ($this->colorB * 255);
|
||||||
|
|
||||||
// Render text to surface with anti-aliasing (blended mode for smooth text)
|
// Render text to surface with anti-aliasing (blended mode for smooth text)
|
||||||
|
if (strlen($text) < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$surface = ttf_render_text_blended($this->font, $text, $r, $g, $b);
|
$surface = ttf_render_text_blended($this->font, $text, $r, $g, $b);
|
||||||
if (!$surface) {
|
if (!$surface) {
|
||||||
return;
|
return;
|
||||||
@ -144,7 +147,7 @@ class TextRenderer
|
|||||||
'x' => $x,
|
'x' => $x,
|
||||||
'y' => $y,
|
'y' => $y,
|
||||||
'w' => $textSize['w'],
|
'w' => $textSize['w'],
|
||||||
'h' => $textSize['h']
|
'h' => $textSize['h'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Note: Texture and surface are automatically cleaned up by PHP resource destructors
|
// Note: Texture and surface are automatically cleaned up by PHP resource destructors
|
||||||
@ -165,7 +168,9 @@ class TextRenderer
|
|||||||
$r = (int) ($this->colorR * 255);
|
$r = (int) ($this->colorR * 255);
|
||||||
$g = (int) ($this->colorG * 255);
|
$g = (int) ($this->colorG * 255);
|
||||||
$b = (int) ($this->colorB * 255);
|
$b = (int) ($this->colorB * 255);
|
||||||
|
if (strlen($text) < 1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
$surface = ttf_render_text_blended($this->font, $text, $r, $g, $b);
|
$surface = ttf_render_text_blended($this->font, $text, $r, $g, $b);
|
||||||
if (!$surface) {
|
if (!$surface) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user