Render text in purely native Android app [closed]

老子叫甜甜 提交于 2019-12-07 07:20:43

问题


I have a purely native Android NDK app, and need to render some text at every frame. I have read posts saying that I need to create a single image file with all the characters of my font, and then render each character as a quad from this image. This sounds like a lot of work and I don't know where to obtain such an image file for a simple font, like Arial. Is there an alternative, easier approach to drawing text in a purely native Android app?

Or, where can I retrieve such an image file to make my own font renderer?


回答1:


You might want to see if you can integrate a font renderer into your app. FreeType is a popular one that is written in pure C with no external dependencies which make it easy to use. OGLFT is a version of FreeType that renders to OpenGL. I would do a little more research to see if there are alternatives that may be a better fit but these seem to be pretty good.

This seems to be even better.



来源:https://stackoverflow.com/questions/7165097/render-text-in-purely-native-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!