Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
TEXT.char_x, char_y #180087
01/27/08 00:14
01/27/08 00:14
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline OP
Expert
Joozey  Offline OP
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
The manual states:
Quote:


text.char_x
text.char_y
Size of a single character of the FONT in pixels. These values can't be changed, but may be used in functions to determine the bounds of the text display.





At first I was wondering how the width of truetype fonts can be retrieved, but when I tried using char_x and _y in a textobject, it appeared that both properties were not even member of a TEXT object.

This is my code:
Code:


FONT* standard_font = "Arial#18i";
TEXT* interfacetext = {
font = standard_font;
strings = 1;
layer=55;
}

...

if (interfacetext.char_y > 50) {
str_cat(typemachine_str, "\n");
}



Did I do something wrong or is this function not supported anymore with Lite-C? Couldn't find any info about it anywhere.
And what about truetype fonts with .char_y? Is there anyway at all to see how big the 'textbox' is?

Thanx in advance


Click and join the 3dgs irc community!
Room: #3dgs
Re: TEXT.char_x, char_y [Re: Joozey] #180088
01/27/08 00:29
01/27/08 00:29
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline OP
Expert
Joozey  Offline OP
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
I found out that the font object has the properties dx/dy to see the width and height of a font (thanx to the lovely search button which I forgot).
I outputted the dx value of a truetype font, and each character of such a font appears to be '2'.

Whatever unity '2' may have (if it were pixels, then my font would be very very small I guess), how can a font with various character width have a constant of '2'?

I need to know when a string goes out of my defined boundaries, and place it on the next line...
How can I solve this at all?


Click and join the 3dgs irc community!
Room: #3dgs
Re: TEXT.char_x, char_y [Re: Joozey] #259401
04/05/09 21:54
04/05/09 21:54
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
so did you solved this? because im on it .. and i need this too

Re: TEXT.char_x, char_y [Re: MMike] #259667
04/07/09 07:55
04/07/09 07:55
Joined: Mar 2009
Posts: 112
Germany
K
KDuke Offline
Member
KDuke  Offline
Member
K

Joined: Mar 2009
Posts: 112
Germany
Hi guys! First of to get the horizontal size:
Originally Posted By: manual.3dgamestudio.net

str_width (STRING*, FONT*)

Returns the width of the string in a given font. A7.3


Parameters:
STRING* - Pointer to a STRING or char array (3 or more chars; must not contain line feeds).
FONT* - FONT pointer, or NULL for the default Arial font.

Returns:
Horizontal size of the string in pixels.

Speed:
Medium

Example:

temp = str_width("Hello ",NULL);


And for the height of one line of the text it is the point-value of the truetype in pixel! For example "Arial#24bi" would be 24 pixels tall!

I hope that gets you further.

greetings
K-Duke


Using A7 Free
Click and join the 3dgs irc community!
Room: #3dgs
Re: TEXT.char_x, char_y [Re: KDuke] #259806
04/07/09 19:44
04/07/09 19:44
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
Yeah but im using line feeds, not direclty but using the wrap flags, how do i solve this?


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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