]> granicus.if.org Git - php/commitdiff
- MFH: add support for entities in hexadecimal format, like © can
authorPierre Joye <pajoye@php.net>
Wed, 23 Aug 2006 20:22:31 +0000 (20:22 +0000)
committerPierre Joye <pajoye@php.net>
Wed, 23 Aug 2006 20:22:31 +0000 (20:22 +0000)
  be passed as &#169 or &#xA9; (sync with gd)

NEWS
ext/gd/libgd/gdft.c

diff --git a/NEWS b/NEWS
index eb31acff42cd4321f184264d06c772b5844596f3..aa758dccdfaca839113deab9d7ab8d46633a8d33 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Sep 2006, PHP 5.2.0
+- Added support for hexadecimal entity in imagettftext() for the bundled GD.
+  (Pierre)
 - Fixed bug #38543 (shutdown_executor() may segfault when memory_limit is too
   low). (Dmitry)
 - Fixed bug #38535 (memory corruption in pdo_pgsql driver on error retrieval
index a09bdcba6d6a8a9ffb98496db6981829019bafc8..6603cd64c31bbf94396073dd036b7696eb611c99 100644 (file)
@@ -207,12 +207,28 @@ static int gdTcl_UtfToUniChar (char *str, Tcl_UniChar * chPtr)
 
                byte = *((unsigned char *) (str + 1));
                if (byte == '#') {
-                       for (i = 2; i < 8; i++) {
-                               byte = *((unsigned char *) (str + i));
-                               if (byte >= '0' && byte <= '9') {
-                                       n = (n * 10) + (byte - '0');
-                               } else {
-                                       break;
+                       byte = *((unsigned char *) (str + 2));
+                       if (byte == 'x' || byte == 'X') {
+                               for (i = 3; i < 8; i++) {
+                                       byte = *((unsigned char *) (str + i));
+                                       if (byte >= 'A' && byte <= 'F')
+                                               byte = byte - 'A' + 10;
+                                       else if (byte >= 'a' && byte <= 'f')
+                                               byte = byte - 'a' + 10;
+                                       else if (byte >= '0' && byte <= '9')
+                                               byte = byte - '0';
+                                       else
+                                               break;
+                                       n = (n * 16) + byte;
+                               }
+                       } else {
+                               for (i = 2; i < 8; i++) {
+                                       byte = *((unsigned char *) (str + i));
+                                       if (byte >= '0' && byte <= '9') {
+                                               n = (n * 10) + (byte - '0');
+                                       } else {
+                                               break;
+                                       }
                                }
                        }
                        if (byte == ';') {