Ticket #1117 (new enhancement)
Replace unifont interface with CFontManager
| Reported by: | historic_bruno | Owned by: | |
|---|---|---|---|
| Priority: | Nice to Have | Milestone: | Backlog |
| Component: | Core engine | Keywords: | hmgr,font,simple |
| Cc: |
Description
Font textures and associated data are currently handled by unifont, which is a low-level C style wrapper around the h_mgr system. It would be better if we had a CFontManager instead to abstract this and provide a central point for loading and reloading fonts (useful for fixing #741). It would mirror other managers we have like CTextureManager and CShaderManager. gDEBugger also indicates we're leaking font textures, maybe implementing this would provide a better means of cleaning them up?
Change History
Note: See
TracTickets for help on using
tickets.

Possibly relevant recent change: all the code that rendered text with unifont has now been changed to use the new CTextRenderer, which provides a more appropriate level of abstraction. Some still uses CFont directly to get text metrics (line spacing, character width, etc) - it'd probably be best to expose that data via CTextRenderer somehow, so nothing else needs to use CFont.
Then I think it'd probably be best to delete CFont and unifont, create a new CFont that contains the old unifont file-loading functionality directly (and then it can use CTextureManager instead of raw ogl_tex, for improved consistency and compression support etc), and create a new CFontManager that is a simple global cache of CFonts (probably accessed by CTextRenderer as g_Renderer.GetFontManager()).