#23527 [Opn]: PostScript Type 1 font do not render properly
| From: | nid at home dot se | Date: | Fri, 09 May 2003 13:10:40 +0000 |
| Subject: | #23527 [Opn]: PostScript Type 1 font do not render properly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-39387@lists.php.net to get a copy of this message | ||
ID: 23527
User updated by: nid at home dot se
Reported By: nid at home dot se
Status: Open
Bug Type: GD related
Operating System: Linux Slackware 8
PHP Version: 4.3.1
New Comment:
I found a solution for this problem, when tampering with ext/gd/gd.c
I don't have the original line numbers available, because of some
tampering. But it is not hard to find it.
In the php-function imagepstext, there is a codesnippet that looks like
this:
--------[code starts]-----
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_GetCharOutline(*f_ind, str[i], size,
transform);
str_path = T1_ConcatOutlines(str_path, char_path);
}
str_img = T1_AAFillOutline(str_path, 0);
-----[code ends]-------
if you instead make this like it WAS in <=php4.2, it should look like
this:
----[code starts]----
if (width) // this is the change
{
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_GetCharOutline(*f_ind, str[i], size,
transform);
str_path = T1_ConcatOutlines(str_path, char_path);
}
str_img = T1_AAFillOutline(str_path, 0);
}
else // change continues here
{
str_img = T1_AASetString(*f_ind, str, str_len, space,
T1_KERNING, size, transform);
}
----[code ends]----
Then the problem went away (until you set the space-property to a
non-zero value). So, evidentually, there is some kind of bug, or PHP
handles spaced texts differently than t1lib does as standard.
For further releases, can you _please_ put the "if (width)"-statement
as it was before?
Previous Comments:
------------------------------------------------------------------------
[2003-05-09 06:07:56] nid at home dot se
I just downloaded the latest snapshot from snaps.php.net
(http://snaps.php.net/php4-STABLE-200305090930.tar.gz). It does not
work as I want, since the font is still not correct in size 9,10 and
12. (as it is in php <=4.2).
The build parameters this time is:
./configure \
--with-mysql \
--enable-track-vars \
--enable-ftp \
--enable-sockets \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-zlib-dir=/usr \
--with-gd \
--with-t1lib=/usr/local \
--with-dom \
--with-expat-dir=/usr/local \
--enable-xslt \
--with-xslt-sablot \
--with-apxs=/usr/local/apache/bin/apxs \
--with-curl=/usr/local \
--disable-session
so, yes. I do use the bundled version of GD. (it says: bundled (2.0.12
compatible) in phpinfo()).
------------------------------------------------------------------------
[2003-05-09 05:26:24] sniper@php.net
When you use the latest stable snapshot and compile
it to use the _bundled_ GD library (by leaving the path out of
--with-gd), does it work or not?
------------------------------------------------------------------------
[2003-05-09 01:38:11] nid at home dot se
Try generating an image with font size 12, and you might get the same
results as me. The font renders well in some sizes (i've been testing
11 and 13 and higher).
------------------------------------------------------------------------
[2003-05-08 20:22:10] iliaa@php.net
Here is an image that was produced with your sample script using latest
stable PHP & bundled GD (with your font).
As far as I can tell the text is perfect.
http://bb.prohost.org/test2.png
------------------------------------------------------------------------
[2003-05-08 02:12:56] nid at home dot se
Sorry for setting the status to "open" again. The password-box's
standard-button is the upper "submit"-button, which is kind of wrong.
(shouldn't be discussed here I think)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/23527
--
Edit this bug report at http://bugs.php.net/?id=23527&edit=1