473,320 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

imagettftext and "\t" problem

Im using imagettftext to write some text on my image. I'm on Win XP and using
the plain arial.ttf font that I copied from win dir
my typical line would be
imagettftext($im, 33, 0, 20, 500, $black, 'arial.ttf', $text);

everything is perfect except the tab "\t" sign
if I set $text = "something\tsomething" the tab gets displayed but it also
displays some rectangle like "this char is in wrong encoding" or something like
that. Basically I get two chars out of "\t" the tab and that rectangle. Using
"\n" is normal - it just splits my text in 2 lines. But I'm very confused with
this "\t" issue :-( Is there another way to make tabs?

thanks gordan
Jul 17 '05 #1
2 2884
Gordan wrote:
Im using imagettftext to write some text on my image. I'm on Win XP and using
the plain arial.ttf font that I copied from win dir
my typical line would be
imagettftext($im, 33, 0, 20, 500, $black, 'arial.ttf', $text);

everything is perfect except the tab "\t" sign
if I set $text = "something\tsomething" the tab gets displayed but it also
displays some rectangle like "this char is in wrong encoding" or something like
that. Basically I get two chars out of "\t" the tab and that rectangle. Using
"\n" is normal - it just splits my text in 2 lines. But I'm very confused with
this "\t" issue :-( Is there another way to make tabs?

thanks gordan


\t is an escape character. So in order to display the '\' you have to
escape the '\' :)

like this :
$text = "something\\tsomething"
Jul 17 '05 #2
Im using imagettftext to write some text on my image.
everything is perfect except the tab "\t" sign


I guess this function is designed to handle carriage returns but has no
understanding of tabs, so you'll have to add your own logic depending
on what you want to achieve in the final image.

For instance if you're trying to lay out text in columns in the image,
you can split the text on "\t" and draw each part separately starting
at a different offset from the left.

---
Steve

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: John Wellesz | last post by:
Hi, since I've upgraded to php 4.3.4 (before I used 4.1.2) I have a problem with imagettftext(): when executing the line: imagettftext($im, 20, 0, 10, 25, $white, "$script_dir/verdana.ttf",...
3
by: carramba | last post by:
I know this subjekt was up several times but Icant get it work use gd2 on win32 <? putenv('GDFONTPATH=f:\swd\font'); $font = "f:/swd/font/arial.ttf"; $im = imagecreate (250, 28); $black =...
0
by: ljb | last post by:
Using PHP-4.3.11 with GD extension, bundled GD library, and freetype-2.1.9 (with X.org 6.8.1). I can't get the TrueType Font (TTF) bounding box to come out right. Whether using imagettftext() or...
6
by: monomaniac21 | last post by:
My url is www.aptitudehack.com Hi i cant get an image to display on another server though it does on mine. Here is the code for the page. The problem i think is the imagettftext function...
3
by: Doraj | last post by:
Hello ! Here is my problem : I had some php scripts which worked well with php 4.0.5 (GD 1.6.2 according to phpinfo() ) and i put them on a new server with php 4.4.2 (and GD 2.0.28). Now,...
0
by: Akkad | last post by:
ok let met tell u what is the problem , i have downloaded the code GD library code from interent and when i am using it the picture is not appearing on the page. i don't know why ? i am using PHP...
5
by: helraizer1 | last post by:
Hey folks and folksesses, I have written some code to get emoticons onto my image based shoutbox but there is quite a large bug, as there is with any code in the early stages, and I need your help...
3
by: helraizer1 | last post by:
Hey folks, yet again. if ($back == "m") //$back is a value pulled from a db; that works perfectly. { $wid = $rowing; $hei = $rowing; createthumb("660x240background2.gif", "./user/" ....
1
by: neovantage | last post by:
Hey all, I am using a PHP script which creates headings at run time in a sense at page execution. I am stuck a with a very little problem which i am sure i will have the solution from experts. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.