]> granicus.if.org Git - php/commitdiff
Fixed bug #23527 (PostScript Type 1 font do not render properly)
authorIlia Alshanetsky <iliaa@php.net>
Thu, 15 May 2003 02:25:50 +0000 (02:25 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 15 May 2003 02:25:50 +0000 (02:25 +0000)
ext/gd/gd.c

index df06e051cacd124b94aaaa00a43ffd0ba3a5b181..dd8a7e7996ad25c2c6bd0189ea19f1a0a6ab280c 100644 (file)
@@ -3478,29 +3478,32 @@ PHP_FUNCTION(imagepstext)
                transform = T1_RotateMatrix(NULL, angle);
        }
 
-       extend = T1_GetExtend(*f_ind);
-       str_path = T1_GetCharOutline(*f_ind, str[0], size, transform);
+       if (width) {
+               extend = T1_GetExtend(*f_ind);
+               str_path = T1_GetCharOutline(*f_ind, str[0], size, transform);
 
-       if (!str_path) {
-               if (T1_errno) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "T1Lib Error: %s", T1_StrError(T1_errno));
+               if (!str_path) {
+                       if (T1_errno) {
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "T1Lib Error: %s", T1_StrError(T1_errno));
+                       }
+                       RETURN_FALSE;
                }
-               RETURN_FALSE;
-       }
 
-       for (i = 1; i < str_len; i++) {
-               amount_kern = (int) T1_GetKerning(*f_ind, str[i - 1], str[i]);
-               amount_kern += str[i - 1] == ' ' ? space : 0;
-               add_width = (int) (amount_kern + width) / extend;
+               for (i = 1; i < str_len; i++) {
+                       amount_kern = (int) T1_GetKerning(*f_ind, str[i - 1], str[i]);
+                       amount_kern += str[i - 1] == ' ' ? space : 0;
+                       add_width = (int) (amount_kern + width) / extend;
 
-               char_path = T1_GetMoveOutline(*f_ind, add_width, 0, 0, size, transform);
-               str_path = T1_ConcatOutlines(str_path, char_path);
+                       char_path = T1_GetMoveOutline(*f_ind, add_width, 0, 0, size, transform);
+                       str_path = T1_ConcatOutlines(str_path, char_path);
 
-               char_path = T1_GetCharOutline(*f_ind, str[i], size, transform);
-               str_path = T1_ConcatOutlines(str_path, char_path);
+                       char_path = T1_GetCharOutline(*f_ind, str[i], size, transform);
+                       str_path = T1_ConcatOutlines(str_path, char_path);
+               }
+               str_img = T1_AAFillOutline(str_path, 0);
+       } else {
+               str_img = T1_AASetString(*f_ind, str,  str_len, space, T1_KERNING, size, transform);
        }
-       str_img = T1_AAFillOutline(str_path, 0);
-
        if (T1_errno) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "T1Lib Error: %s", T1_StrError(T1_errno));
                RETURN_FALSE;