PHP Novice Question: Fonts in PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phpnovice27
Forum Newbie
Posts: 3
Joined: Tue Oct 03, 2006 7:22 am

PHP Novice Question: Fonts in PHP

Post by phpnovice27 »

Hi all,

I'm new to PHP - very new so I have a novice question. All I want to do is use Arial font for some text that I'm displaying in a php file. The function that I'm using to display that text is 'imagestring'. Does anyone know the easiest way that I can display text in Arial font with that function (or perhaps i need to use some other function). What I was hoping is that I could use a CSS file to format the text displayed in the php file using the imagestring function. I don't know if that is possible, suppose that's another question I have. I'm a novice when it comes to CSS as well.

Hope you guys can help.

Cheers
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

PHP doesn't render the text, it only provides the html document and sends it to the browser. So this is a question about html and/or css.
Take a look at http://www.w3schools.com/css/css_font.asp
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

imagestring() has a sister function called imagettftext()
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

just checking... you know you can use print or echo to output text instead of drawing text on an image, right?
phpnovice27
Forum Newbie
Posts: 3
Joined: Tue Oct 03, 2006 7:22 am

Post by phpnovice27 »

well i want the text to appear at a particular location that is why i am using imagestring.

So am I right to say that PHP just produces html and if we use CSS on that html then that php rendered html will get formatted? If this is true then my problem changes. I have put the php file's output in an iframe. My question now changes to: how do I apply CSS to an iframe - if that will indeed format the php file's output?

Thanks
Post Reply