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.... | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
DarkSlaya
POOOOOOOOOOOORN!
Level: 88

Posts: 3424/4249
EXP: 6409254
For next: 241410

Since: 05-16-04
From: Montreal, Quebec, Canada

Since last post: 8 hours
Last activity: 5 hours
Posted on 02-07-05 02:20 AM Link | Quote
....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]


(edited by DarkSlaya on 02-06-05 10:21 PM)
(edited by DarkSlaya on 02-06-05 10:34 PM)
Vystrix Nexoth

Level: 30

Posts: 252/348
EXP: 158678
For next: 7191

Since: 03-15-04
From: somewhere between anima and animus

Since last post: 3 days
Last activity: 2 days
Posted on 02-07-05 03:42 AM Link | Quote
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
windwaker

Ball and Chain Trooper
WHY ALL THE MAYONNAISE HATE
Level: 61

Posts: 1094/1797
EXP: 1860597
For next: 15999

Since: 03-15-04

Since last post: 4 days
Last activity: 6 days
Posted on 02-07-05 04:00 AM Link | Quote
Yeah, that weird simple is just that font's way of handling \n in GD.
DarkSlaya
POOOOOOOOOOOORN!
Level: 88

Posts: 3427/4249
EXP: 6409254
For next: 241410

Since: 05-16-04
From: Montreal, Quebec, Canada

Since last post: 8 hours
Last activity: 5 hours
Posted on 02-07-05 05:16 AM Link | Quote
Vystrix: Thank you for telling how it works.

windwaker: Thank you for explaining why the weird character was there.
Narf
Hi Tuvai!
(reregistering while banned)
Level: 16

Posts: 40/100
EXP: 17634
For next: 2622

Since: 12-26-04

Since last post: 22 hours
Last activity: 14 hours
Posted on 02-07-05 09:47 PM Link | Quote
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.
Vystrix Nexoth

Level: 30

Posts: 259/348
EXP: 158678
For next: 7191

Since: 03-15-04
From: somewhere between anima and animus

Since last post: 3 days
Last activity: 2 days
Posted on 02-07-05 10:03 PM Link | Quote
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
Hi Tuvai!
(reregistering while banned)
Level: 16

Posts: 41/100
EXP: 17634
For next: 2622

Since: 12-26-04

Since last post: 22 hours
Last activity: 14 hours
Posted on 02-07-05 10:48 PM Link | Quote
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).


(edited by Narf on 02-07-05 06:49 PM)
Xkeeper
The required libraries have not been defined.
Level: NAN

Posts: -2602/-863
EXP: NAN
For next: 0

Since: 03-15-04

Since last post: 2 hours
Last activity: -753366 sec.
Posted on 02-07-05 10:52 PM Link | Quote
Narf
Hi Tuvai!
(reregistering while banned)
Level: 16

Posts: 42/100
EXP: 17634
For next: 2622

Since: 12-26-04

Since last post: 22 hours
Last activity: 14 hours
Posted on 02-07-05 10:54 PM Link | Quote
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.
Jesper
Busy, busy, busy.
Level: 69

Posts: 1924/2390
EXP: 2856000
For next: 13743

Since: 03-15-04
From: Sweden.

Since last post: 176 days
Last activity: 79 days
Posted on 02-10-05 12:09 AM Link | Quote
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.
windwaker

Ball and Chain Trooper
WHY ALL THE MAYONNAISE HATE
Level: 61

Posts: 1156/1797
EXP: 1860597
For next: 15999

Since: 03-15-04

Since last post: 4 days
Last activity: 6 days
Posted on 02-13-05 04:57 AM Link | Quote





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.


(edited by windwaker on 02-13-05 12:58 AM)
Zem
You can be civil without being flowery, dipshits.
Level: 49

Posts: 747/1107
EXP: 829398
For next: 54485

Since: 06-13-04

Since last post: 131 days
Last activity: 131 days
Posted on 02-13-05 05:18 AM Link | Quote



windwaker

Ball and Chain Trooper
WHY ALL THE MAYONNAISE HATE
Level: 61

Posts: 1157/1797
EXP: 1860597
For next: 15999

Since: 03-15-04

Since last post: 4 days
Last activity: 6 days
Posted on 02-13-05 05:22 AM Link | Quote
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?


(edited by windwaker on 02-13-05 01:23 AM)
(edited by windwaker on 02-13-05 01:25 AM)
Zem
You can be civil without being flowery, dipshits.
Level: 49

Posts: 749/1107
EXP: 829398
For next: 54485

Since: 06-13-04

Since last post: 131 days
Last activity: 131 days
Posted on 02-13-05 05:25 AM Link | Quote
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.)
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
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.017 seconds.