Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/julienr/libfont
A small library to render text in OpenGL/OpenGL ES using freetype.
https://github.com/julienr/libfont
Last synced: 8 days ago
JSON representation
A small library to render text in OpenGL/OpenGL ES using freetype.
- Host: GitHub
- URL: https://github.com/julienr/libfont
- Owner: julienr
- License: other
- Created: 2011-02-08T16:32:34.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2011-03-08T18:05:50.000Z (over 13 years ago)
- Last Synced: 2024-07-31T22:56:18.758Z (3 months ago)
- Language: C
- Homepage:
- Size: 231 KB
- Stars: 62
- Watchers: 8
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
=======
libfont
=======This library aims to provide an easy way to render text on Android OpenGL ES (or any other OpenGL/ES capable device).
Usage
=====
The *samples/* directory contains sample code.
It currently has sample for SDL and Android.Android
-------
Note that the sample uses NDK's Native Activity. Therefore, it requires a device (or the emulator) running Android 2.3.
But the code can be ported to work with the standard Java/JNI glue that was required for earlier android versionsThis is how the android demo should look :
.. image:: http://fhtagn.net/images/libfont/android-screen.png
Internals
=========
A font is loaded from a .ttf file using freetype and a font atlas (one big texture containing all the font glyphs) is created. The font altas creation is a one-time initialization process.When a string is rendered, the font atlas texture is bound and tex coords are used to render each glyph. This mean that once the font atlas for a particular font is loaded, rendering of arbitrary string is quite fast (at least _way_ faster than using freetype to render to texture and then use the texture to draw the text).
LICENSE
=======
The code is under a BSD license, see the LICENSE file.
The font provided with the sample comes from the "Liberation font" project[1]. It is licensed under the GPLv2 license with some exceptions (see FONT-LICENSE.txt)
[1] https://fedorahosted.org/liberation-fonts/