Is there a max size limit to fonts? On the screenshot, the large white rectangle should be displaying a ‘1’, but instead it’s drawing a rectangle. If I reduce the font size, it’ll draw correctly. On different devices the max size seems to be different.
Did you ever solve this? I don’t have an answer, but I assume it’s because it tries to create an atlas texture that is too large for the device. Trace through ofTrueTypeFont::loadFont and see what
is trying to do.
No, haven’t solved it. I’ll try tracing through to see.
So there’s some type of device texture size limitation? Assuming you can draw images the full size of the screen and the font is smaller than the screen size, seems odd to hit the limit.
Font texture atlasaseseseses can get BIG! Remember every character in the font gets rendered as a bitmap when you load a TTF with ofTruetypeFont, which then needs to generate a single atlas big enough to fit all of the character bitmaps. At the size you’re drawing, I think you’ll either have to render a smaller font and scale up, or create a limited character texture atlas, because I can almost guarantee it’s blowing past the 2048x2048 or 4096x4096 max texture sizes of most devices.
Ah ok, I guess I didn’t understand how TTF is working. That makes sense. If it’s making a the full character set then yeah with a font around 280px (and double when retina) it’s past the limit. Scaling up isn’t really a viable option. I’ll have to look if it’s simple to limit the character set (only need numbers) or resort to using my own image(s).
Thanks for the tip!
You could also look at ofxFontStash (or just use fontstash manually) as it has more sophisticated atlas handling (it can create multiple texture atlases automatically for large sizes)
Yeah, I’ll be taking a look at it. Just was hoping to not have to since I’m already using addons that integrate TTF specifically. So I’d have to rewrite those too.
Yeah, same here, that’s why I generally just stick with the ofTrueTypeFont compromise. Would be nice to extend it to only render a needed subset of characters.
Hi! Sorry for bringing up such an old topic but recently had the same issue.
I used ofScale to make my text larger but edges weren’t sharp anymore.
When checking the documentation I found that when the font is loaded I can set
_bFullCharacterSet to false which lets me reach larger font size.
myFont.load("arial.ttf", 250, true, false);