rougier / freetype-gl

OpenGL text using one vertex buffer, one texture and FreeType
Other
1.65k stars 266 forks source link

Added Feature to Enlarge the Texture atlas #154

Closed cmrschwarz closed 7 years ago

cmrschwarz commented 7 years ago

Added the method texture_font_enlarge_atlas which allows resizing of the texture atlas while keeping all existing glyphs validated. Unfortunately it has to be part of the texture_font_t "class" as the glyphs' uvs need to be updated.

rougier commented 7 years ago

Nice, thanks. Could you write a simple example showing usage ?

cmrschwarz commented 7 years ago

font.zip Alright I made this ...thing based on the font.c demo. Just put the c file in place of the current font.c and it should work. Can't really test it so it might have some stupid errors, sorry. Should show the resizing quite nicely. Only problem with this method is that it doesn't handle multiple fonts in one atlas. IMHO you shouldn't do that anyway in production code anyway, but it could be made possible using an array of fonts as parameter instead, or by creating a inform_font_atlas_size_changed(f,w,h) method.

rougier commented 7 years ago

Thanks !

cmrschwarz commented 7 years ago

Thank you for merging :).