From 5f5ab3b0d10b9e2176ba3d93a798111fc65ed215 Mon Sep 17 00:00:00 2001 From: Tomoyuki Tsujimoto Date: Tue, 3 Sep 2019 05:17:03 +0900 Subject: [PATCH] Update Font.php --- src/Intervention/Image/Gd/Font.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Intervention/Image/Gd/Font.php b/src/Intervention/Image/Gd/Font.php index 440d2c52..142b7944 100644 --- a/src/Intervention/Image/Gd/Font.php +++ b/src/Intervention/Image/Gd/Font.php @@ -82,6 +82,11 @@ 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