0

I am working with sdl ttf for rendering text to opengl, actually everything it's fine, but like you know, when you open a ttf sdl file you specify it on pixels, and you can't change the font size. Actually you can change the font size but you need to close and re-open the font, and that will be a little slow, so, is there any way to change the font size or something like that?

I need to do the following: Font size that can get resized and adjusted to the window screen (like the opengl -1.0f - 1.0f range that works with something similar to percent), multiline rendering support with no background.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Spamdark
  • 1,341
  • 2
  • 19
  • 38

1 Answers1

0

You could put it on a surface and scale the surface. That will probably deform the text, which might be an issue.

Or you could have an array of text sizes. Load the same font with a range of text sizes. As you scale your image, use the different fonts instead of changing the size of one font.

Philip
  • 1,539
  • 14
  • 23
  • I have been thinking on that, actually, i'm going to do that! Great idea, I was only waiting for any confirmation. I don't like to work with sdl ttf... but well, it's the closest library that I have. – Spamdark Feb 08 '13 at 21:06
  • The way my project is setup, I was unable to make FreeType work (I couldn't get past a black rectangle). If I tried running my shaders, nothing would render. I finally managed to get SDL_TTF to display text, although I have a bit of an annoying flicker because it makes use of an SDL_Renderer. – Artorias2718 Mar 29 '17 at 18:50