Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 4 of 4

This is a discussion on GD - putting out ttf text in the Shared & Semi-Dedicated forum
What's the best way to start a new line? In frustration of "\n" going to a new line but not returning to original X starting ...

  1. #1
    Apathetic
    Join Date
    Sep 2002
    Posts
    31

    GD - putting out ttf text

    What's the best way to start a new line? In frustration of "\n" going to a new line but not returning to original X starting point (AKA the left side) I finally coded it to run each line in it's own imagettftext() function, which I believe just caused me to get my account suspended.

    That's twice I've had this little problem this year..

  2. #2
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,775
    How about using a 'bounding box' (imagettfbbox)?
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL © 2010

  3. #3
    Apathetic
    Join Date
    Sep 2002
    Posts
    31
    Tried, wrong GD library. I can't run the function.

    The image size wasn't the problem, that was dynamically resized along with the image, there was a bit of math workaround but I didn't need imagettfbbox().

    The problem was having to run imagettftext() for every new line of text on the image. Usually 3 lines per image, and it ran a different quote per each request.
    "We have normality. I repeat, we have normality. Anything you still can't cope with is therefore your own problem."
    - Douglas Adams

  4. #4
    Apathetic
    Join Date
    Sep 2002
    Posts
    31
    UPDATE: I didn't spend enough time reading the user comments on PHP.net's documentation. Turns out the GD library handles return carriages differently. \r returns to the horizontal starting point, and \n starts a new line.

    So if you're using the GD library to generate images, use "\n\r" or "\r\n" to start new lines.
    "We have normality. I repeat, we have normality. Anything you still can't cope with is therefore your own problem."
    - Douglas Adams

Bookmarks

Posting Permissions

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