4 ms·
How do you render fonts on the GPU? Do you use pathfinder, something else, or roll your own?
by jbritton 4y ago
How do you render fonts on the GPU? Do you use pathfinder, something else, or roll your own?
- audidude 4y agoCurrently, they are rendered using Pango (thus Cairo) to memory and then uploaded into a texture atlas. This happens once per-glyph/font/size (plus or minus some variants for x/y alignment). You then use the "color shader" to copy from the texture atlas into the destination FBO to both create the shape and color at the same time. Since you often do this for a whole text editor, you can copy all of the glyphs and color them in a single glDrawArrays()s. When GLyphy lands, it's a bit different. You preprocess the bezier curves into a simplified format (which doesn't have overlaps) and upload those to a texture atlas (but for general data). Then use GLyphy's shader program to render them, similarly to how the color shader was used. For more general paths, which is much slower but also still very neat, you would do something akin to Pathfinder.