get font height?
Displaying 1-15 of 15 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
chanman

is there a function to get the height of a font? with enableVaribleWidth() also?

Posted on 2004-06-08 01:46:42

Gayo

I would also like this. A function to get the width wouldn't be bad either, though of limited use for vw fonts.

Posted on 2004-06-08 02:52:17

Buckermann

There is a FontHeight(int FontHandle) function, I used it in my Windows program. But I'm not sure if this function is always reliable, so I made my own function I use when it looks like FontHeight() is acting funny,


//string Font_File is just the path+name of the image with the font
int TB_CheckFontH(string Font_File)
{
int Test_Image = LoadImage(Font_File);
int Font_Test = ((ImageHeight(Test_Image)-6)/5);
FreeImage(Test_Image);
return Font_Test;
}

Posted on 2004-06-08 03:40:43

el_desconocido

Quote:Originally posted by Gayo

I would also like this. A function to get the width wouldn't be bad either, though of limited use for vw fonts.

Uhh... Gayo, try:
font_width = TextWidth(font, "F");

The F of course is the grade you get in life for asking this. ;)

El

Posted on 2004-06-08 04:19:26

Gayo

Hmm, I guess it'd work if I did it before variablewidthing, true. Doh.

Posted on 2004-06-08 04:51:33

Interference22

There's still nothing for returning fontheight, mind you. Although the width of a font's "@" character is usually a good start.

Posted on 2004-06-08 11:37:03

chanman

I really want a fucntion like this so I don't have do a #define FONT_HEIGHT. plus then my "kool univerasal text box" would work with other games too =)

Posted on 2004-06-08 15:00:06

RageCage

buckerman's function looks like itd work

Posted on 2004-06-08 18:41:28

rpgking

Why would you need font height when all fonts have one constant height?

#define is the best solution. Better to take care of as much things as possible during compile-time...

As for Chillaxen's universal textbox, how hard would it be for someone to go in and change the value of the #define? They'd just have to change that value once and be done with it. ;)

Posted on 2004-06-08 19:49:40 (last edited on 2004-06-08 19:52:21)

chanman

Quote:Originally posted by rpgking

Why would you need font height when all fonts have one constant height?

#define is the best solution. Better to take care of as much things as possible during compile-time...

As for Chillaxen's universal textbox, how hard would it be for someone to go in and change the value of the #define? They'd just have to change that value once and be done with it. ;)


yes, but my textbox lets you pass a font you want to display. So say you have like 20 different fonts then you have to #define all of them, and I hate having lots of #defines.

Posted on 2004-06-08 21:56:13

chanman

Quote:Originally posted by RageCage

buckerman's function looks like itd work


but when you do enableVaribleWidth(), it would change the height of the fonts...or does it?

Posted on 2004-06-08 22:01:44

vecna

Quote:Originally posted by Buckermann

There is a FontHeight(int FontHandle) function, I used it in my Windows program. But I'm not sure if this function is always reliable, so I made my own function I use when it looks like FontHeight() is acting funny,


In what way does FontHeight() not behave as you expect?

Posted on 2004-06-08 22:29:10

vecna

whether a font is variable width or not has no bearing on the font cell height at all.

Posted on 2004-06-08 22:29:55

Buckermann

Quote:Originally posted by vecna


In what way does FontHeight() not behave as you expect?

It seems that the value returned of FontHeight() is sometimes to small for larger fonts (above 20 pixel height). But before you dig deep into the sorce code to find some error, you have to consider that MY code is a bit messy sometimes. So it it's possible that it's just a error on my side.

Posted on 2004-06-08 22:37:30

RageCage

no he's right, getfontheight returns the width

Posted on 2004-06-09 22:24:26


Displaying 1-15 of 15 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.