Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   Text Length (https://forums.graalonline.com/forums/showthread.php?t=39948)

Falcor 11-04-2002 05:09 AM

Text Length
 
Some Function is needed to calculate the length (in pixles) of a string at a certain size and font .. like

textlen(string,zoomfactor,font)

Seeing as how fonts are not fixed width. It would be nice for some things I have been making.

R0bin 11-04-2002 05:57 AM

good idea, horrible naming convention

textlen reminds me of the length of a string.

maybe textwidth?

adam 11-04-2002 06:56 AM

Re: Text Length
 
Quote:

Originally posted by Falcor
Some Function is needed to calculate the length (in pixles) of a string at a certain size and font .. like

textlen(string,zoomfactor,font)

Seeing as how fonts are not fixed width. It would be nice for some things I have been making.


I know what you mean. :-( Was a guessing game getting text to match up to stuff.

Tyhm 11-04-2002 07:00 AM

Isn't there a command to get the image width and height? If that's set up to work with @ images...

R0bin 11-04-2002 07:31 AM

nope, just to get the width of an image in memory.

Also.


IMPLEMENT THIS IDEA NOW!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!

Falcor 11-04-2002 08:12 AM

Quote:

Originally posted by Tyhm
Isn't there a command to get the image width and height? If that's set up to work with @ images...
Nah, you gotta give it a filename.

CheeToS2 11-04-2002 09:50 AM

Re: Text Length
 
Quote:

Originally posted by Falcor
Some Function is needed to calculate the length (in pixles) of a string at a certain size and font .. like

textlen(string,zoomfactor,font)

Seeing as how fonts are not fixed width. It would be nice for some things I have been making.

just a hunch, but could you tell us what it is you're making? :P

I don't know why, but I am set on the idea that you don't want text to go off screen.. and I want to tell you to use the wraptext command :(

Falcor 11-04-2002 10:54 AM

Re: Re: Text Length
 
Quote:

Originally posted by CheeToS2


just a hunch, but could you tell us what it is you're making? :P

I don't know why, but I am set on the idea that you don't want text to go off screen.. and I want to tell you to use the wraptext command :(

You dont need to know what I am making, just that I am making something that requires it. You will probably see the results of it when Oasis is released (or if you get some screenshots soon). Wraptext does not suffice, as I do not need to wrap the text, I just need to know the length of it.

Dach 11-04-2002 07:50 PM

Quote:

Originally posted by Falcor


Nah, you gotta give it a filename.

He was suggesting to add to it so it would work with text, instead of making a whole new command. Don't underestimate the Tyhm...

R0bin 11-05-2002 04:26 AM

** HAPPY MEDIUM TIME :D **

this.textwidth = 8*int(strlen(#s(this.text)));

works fine for me...

Tyhm 11-05-2002 04:42 AM

...on fixedwidth fonts

CheeToS2 11-05-2002 04:55 AM

Quote:

Originally posted by Tyhm
...on fixedwidth fonts
and on a specific zoom x.x

R0bin 11-05-2002 10:35 AM

this.textwidth = 8*int(strlen(#s(this.text)))*imgzoom;

ha!

and

if you dont use fixedwidth fonts....

i hate you :P

*edit*

FIXEDSYS PWNS YOU ALL!!!

Falcor 11-05-2002 12:09 PM

Quote:

Originally posted by R0bin
this.textwidth = 8*int(strlen(#s(this.text)))*imgzoom;

ha!

and

if you dont use fixedwidth fonts....

i hate you :P

*edit*

FIXEDSYS PWNS YOU ALL!!!

Fixedsys also is very limitied in terms of fontsize.
My advice to you: Don't talk. (or post)

G_yoshi 11-05-2002 12:17 PM

Its probably better or maybe best to use FixedSys for easy reading. Everyone has it. I try to stay away from really fancy fonts as far as game text goes. You want the player to be able to read the text, right?

Kaimetsu 11-05-2002 12:46 PM

I too like fixed-width fonts. If you don't, though, you could probably do some crazy thing with wraptext2 and tokenscount checking to find the length. Completely inefficient, but you might have no choice.

Falcor 11-05-2002 09:39 PM

Quote:

Originally posted by Kaimetsu
I too like fixed-width fonts. If you don't, though, you could probably do some crazy thing with wraptext2 and tokenscount checking to find the length. Completely inefficient, but you might have no choice.
I was going to do that, but its not worth the time and preformance loss. I'd rather just have a command for getting the width of it. Is this such a hard command to make or something? *shrugs* I'd use Fixedsys, but its not like I can do many fontsizes with it... Plus it kinda looks ugly and I'd rather use Tempus Sans or Verdana or something more human.

R0bin 11-05-2002 10:01 PM

maybe you could just manually count the pixels in every letter of the font you want to use

Com013 11-06-2002 12:58 AM

Re: Re: Text Length
 
Quote:

Originally posted by CheeToS2
just a hunch, but could you tell us what it is you're making? :P

This doesn't address me, but I once wanted to make a radio where the text scrolls through a small window (using changeimgpart), but I failed because I needed to know how long the string is (pixel size) to stop scrolling and start displaying the next string... (or to jump back to the start).

R0bin 11-06-2002 01:50 AM

Quote:

Originally posted by R0bin
maybe you could just manually count the pixels in every letter of the font you want to use

Falcor 11-06-2002 03:22 AM

Quote:

Originally posted by R0bin
maybe you could just manually count the pixels in every letter of the font you want to use
Oh yes, spend tedius extra time to count the pixels of every single font and every single character. I'm sure that is well worth my time. :rolleyes:

Please take my prior advice and just stop posting.

Kaimetsu 11-06-2002 12:44 PM

Quote:

Originally posted by Falcor

I'd use Fixedsys, but its not like I can do many fontsizes with it... Plus it kinda looks ugly

Easier to read, though.

Dach 11-06-2002 07:43 PM

Re: Re: Re: Text Length
 
Quote:

Originally posted by Com013

This doesn't address me, but I once wanted to make a radio where the text scrolls through a small window (using changeimgpart), but I failed because I needed to know how long the string is (pixel size) to stop scrolling and start displaying the next string... (or to jump back to the start).

This is what the script I posted does. (jumps back to start) Took way to long to figure out how to make it work right.


All times are GMT +2. The time now is 04:27 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.