I’m a little tired of SDL_TTF and its idiosyncracies. I was looking at alternative formats and found AngelCode’s fnt bitmap format.
I didn’t find anything which already exists within the SDL community, so I was thinking of starting on a library myself and calling it SDL_Fnt, making it open source, etc.
Theoretical advantages over SDL_TTF:
Real-time rendering instead of caching rendered fonts as a single image. This would allow more efficient scrolling text which doesn’t require re-allocating a surface and copying to a texture every time the text changes.
No allocations other than vertices for UV-mapping the quads in the regular SDL RenderCopy calls
Can potentially apply motion effects/offsets to individual characters in the string, which would be cool in some game character’s dialog (such as a spooky ghost)
More accurate string-width calculations, perhaps.
- A bitmapped font sheet means imperfect scaling - scaling up will result in texture interpolation. As TTF is a vector format, this doesn’t happen with SDL_TTF. This would not really be a problem with pixel-art fonts since they’re meant to scale with nearest-neighnbor anyways. Scaling down would also be a problem without mipmapping
This would still allow people to render text once and cache the image for re-use, but they may have to allocate the texture/surface and set the render target themselves, but perhaps that could be wrapped as well.
Would anyone be interested in this library? Is my use-case for it too specific to warrant supporting it for the community, or should I just throw it in my game engine