php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25928 Can't create clean non-antialised text with ImageTTFText()
Submitted: 2003-10-20 19:26 UTC Modified: 2003-12-09 17:47 UTC
From: yvan dot taviaud at m4am dot net Assigned:
Status: Not a bug Package: GD related
PHP Version: 4CVS-2003-10-20 (stable) OS: RedHat 7.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: yvan dot taviaud at m4am dot net
New email:
PHP Version: OS:

 

 [2003-10-20 19:26 UTC] yvan dot taviaud at m4am dot net
Description:
------------
My server is :
- RedHat 7.3
- Apache 1.3.28
- PHP 4.3.4RC3-dev (tried this last one to see if the bug disappears, but not)
- bundled GD (2.0.15)
- FreeType 2.1.5

The problem is that when I use a negative color index for ImageTTFText(), the antialias disappears, but the text is quite ugly, and should not. No info on GD/FreeType website is available on such a bug.

Reproduce code:
---------------
$height = 60;
$width = 150;
$font = "arial.ttf";
$img_en = imageCreate($width, $height);

$background_en = imageColorAllocate($img_en, 0xFF, 0xFF, 0xFF);
$color_en = imageColorAllocate($img_en, 0x0F, 0xBD, 0xBF);

// Antialias :
imageTTFText($img_en, 12, 0, 10, 30, $color_en, $font, "AZERTYUIOP");
// No antialias :
imageTTFText($img_en, 12, 0, 10, 50, -$color_en, $font, "AZERTYUIOP");

imagePNG($img_en);

Expected result:
----------------
A clean text, such as the one you could see on a web page (because the text is never antialiased on a web page).

Actual result:
--------------
You could see the actual result at this address :
http://www.lacoccinelle.net/test/index.php

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-21 15:31 UTC] sniper@php.net
The whole point of anti-aliasing explained:

http://www.widearea.co.uk/designer/anti.html

 [2003-12-09 03:40 UTC] yvan dot taviaud at m4am dot net
Ok, I think I found the problem and a fix !

In fact the problem occurs on my RedHat box but not on my Debian box. I've managed to find that :
freetype-config --version
is 9.4.3 on RedHat and 9.5.3 on Debian ! I tried to uninstall libfreetype6 on Debian, and install the 9.4.3, and the problem then occurs ! So I think it must be the libfreetype6 that must be updated, but I don't know exactly how... Because the 9.5.3 is not stable (my Debian install is unstable/testing, so...).

I'll try to install 9.5.3 on RedHat, and feedback if OK or not. Please note that this bug is the same as #7769 (not sure), #21879, #21554 (already closed) and #15405. Many to close then if I found that's the good workaround ;o)
 [2003-12-09 04:16 UTC] yvan dot taviaud at m4am dot net
Ok, it's a FreeType bug, and not a PHP bug, but I think it's important to tell about since many 'PHP bugs' are stressed out.

Under Debian, just install libfreetype6_2.1.7-1_i386.deb ! I tried to install the 2.1.7 from the sources, and I got the same bad anti-alias/non-anti-alias. Same thing while compiling it under RedHat. So strange. I'll try to find out why the Debian package is ok, whereas a source compiling is not.
 [2003-12-09 17:11 UTC] yvan dot taviaud at m4am dot net
Ok, I've found the workaround ! Please close the bugs I've noticed in a previous note for this 'bug'.

So, the problem is that FreeType has suppressed a function in the 2nd version : the bytecode interpreter. You need to reactivate it :
file : freetype-source-dir/include/freetype/config/ftoption.h
reactivate the commented line : /* #define  TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
to : #define  TT_CONFIG_OPTION_BYTECODE_INTERPRETER
And rebuild you freetype lib.

HTH, best regards,
Yvan.
 [2003-12-09 17:47 UTC] eru@php.net
This is not a bug in PHP, please leave it on bogus.

Thank you!

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 01 23:01:28 2024 UTC