Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - GD's a bitch....
  
User name:
Password:
Reply:
 

UserPost
Zem
Posts: 749/1107
Yeah, but I haven't worked on that code in so long I'd rather rewrite it than modify it now. (The regular lettering one, I mean. That's used on the caw.)
windwaker
Posts: 1157/1797
Originally posted by Zem
<span style="padding: 4px; background-color: white"><img src="http://thecaw.wootest.net/images/text.php?txt=this%20rocks%20your%20font.%20if%20it%20had%20line%20breaks%20it%20would%20rock%20your%20face%20right%20off.">





Tut tut, look, you had to add css via span to enter all of that.

Entering line breaks wouldn't take long, either.

Actually, wouldn't that have worked without the CSS?
Zem
Posts: 747/1107



windwaker
Posts: 1156/1797





Color coming soon, though the <blue> tag works in it. I didn't want to go through making all of those 8x8 tiles again, so I just use arial.
Jesper
Posts: 1924/2390
What I do in my customtitle script is to first split the text by "\\n", evaluating to the literal "\n". Then I use wordwrap() to split it up further if needed, and I've got my lines - now all you've gotta do is loop through them and print out.
Narf
Posts: 42/100
Neko: The fonts you use are also 8 pixels wide I see. What you could do, is set a maximum width for the image, let's say, 320px. You could make it so that whenever a line has over 40 characters (40x8=320), it will automatically line break.
Xkeeper
Posts: -2602/-863
Narf
Posts: 41/100
The built in fonts are monospace indeed, though, only available in 5 sizes. I prefer my own 8x8 font over them.

And yup, a function which will copy whole text strings instead of you having to copy them all one by one yourself, does wonders, and is in my oppinion vital if you use that method too.

Fonts

Yes, not containing the whole ASCII set, but I don't need it for the strings I generate in my image anyway, just spaces, ( and ).

Anyway, since all characters are 8x8 pixels, taking care of word wrapping is easy. Basically, just 'creating' line breaks when a line reaches a specific ammount of characters (characters*8).
Vystrix Nexoth
Posts: 259/348
Narf: Aye, though the regular built-in X11-style fonts are monospace, and their size can be deduced with certain functions. And furthermore they can be written to the image with a function call with a string, rather than manually copying-and-pasting it one letter at a time.

OTOH, if he sets up a system whereby he can call a function with a string and said function will assume responsibility for the copy-and-paste procedure, then that would afford him even more power over it (over what goes where, plus affording him full power over how the font looks). He might even rig it to automatically perform word-wrapping.
Narf
Posts: 40/100
Or what I did, make your own custom font (a png image containing all numbers, letters and characters; if you're bored, make one with all the ASCII characters =)), and make all the letters/numbers have the same height, for example, 8x8 pixels per letter/number/character. Makes it easy for you to calculate.
DarkSlaya
Posts: 3427/4249
Vystrix: Thank you for telling how it works.

windwaker: Thank you for explaining why the weird character was there.
windwaker
Posts: 1094/1797
Yeah, that weird simple is just that font's way of handling \n in GD.
Vystrix Nexoth
Posts: 252/348
you don't enter linebreaks in GD text; it's up to you to figure out where to break lines, break them accordingly, and then draw each line separately. there's a function (like imagegetfontheight() or something; consult the PHP manual) that can tell you the height of the font you're using, which can be added (with a little extra for spacing) to the Y position of the current line, to get the Y position of the next one.

the wordwrap() function will perform word-wrapping for you.

HTH
DarkSlaya
Posts: 3424/4249
....and it won't let me use line breaks.

Whenever I try to make one, I get a weird symbol.

So what the hell am I supposed to do? Or what the hell is going on?

[Uses PHP]
Acmlm's Board - I2 Archive - Programming - GD's a bitch....


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.008 seconds.