0
votes

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.

1
that will be a little slow have you measured?Bartek Banachewicz
Hmm, do you recommend me to be opening/closing the font each time I render and swap the pixel buffers? That affects the opengl rendering speed? Please tell me :) ThanksSpamdark
I've just asked you if you actually measured the impact on performacnce.Bartek Banachewicz
Hmm, I haven't actually... I'm not doing that because 1 friend told me that it was a bad idea and slow... Because im opening the ttf font from resource (.rc)... I will test it and I'll tell you.Spamdark
It causes me a flickering... already measured.Spamdark

1 Answers

0
votes

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.