Is it possible to use Ubuntu's text rendering engine in my OpenGL program?
Is there a separate library or component that renders tex开发者_Python百科t in Ubuntu? How to write a OpenGL program that renders text exactly the same as the system?
If you get down to the bottom of any modern font rendering technology on Linux you'll usually find FreeType. You might also hear the word "Pango" come up. GTK on Ubuntu uses Pango as a text layout engine, but as I understand it Pango is just a multi-language text layout engine, and still uses FreeType for rasterization, which is probably all you're looking for. FreeType will rasterize your text strings, and then you can load them as textures.
Check out the API docs for FreeType:
http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html
And the tutorial pages:
http://www.freetype.org/freetype2/documentation.html
you might have a look at COGL and Clutter source code for an example with GL. The text library is Pango, which builds on FreeType.
精彩评论