How does the text rendering work?

Hi, i wonder how the text rendering works in 4coder. Do you blit a bitmap through OpenGL for every character? And if we want to dynamically resize the font, do you re-rasterize the entire font?

Edited by Terans on Reason: Initial post
Running ldd reveals that fonts in 4coder are rasterized using freetype (at least on linux). Freetype gives you high quality bitmaps, which you then pack into a texture atlas (googlable), probably using something like stb_rect_pack or by hand. This atlas is then uploaded to the GPU, and offsets into this texture are used to draw individual letters.

How font resizing is handled I'm not sure.
aolo2
How font resizing is handled I'm not sure.


If the characters in the texture atlas are drawn on top of quads that are sent to the GPU as vertex buffers, then resizing could probably be a simple scaling matrix. Since I don't have much experience on text rendering, this is the only method I'm familiar with.

Edited by Leonardo on
I think 4coder creates a new atlas when you change the font size. Scaling the quads will quickly degrade quality of the text rendering.