1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

TrueType Fonts In PHP Images

Discussion in 'PHP' started by digitalpoint, Mar 13, 2004.

  1. #1
    I decided to change the font used in the image generation for the keyword tracker charts from the default font to a Unicode TTF font. This would allow people tracking keywords in multi-byte languages to show their keywords within the legend properly (for Japanese, Chinese, Russian, etc. keywords).

    But I ran into an interesting bug... When you apply a string to the image with the imagettftext() function, the color of the font is always an ugly yellow, regardless of the color specified. It turns out that this is only a problem when the image itself is a true color image that was created with the imagecreatetruecolor() function. If you instead use imagecreate(), the font colors work as expected.

    The problem for me is the true color imaging is what allows for anti-aliased lines within the chart, and the alpha blending transparency of the legend. I'm curious if anyone has run into this problem before and if there is any "simple" work-around? I'm using the latest version of PHP (4.3.4), but I did notice in the development logs that the upcoming PHP 4.3.5 has newer GD libs built into it. So I'm crossing my fingers that it's just a GD Lib problem, and maybe it will magically go away with the update.
    SEMrush
    - Shawn
     
    digitalpoint, Mar 13, 2004 IP
    SEMrush
  2. nlopes

    nlopes Guest

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You may already install a snapshot of PHP 4.3.5.
    There are very few new features in PHP 4.3.5. This release will be only a bug release before PHP 5.

    PHP 5 will still take more 2 moths to become stable (at least).

    Grab a snapshot from http://snaps.php.net and test if it works.
    If not, open a bug in http://bugs.php.net and then I may help you (i'm a php developper!)
     
    nlopes, Mar 14, 2004 IP
  3. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,288
    Likes Received:
    2,600
    Best Answers:
    460
    Trophy Points:
    710
    Digital Goods:
    29
    #3
    Well I'm not in that much of a hurry... 4.3.5 is almost released, so I'll try it when it's out and let you know. :)

    - Shawn
     
    digitalpoint, Mar 14, 2004 IP
  4. nlopes

    nlopes Guest

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    PHP 4.3.5 is in version RC2. I think it is going only to be released when PHP 5 cames out.

    It has no bugs, since in last months the PHP team has been only correcting bugs on it and NOT adding new features.
     
    nlopes, Mar 14, 2004 IP
  5. ikkiphenix

    ikkiphenix Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    At last someone who experienced the same bug as me: these ugly yellow fonts with imagecreatetruecolor() !

    I reported the bug: http://bugs.php.net/bug.php?id=27693

    I'm just hoping the latest PHP-version 4.3.5 (released out today) really fixes the bug as said in the answer, and my hoster intends to migrate...
    As soon as soon as someone has tried PHP4.3.5, let us know ;-)

    Have a nice day.
     
    ikkiphenix, Mar 26, 2004 IP
  6. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,288
    Likes Received:
    2,600
    Best Answers:
    460
    Trophy Points:
    710
    Digital Goods:
    29
    #6
    Yeah... would be nice for me if it worked. I didn't get *too* much into it though to determine if it's the gd lib or PHP itself. I'm assuming it's a gd lib problems, which is why I was hopeful 4.3.5 will fix it (since it updated the bundled gd lib).

    - Shawn
     
    digitalpoint, Mar 26, 2004 IP
  7. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,288
    Likes Received:
    2,600
    Best Answers:
    460
    Trophy Points:
    710
    Digital Goods:
    29
    #7
    Just as a FYI, I installed PHP 4.3.5 today, and still the same problem. :(

    - Shawn
     
    digitalpoint, Mar 30, 2004 IP
  8. nlopes

    nlopes Guest

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I've the provided script in the bug report with PHP 4.2.6RC2-dev (snapshot from http://snaps.php.net) and everything works fine.
    I've tested with a couple of fonts.
    Can you please test the script with different fonts with a fresh snapshot, please?

    If it doesn't work, send me the font you are using or contact Ilia throught the bug report (he is the best bug hunter and developper of the GD extension).
     
    nlopes, Apr 3, 2004 IP
  9. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,288
    Likes Received:
    2,600
    Best Answers:
    460
    Trophy Points:
    710
    Digital Goods:
    29
    #9
    I'll test it again when 4.3.6 is released (final). Don't particularly want to install RC stuff on the production machine.

    - Shawn
     
    digitalpoint, Apr 3, 2004 IP
  10. nlopes

    nlopes Guest

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10
    As I have told you before, PHP 4 is higly stable.
    Using a release version or a snapshot is merely numbers. If you follow the php internalls mailling list you'll note that.
    So I think you may always use the latest stable snapshot (4.3.6-dev) because you'll benefith from some bug fixes.

    There is a feature frozen a long time ago. The adittions now are just bug fixing and they are really stable.
     
    nlopes, Apr 3, 2004 IP
  11. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,288
    Likes Received:
    2,600
    Best Answers:
    460
    Trophy Points:
    710
    Digital Goods:
    29
    #11
    Well I'm not in any big rush... It's not a feature I *have* to have... it would just be nice being able to use TTF within true color images.

    - Shawn
     
    digitalpoint, Apr 3, 2004 IP
  12. nlopes

    nlopes Guest

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Derick, also a very good programmer as marked the bug report as bogus.

    Try to compile PHP with the latest freetype 2 library and it should work with no problems.
     
    nlopes, Apr 9, 2004 IP
  13. techwizz78

    techwizz78 Peon

    Messages:
    48
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Im also having a php font issue.

    Can't seem to assign the font via a variable?

    Anyone else have this issue? The text yeah... the font no.
     
    techwizz78, Aug 18, 2007 IP
  14. sea otter

    sea otter Peon

    Messages:
    250
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Holy crap, way to resurrect a three year old thread.

    Anyhow...what exactly do you mean? It would help if you posted the non-working code fragment.
     
    sea otter, Aug 18, 2007 IP