#40718 [NEW]: PHP with GD2 and FreeType 1.x

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #40718 [NEW]: PHP with GD2 and FreeType 1.x

    From: public at milindur dot de
    Operating system: Linux (Ubuntu 6.10)
    PHP version: 5.2.1
    PHP Bug Type: *Configuration Issues
    Bug description: PHP with GD2 and FreeType 1.x

    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 [url]http://www.php.net/manual/de/function.imagettftext.php[/url]

    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 bug report at [url]http://bugs.php.net/?id=40718&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=40718&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=40718&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=40718&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=40718&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=40718&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=40718&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=40718&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=40718&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=40718&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=40718&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=40718&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=40718&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=40718&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=40718&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=40718&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=40718&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=40718&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=40718&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=40718&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=40718&r=mysqlcfg[/url]
    public at milindur dot de Guest

  2. Similar Questions and Discussions

    1. #25902 [NEW]: again segmentation_fault with gdFreeFontCache with t1lib/freetype 1+2
      From: volker dot augustin at multiartstudio dot com Operating system: Linux PHP version: 4.3.3 PHP Bug Type: GD related Bug...
    2. #25617 [Bgs]: segmentation_fault with gdFreeFontCache with t1lib/freetype 1+2
      ID: 25617 User updated by: volker dot augustin at multiartstudio dot com Reported By: volker dot augustin at multiartstudio dot...
    3. #25617 [Opn->Bgs]: segmentation_fault with gdFreeFontCache with t1lib/freetype 1+2
      ID: 25617 Updated by: sniper@php.net Reported By: volker dot augustin at multiartstudio dot com -Status: Open...
    4. #25617 [NEW]: segmentation_fault with gdFreeFontCache with t1lib/freetype 1+2
      From: volker dot augustin at multiartstudio dot com Operating system: Linux PHP version: 4.3.3 PHP Bug Type: GD related Bug...
    5. True Type Fonts (FreeType) - GD - PHP 4.3.2
      Hello, I'm having a problem using the TTF support in GD. I just installed the latest release of PHP (4.3.2) and the latest version of FreeType...
  3. #2

    Default #40718 [Opn->WFx]: PHP with GD2 and FreeType 1.x

    ID: 40718
    Updated by: [email]pajoye@php.net[/email]
    Reported By: public at milindur dot de
    -Status: Open
    +Status: Wont fix
    Bug Type: *Configuration Issues
    Operating System: Linux (Ubuntu 6.10)
    PHP Version: 5.2.1
    New Comment:

    "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.


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

    [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
    [url]http://www.php.net/manual/de/function.imagettftext.php[/url]

    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 [url]http://bugs.php.net/?id=40718&edit=1[/url]
    pajoye@php.net Guest

  4. #3

    Default #40718 [WFx]: PHP with GD2 and FreeType 1.x

    ID: 40718
    User updated by: public at milindur dot de
    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:
    > 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.


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

    [2007-03-04 22:39:57] [email]pajoye@php.net[/email]

    "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
    [url]http://www.php.net/manual/de/function.imagettftext.php[/url]

    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 [url]http://bugs.php.net/?id=40718&edit=1[/url]
    public at milindur dot de Guest

  5. #4

    Default #40718 [WFx]: PHP with GD2 and FreeType 1.x

    ID: 40718
    Updated by: [email]pajoye@php.net[/email]
    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]pajoye@php.net[/email]

    "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
    [url]http://www.php.net/manual/de/function.imagettftext.php[/url]

    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 [url]http://bugs.php.net/?id=40718&edit=1[/url]
    pajoye@php.net Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139