A persistent issue with the GD functions

php.internals

choinet

22 years ago
Hello internals, I am dealing with a rather annoying and very prolonged problem here concerning a few of the GD functions that use external fonts. I had originally posted the problem as a bug report under #26635 under the false assumption that PHP 4.3.4 simply had a problem with relative pathnames to the fonts. However, after long correspondence and troubleshooting on my part, I found that there was a different problem behind the original issue that was causing the problem. I posted this at http://bugs.php.net/bug.php?id=26764?with the assumption that it would be fixed. ? However, all I received was a rather nasty reply telling me to quit reporting the problem. With that being said, I apologize if I came across as unnecessarily rude, but the developer was really pushing my buttons. Since I have, on numerous occasions, tried to clarify the problem and prove its existence and have met very little help or action, I am mailing the developer's list (emailing the bug fixers doesn't help, and no one else has developer access to the runtime source code). ? The bug (or problem, if you will) that I reported is almost surely legitimate; it has been mentioned twice in the imagettftext() pages concerning spaces in pathnames, and has been verified by a moderator at phpbuilder.net (Weedpacket), and I have shown repeatedly in my examples and situations that such a thing exists. I even looked at the source code for the GD extension, and I clearly see /* * The character (space) used to separate alternate fonts in the * fontlist parameter to gdImageStringFT. */ #define LISTSEPARATOR " " on line 84 of /gd/libgd/gdft.c. This may not be the deciding line of code that determines the separator between alternate fonts, but I have checked spaces as you can see in the bug report, and such a thing works. Therefore, the only explanation for such pathnames working in that fashion is if what I am claiming is true. ? If you people?care to test it out, the code in the aforementioned report will almost surely replicate the problem, both on 4.3.4 and the latest STABLE CVS. If this cannot be worked out in PHP or must be relegated to the folks at boutell to handle, then at the very least, please tell me, for it would certainly be much more informative than denying the existence of this problem. Thanks. __________________________________ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003

Rasmus Lerdorf

22 years ago
Frankly, your bug reporting sucks. This should have been a one-line explanation with a simple example instead of that diatribe you posted and followed up with this one. So, in other words the bug, or lack of feature is: Since libgd supports multiple alternate font paths separated by spaces, it is not possible to use individual font paths with spaces in them. Example: $path = 'c:\test folder\arial.ttf'; imagettftext($image, 12, 0, 50, 50, $color, $path, "Hello"); If the Boutell folks fix this we will integrate their fix in our bundled library, but otherwise I doubt you will find much interest from anybody here. Or better yet, fix it yourself and submit a patch. It is obvious from looking at the code that it is just doing a simple strtok on the separator without any further logic. The relevant code is: ext/gd/libgd/gdft.c: fontlist = gdEstrdup(a->fontlist); /* * Must use gd_strtok_r else pointer corrupted by strtok in nested loop. */ for (name = gd_strtok_r (fontlist, LISTSEPARATOR, &strtok_ptr); name; name = gd_strtok_r (0, LISTSEPARATOR, &strtok_ptr)) { -Rasmus On Fri, 2 Jan 2004, choinet wrote:

choinet

22 years ago
Thanks for the answer, though, Rasmus! --- Rasmus Lerdorf <rasmus@php.net> wrote:
> Frankly, your bug reporting sucks. This should have > been a one-line > explanation with a simple example instead of that > diatribe you posted and > followed up with this one. So, in other words the > bug, or lack of feature > is: > > Since libgd supports multiple alternate font paths > separated by spaces, > it is not possible to use individual font paths > with spaces in them. > > Example: > > $path = 'c:\test folder\arial.ttf'; > imagettftext($image, 12, 0, 50, 50, $color, > $path, "Hello"); > > If the Boutell folks fix this we will integrate > their fix in our bundled > library, but otherwise I doubt you will find much > interest from anybody > here. Or better yet, fix it yourself and submit a > patch. It is obvious > from looking at the code that it is just doing a > simple strtok on the > separator without any further logic. The relevant > code is: > > ext/gd/libgd/gdft.c: > > fontlist = gdEstrdup(a->fontlist); > > > > /* > * Must use gd_strtok_r else pointer corrupted > by strtok in nested loop. > */ > for (name = gd_strtok_r (fontlist, > LISTSEPARATOR, &strtok_ptr); name; name = > gd_strtok_r (0, LISTSEPARATOR, &strtok_ptr)) { > > -Rasmus > > On Fri, 2 Jan 2004, choinet wrote: > > > Hello internals, > > I am dealing with a rather annoying and very > prolonged > > problem here concerning a few of the GD functions > that > > use external fonts. I had originally posted the > > problem as a bug report under #26635 under the > false > > assumption that PHP 4.3.4 simply had a problem > with > > relative pathnames to the fonts. However, after > long > > correspondence and troubleshooting on my part, I > found > > that there was a different problem behind the > original > > issue that was causing the problem. I posted this > at > > http://bugs.php.net/bug.php?id=26764?with the > > assumption that it would be fixed. > > ? > > However, all I received was a rather nasty reply > > telling me to quit reporting the problem. With > that > > being said, I apologize if I came across as > > unnecessarily rude, but the developer was really > > pushing my buttons. Since I have, on numerous > > occasions, tried to clarify the problem and prove > its > > existence and have met very little help or action, > I > > am mailing the developer's list (emailing the bug > > fixers doesn't help, and no one else has developer > > access to the runtime source code). > > ? > > The bug (or problem, if you will) that I reported > is > > almost surely legitimate; it has been mentioned > twice > > in the imagettftext() pages concerning spaces in > > pathnames, and has been verified by a moderator at > > phpbuilder.net (Weedpacket), and I have shown > > repeatedly in my examples and situations that such > a > > thing exists. I even looked at the source code for > the > > GD extension, and I clearly see > > > > /* > > * The character (space) used to separate alternate > > fonts in the > > * fontlist parameter to gdImageStringFT. > > */ > > #define LISTSEPARATOR " " > > > > on line 84 of /gd/libgd/gdft.c. This may not be > the > > deciding line of code that determines the > separator > > between alternate fonts, but I have checked spaces > as > > you can see in the bug report, and such a thing > works. > > Therefore, the only explanation for such pathnames > > working in that fashion is if what I am claiming > is > > true. > > ? > > If you people?care to test it out, the code in the > > aforementioned report will almost surely replicate > the > > problem, both on 4.3.4 and the latest STABLE CVS. > If > > this cannot be worked out in PHP or must be > relegated > > to the folks at boutell to handle, then at the > very > > least, please tell me, for it would certainly be > much > > more informative than denying the existence of > this > > problem. Thanks. > > > > > > __________________________________ > > Do you Yahoo!? > > Find out what made the Top Yahoo! Searches of 2003 > > http://search.yahoo.com/top2003 > > > > -- > > PHP Internals - PHP Runtime Development Mailing > List > > To unsubscribe, visit: > http://www.php.net/unsub.php > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >
__________________________________ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003