I want to write a hardware text accelerator using Free Type 2 to download fonts, find the correct glyphs and sizes, etc.
My plan is to have a large texture that contains glyphs (for a given font, size, etc.) in the video memory, and a table for each texture that defines information about the contents of the texture in system memory.
Then I can use the table to create a vertex buffer to render the text.
The problem I am facing is building a texture, it is not practical to create a texture for each glyph in Unicode, there are too many. For Ascii, in the past I just created the texture in the image editor and then populated the table as needed in advance, however, for this I need some kind of dynamic system that will get the glyphs I need, but also cache them efficiently to avoid reloading the same thing glyph in vram ... (however the least frequently used system is)
Another problem is not that all glyphs are the same size, I could divide the texture into a grid large enough for the largest glyphs (which I need to figure out exactly), which makes it easy to set the glyphs to the texture and replace them with new ones glyphs (based on the least frequently used or something else), however this leaves a lot of wasted space, but I'm not sure how to pack them more efficiently without encountering fragmentation problems, as the glyphs change and come out ...
I also suggest that updating the texture can stop the graphics hardware if the texture is still used for any previous text, is this a good guess and how can I avoid it if it is?