Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
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 Offline OP

Programmer
Lukas  Offline 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#Post329125

Apparently, 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: Lukas] #329489
06/20/10 14:40
06/20/10 14:40
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
yeah, that would be a cool feature!


Visit my site: www.masterq32.de
Re: Text height or number of lines [Re: MasterQ32] #331483
07/04/10 16:37
07/04/10 16:37
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
bump laugh

Any chance for that feature?

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 Offline
Serious User
MMike  Offline
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.
Re: Text height or number of lines [Re: MMike] #331539
07/04/10 22:17
07/04/10 22:17
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline OP

Programmer
Lukas  Offline OP

Programmer

Joined: May 2007
Posts: 2,043
Germany
"Depends on how accurate you need to be, but."
It has to be absolutely accurate. It is supposed to be a GUI library, so the user should be able to use any text and it should recognize how many lines the text has. The only workaround so far would be setting the number of lines manually. But that wouldn't work if the text depends on user input.
The only way to find out the height on runtime I could imagine would currently be rendering the text onto a bitmap and examining that bitmap. That would be unnecessarily slow and would ignore empty lines at the end of the text.

"Not sure how accurate it is,..."
Not accurate enough to work for all possible texts.

"ps: the height of the character is the font number i think no?"
Yes, but this includes the space between lines.


Moderated by  aztec, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1