1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-29 16:50:07 +02:00

Merge pull request #968 from tomothumb/patch-1

Multibyte text is not rendered
This commit is contained in:
Oliver Vogel
2019-11-02 10:24:56 +01:00
committed by GitHub

View File

@@ -82,6 +82,13 @@ class Font extends \Intervention\Image\AbstractFont
if ($this->hasApplicableFontFile()) {
// imagettfbbox() converts numeric entities to their respective
// character. Preserve any originally double encoded entities to be
// represented as is.
// eg:   will render   rather than its character.
$this->text = preg_replace('/&(#(?:x[a-fA-F0-9]+|[0-9]+);)/', '&\1', $this->text);
$this->text = mb_encode_numericentity($this->text, array(0x0080, 0xffff, 0, 0xffff), 'UTF-8');
// get bounding box with angle 0
$box = imagettfbbox($this->getPointSize(), 0, $this->file, $this->text);