• Advertisement
Sign in to follow this  

TTF_Font question about font size

This topic is 2999 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

How do you resize a font? I know that there is a TTF_SizeText but:
/* Get the dimensions of a rendered string of text */
extern DECLSPEC int SDLCALL TTF_SizeText(TTF_Font *font, const char *text, int *w, int *h);
extern DECLSPEC int SDLCALL TTF_SizeUTF8(TTF_Font *font, const char *text, int *w, int *h);
extern DECLSPEC int SDLCALL TTF_SizeUNICODE(TTF_Font *font, const Uint16 *text, int *w, int *h);


I believe that just get's the size the text instead, of the actual size of the font itself. Would I have to open a new font with the size I want? TTF_CloseFont(Font); Font = TTF_OpenFont(FontName, sizeIwant); I would like to 'resize' rather then create anew. Also... What would be the consequences of doing what I did above? I only want one type of the same font to be open at a time.

Share this post


Link to post
Share on other sites
Advertisement
I think the OpenFont command that you are using will actually rasterize the splines and vectors in the font. There's no need to close the first font before you open the next unless you're short on memory. Just use multiple handles for the different sizes of fonts you're using.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement