03-28-2001, 03:10 AM
In Nehe font tutorial (lesson 14), the length of the text is obtained in glPrint() function. But i am trying to get the height of the text. It always returns zero. Is it possible to get height? How?.
What do you mean height? Do you mean like in number of lines?
in that case you'd have to use /n (but glPrint(), as far as i know, will not allow for /n) or you could set a series of glprint and then set each on a co-ordinate relative to where you want it to be? Or even create a loop where the 'y' co-ord. are incremely decreased in accordance the font size.
Now if you mean height in terms of font size, then you'd have to modify the glPrint() func or the win font function. I'm not sure how the windows one handles fonts though, but i think instead of agl, you use wgl. Any how look at the code below:
kFontIDMonaco, // Choose your font. These are listed in Fonts.h,
// or use GetFNum() toolbox function.
bold, // Style, Also in Fonts.h
24, // <---- font size
32, // start at 32 ...
96, // go for 96 characters ...
you could even set font size as a variable, i.e. int font_size; and then assign a key to it which will allow you to change the font size.
I hope that helped.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.