I need to make a TrueType/FreeType font renderer. So, I wanted to sort out my thoughts. I just want an overall theory how to make it.
Below are my thoughts how to make it. Please give feedback if it makes sense or not (or if it can be done easier/better). Even just one line answer would be enough (so I know if I'm going in the right direction).
Backstory and my requirements
I need basicly a typical 2D print(), without extras (I just setup an Ortho projection and use pixel perfect coordinates for everything, in practice not distinguishable from any 2D API, except speed). Right now I'm using SDL_TTF but it's soooo slow it's not bearable at all So, I mostly need just a relatively fast 2D TTF renderer that works with OpenGL 2.0 (note I don't need the fastest possible solution, just fast enough, I don't want to spend too much time on making YetAnotherFontRenderer, I just want one that is acceptable and then move on to making a game ). I was also considering using a library for this but after checking several I concluded it would be faster to write one (poor documentation, too high hardware requirements - use of shaders, overall bloated code, etc).
After big disappointment of SDL_TTF's performance I think I should use strictly my internal font format (texture with glyphs + table with various metrics), a TTF library would be used only to create the initial internal font file (TTF is simply not suitable for real time rendering). The game would first try to load the internal font file, if not present it would create it, save it and then attempt to load again (fast load).
2. Font size
I think I will treat various sizes of the same font (like 12 and 16) as completely separate fonts. Checking how I use fonts in practice so far it's completelly sufficient. I would skip all OpenGL resize (not really needed in my case and a font rendered for exactly the destination size should be always a bit prettier).
I'm not sure how antialiasing works, but wouldn't it be sufficient to render white font to the texture and then use glColor() before rendering the text? Instead of preparing separate textures for each colour?