473,721 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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($i m, 33, 0, 20, 500, $black, 'arial.ttf', $text);

everything is perfect except the tab "\t" sign
if I set $text = "something\tsom ething" 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 2916
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($i m, 33, 0, 20, 500, $black, 'arial.ttf', $text);

everything is perfect except the tab "\t" sign
if I set $text = "something\tsom ething" 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\\tso mething"
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
2141
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", "Test en cours... Oméga: Ω");
3
21516
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 = ImageColorAllocate ($im, 0, 0, 0); $yellow = ImageColorAllocate ($im, 235, 235, 51); ImageTTFText ($im, 20, 0, 10, 20, $yellow, $font, "comming text or not?");
0
1933
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 imagettfbbox(), for some angles of text (like 45 degrees), the box comes back in the wrong place. Sample code below; just change the $font assignment to point to a TTF font file. You should see a text string with a box around it, but my box isn't...
6
2533
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 particularly the reference to my font file "Verdana". If i use a different function to write text it does so no bother but unfortunately i need this function to work. Here is the error it outputs followed by the code for the page in question:
3
2883
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, they don't do what they should : i'm generating an image with text written with an angle : imagettftext used
0
1504
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 4.0.6 on Appache server under linux operating system. so plz if someone have an idea about the problem plz answer me. <?php
5
2178
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 to narrow it down for me. The idea is that the script pulls data from the database - username, colour, font and shout to print ' shout' onto the image. This part of the code all works perfectly. Then it looks through each line at a time to see if...
3
2080
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/" . $user . "_back.gif", $wid, $hei);
1
3390
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. The problem is when it creates transparent PNG format image then and it pixel ate the image. e.g. If i am using a gradient in background then it vary in color range. Now when i used that php script it generates image successfully but it pixel ate...
0
8840
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9131
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9064
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8007
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6669
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5981
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4484
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3189
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2130
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.