ID:               40718
 Updated by:       [EMAIL PROTECTED]
 Reported By:      public at milindur dot de
 Status:           Wont fix
 Bug Type:         *Configuration Issues
 Operating System: Linux (Ubuntu 6.10)
 PHP Version:      5.2.1
 New Comment:

Why don't you use freetype2?

This option was about fixing issues with old libgd versions and to
always provide ttf support. It is really not something you should use
unless you have a very good reason.

About freetype1, it is broken, old and unmaintained. You better have to
upgrade to freetype2 instead. As soon as I can, I will drop freetype1
(or add warning in the configure) about freetype1 usage.

I'm sorry, but I do not have the time to investigate and fix this
problem. I do not think it is worth the effort either :)


Previous Comments:
------------------------------------------------------------------------

[2007-03-07 08:51:38] public at milindur dot de

> In short, you should really use only freetype2.
Okay, but unfortunately my webhoster does not want this. He just uses
freetype1 (--with-ttf). But he also uses the option
--enable-gd-native-ttf.

> "--enable-gd-native-ttf" 
> Enable gdImageStringTTF function instead of 
> gdImageStringFT/gdImageStringFTEx (both freetype2).

Sure? I think that this option actually enforces the use of the
libgd-ttf-functions (gdImageStringTTF, gdImageStringFT or
gdImageStringFTEx).

I looked into the configure-script. The option --enable-gd-native-ttf
sets PHP_GD_NATIVE_TTF which enables "#define USE_GD_IMGSTRTTF 1".

I find the macro USE_GD_IMGSTRTTF again in ext/gd/gd.c:

#ifdef USE_GD_IMGSTRTTF
# if HAVE_GD_STRINGFTEX
        if (extended) {
                error = gdImageStringFTEx(...);
        }
        else
# endif

# if HAVE_GD_STRINGFT
        error = gdImageStringFT(...);
# elif HAVE_GD_STRINGTTF
        error = gdImageStringTTF(...);
# endif

#else /* !USE_GD_IMGSTRTTF */
        error = gdttf(...);
#endif

If USE_GD_IMGSTRTTF is set only gdImageStringFTEx, gdImageStringFT or
gdImageStringTTF would be executed. But if HAVE_GD_STRINGFTEX,
HAVE_GD_STRINGFT and HAVE_GD_STRINGTTF are not set (freetype1) no code
would be executed. The function gdttf provides ttf-functionality with
GD2/freetype1 (as far as I understand this function) but it is not
executed.

> Freetype1 support is already abandoned in HEAD (php6).
Right, but PHP4/5 are still widely spread.

If you do not want to fix this than just tell me if I am right
regarding --enable-gd-native-ttf with GD2/freetype1.

------------------------------------------------------------------------

[2007-03-04 22:39:57] [EMAIL PROTECTED]

"I am trying to compile PHP (5.2.1 and/or 4.4.6) with bundled libgd
(2.0.28) but *without* FreeType 2. Is it right that I am not allowed
to
use the configure-option "--enable-gd-native-ttf" in this case?"

Freetype1:
"--with-ttf=/path"
Define the prefix of freetype2

"--enable-gd-native-ttf" 
Enable gdImageStringTTF function instead of 
gdImageStringFT/gdImageStringFTEx (both freetype2).


Freetype2:
--with-freetype-dir=/path
Define the prefix of freetype2

In short, you should really use only freetype2.

Freetype1 support is already abandoned in HEAD (php6).

We keep the option around as some users keep rely on the old functions.
But that's all I can do, keeping them around > won't fix.

------------------------------------------------------------------------

[2007-03-04 22:02:24] public at milindur dot de

Description:
------------
Hello,

I am trying to compile PHP (5.2.1 and/or 4.4.6) with bundled libgd
(2.0.28) but *without* FreeType 2. Is it right that I am not allowed to
use the configure-option "--enable-gd-native-ttf" in this case?

If I add --enable-gd-native-ttf the function imagettftext does not work
(text is not added to image). If I remove this option imagettftext
works.

The source of this behaviour seems to be that using
--enable-gd-native-ttf enables the macro USE_GD_IMGSTRTTF. This
prevents ext/gd/gd.c from executing any function to draw the string:
gdImageStringFT/gdImageStringFTEx/gdImageStringTTF are not available
because GD2 is used without FreeType 2. For this case gdttf should be
called but --enable-gd-native-ttf / USE_GD_IMGSTRTTF prevents this.

I think that this case should be avoided by the configure-script (using
GD2, FreeType2 not available => refuse --enable-gd-native-ttf). 

Code below is from
http://www.php.net/manual/de/function.imagettftext.php

Reproduce code:
---------------
<?php
Header ("Content-type: image/gif");
$im = imagecreate (400, 30);
$black = ImageColorAllocate ($im, 0, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
ImageTTFText ($im, 20, 0, 10, 20, $white, "/path/arial.ttf", "Test");
ImageGif ($im);
ImageDestroy ($im);
?> 

Expected result:
----------------
black box with white text

Actual result:
--------------
black box without text, when using --enable-gd-native-ttf with GD2 and
without FreeType 2.x


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40718&edit=1

Reply via email to