Sunteți pe pagina 1din 1

Androids hardware accelerated font renderer was originally written by a co-worker

on the Renderscript team and was then improved upon and optimized by several eng
ineers including my good friend Chet Haase and I. You can easily find many tutor
ials on how to render text with OpenGL but most??if not all??articles focus on games
and conveniently avoid dealing with difficult issues.
The approach described here is by no means novel but I thought it would be conve
nient for some developers to get a high-level overview of how a complete GPU-bas
ed text rendering system can be implemented. This article also describes a few o
ptimizations that are easy to implement.
A common way to render text with OpenGL is to compute a texture atlas that conta
ins all the needed glyphs. This is often done offline using fairly complex packi
ng algorithms to minimize waste in the texture. Creating such an atlas obviously
requires to know ahead of time what fonts??this includes face, size and various o
ther properties??and glyphs will be used by the application at runtime.

S-ar putea să vă placă și