Re: imagettftext Angle Problem
| From: | Floyd Resler | Date: | Thu, 12 Aug 2010 16:25:49 +0000 |
| Subject: | Re: imagettftext Angle Problem | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-307428@lists.php.net to get a copy of this message | ||
On Aug 12, 2010, at 12:17 PM, Ashley Sheridan wrote:
> On Thu, 2010-08-12 at 12:14 -0400, Floyd Resler wrote:
>
>> On Aug 12, 2010, at 11:50 AM, tedd wrote:
>>
>>>> On Thu, 2010-08-12 at 10:40 -0400, Floyd Resler wrote:
>>>>
>>>>> I'm trying to draw text at a 90 degree angle, reading from bottom to top.
>>>>> For some reason, all of the letters are aligning to the top (i.e. the left side) of the text. It
>>>>> looks really odd! Has anyone else experienced this before?
>>>>>
>>>>> Thanks!
>>>>> Floyd
>>>
>>> Floyd:
>>>
>>> Yes, that is odd -- try this:
>>>
>>> Header ("Content-type: image/gif");
>>> $im = imagecreate (400, 400);
>>> $background = imagecolorallocate ($im, 238, 238, 238);
>>> $text_color = imagecolorallocate ($im, 00, 51, 102);
>>> imagettftext ($im, 10, 90, 200, 200, $text_color, "arial.ttf", "Hello
>>> World...");
>>> imagegif ($im);
>>> imagedestroy ($im);
>>>
>>> You must use arial.ttf for the above -- in fact, that might be your problem, the font
>>> you are using may be that way.
>>>
>>> Here's an example of this working:
>>>
>>> http://webbytedd.com/b/timed-php/
>>>
>>> Cheers,
>>>
>>> tedd
>>
>> Well, whatever the problem is it is definitely related only to my system. I tried your
>> code and had the same results (https://adexfulfillment.com/adex/tests/test.php). I tried different
>> fonts as well. The fonts I'm using were exported from FontBook on my Mac. I wonder if that
>> might have something to do with it. Anyway you could pass along the arial font you're using so
>> I can test that possibility?
>>
>> Thanks!
>> Floyd
>>
>>
>>
>
>
> The Arial font should be available on every system by default. I believe
> the Linux equivalent is LiberationSans, and possibly Helvetica on a Mac,
> but essentially they are considered similar enough equivalents for
> rendering things like this. If in doubt, try playing about with
> different fonts. Just a quick question, but the headings are all being
> created as whole headings and not individual letters yeah?
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
Yep, I'm rendering the entire header not individual letters. I just tried it using a font that
came with my Ubuntu install and it still does the same thing. So, I guess I'll need to do a
little more digging. Thankfully it is just for us internally so none of our clients will see it!
Thanks!
Floyd