3 registered members (NewbieZorro, TipmyPip, 1 invisible),
19,045
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Text height or number of lines
#329488
06/20/10 14:35
06/20/10 14:35
|
Joined: May 2007
Posts: 2,043 Germany
Lukas
OP

Programmer
|
OP

Programmer
Joined: May 2007
Posts: 2,043
Germany
|
Hi, I tried to find out how to get the height or number of lines of a text (you can get the other thing with font.dy) in this thread: http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=329125#Post329125Apparently, there is no engine function which can do that. You can count the "\n"s in the string(s) of the text, but that doesn't work if the WWRAP flag is set. So, could there please be an engine function like var txt_height(TEXT*) or something like text.lines?
|
|
|
Re: Text height or number of lines
[Re: Rei_Ayanami]
#331530
07/04/10 20:53
07/04/10 20:53
|
Joined: Jul 2004
Posts: 1,710
MMike
Serious User
|
Serious User
Joined: Jul 2004
Posts: 1,710
|
i think you can do this i did some long time ago.
for a workaround.. Depends on how accurate you need to be, but.
You count the lines by str_stri finding the number of /n sequence, and then, you use the plugin of joozey i think that counts the length of the text, and then you divide the length by the number of \n and also with the size_x of the text limit.( that defines the wwrap moment) :S
Not sure how accurate it is, but it worked okay for me, on that time.
ps: the height of the character is the font number i think no?
like arial 20 = 20px height? :s but i can confirm that on photoshop arial 20 is totaly different from engine arial 20 dont know why (and im counting with and wihout the smooth options of fonts in PS)
Last edited by MMike; 07/04/10 20:58.
|
|
|
|