Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Quad), 608 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Measure String #305890
01/18/10 07:53
01/18/10 07:53
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Hi, Can we have a function that returns the size in pixels of a string, rendered using a given font. The width and height should be returned in a vector...

VECTOR* str_pixels(STRING* string, FONT* font).

Of course, if there are any current methods people know, then if you wouldn't mind sharing.

Thanks, David.

Last edited by DJBMASTER; 01/18/10 08:02.
Re: Measure String [Re: DJBMASTER] #305895
01/18/10 09:29
01/18/10 09:29
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Online
Senior Expert
Quad  Online
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
str_width (STRING*, FONT*);

check manual, i am not sure about the height tho.


3333333333
Re: Measure String [Re: Quad] #305898
01/18/10 10:41
01/18/10 10:41
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Ahh thanks, missed that somehow. It's strange there isnt a 'str_height'.

Re: Measure String [Re: DJBMASTER] #306299
01/21/10 01:26
01/21/10 01:26
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
hey, font.dy stores the height of the font
unfortunately str_width doesn't seem to be too accurate, and has even more problems when using bold and italic

Re: Measure String [Re: MrGuest] #306312
01/21/10 05:54
01/21/10 05:54
Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
GorNaKosh Offline
Junior Member
GorNaKosh  Offline
Junior Member

Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
Very nice info, thx! Didn't find the .dy property in the manual anywhere...

Re: Measure String [Re: GorNaKosh] #306411
01/22/10 00:29
01/22/10 00:29
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Does anyone know how I could measure the height/width of the text produced by a 'digits' definition?

Last edited by DJBMASTER; 01/22/10 00:29.
Re: Measure String [Re: DJBMASTER] #306439
01/22/10 09:49
01/22/10 09:49
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
You could simulate the digits text with a str_printf call, and then use str_width the get the pixel-precise width of that text.

Re: Measure String [Re: DJBMASTER] #306444
01/22/10 10:26
01/22/10 10:26
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Originally Posted By: DJBMASTER
Does anyone know how I could measure the height/width of the text produced by a 'digits' definition?


If you find a nifty solution, would you be willing to share the snippet? laugh

Re: Measure String [Re: FBL] #306446
01/22/10 10:40
01/22/10 10:40
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
The 'str_printf'/'str_width' method that jcl said should work. I'm currently doing this through C#, rather than lite-c, so i'm using a workaround and it works fine.

Re: Measure String [Re: DJBMASTER] #332709
07/11/10 18:05
07/11/10 18:05
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
str_printf returns a string ? and divide by str_width? :s or you mean "OR" ?


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