Archived

This topic is now archived and is closed to further replies.

Loading fonts from file - how to change size?

This topic is 5748 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am using the font part of "Game Tutorials" lesson 01. And I can load my texture and show it to screen etc, BUT I can't figure out how to change size, ie glScalef(blah). Anyone got any ideas? CUselessStuff::NiftyQuote(); Edited by - BauerGL on March 24, 2002 12:12:12 PM

Share this post


Link to post
Share on other sites
i don''t know which tutorial it is, but anyways..

if it is a font created from a font data. then it probably uses the function CreateFont(...), so check out msdn


HFONT CreateFont(
int nHeight, // height of font
int nWidth, // average character width
int nEscapement, // angle of escapement
int nOrientation, // base-line orientation angle
int fnWeight, // font weight
DWORD fdwItalic, // italic attribute option
DWORD fdwUnderline, // underline attribute option
DWORD fdwStrikeOut, // strikeout attribute option
DWORD fdwCharSet, // character set identifier
DWORD fdwOutputPrecision, // output precision
DWORD fdwClipPrecision, // clipping precision
DWORD fdwQuality, // output quality
DWORD fdwPitchAndFamily, // pitch and family
LPCTSTR lpszFace // typeface name
);


and change the height of your font. if it is a tutorial, i guess there should be a variable to set the height of the font.

if you create your font from a texture file, then depending on how you seperate each letters... change the values in your drawing a)loops or b)values for vertices and tex coords.

Share this post


Link to post
Share on other sites
Well its a "font.tga" image with all the letters in it (duh). And the image is from "GameTutorial" lesson 1, at nehe.gamedev.net. And of course I can change the text so that it becomes bigger if I want to, but then ALL text written with that font will be of the same size. What I want to do is something like this:

Print text with normal sized font
glPrint("abalbal");

Print text that is bigger/larger
glScalef(2.0,2.0,0.0); (or something, this is what i want help with)
glPrint("blabl");

The question is "how do I make my fonts smaller/larger at will?"

CUselessStuff::NiftyQuote();

Share this post


Link to post
Share on other sites