• Stars
    star
    143
  • Rank 257,007 (Top 6 %)
  • Language
    C++
  • License
    MIT License
  • Created over 14 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A truetype font rendering library for OpenGL ES on iOS devices (iPad and iPhone)

FTGLES

FTGLES is a C++ library for rendering fonts on mobile operating systems with OpenGL ES 1.1. It is a port of FTGL. It currently targets the iPhone and iPad. Up to iOS 11.0 is currently supported.

From the FTGL notes:

"Unlike other OpenGL font libraries FTGL uses standard font file formats so doesn't need a preprocessing step to convert the high quality font data into a lesser quality, proprietary format."

"FTGL uses the Freetype font library to open and 'decode' the fonts. It then takes that output and stores it in a format most efficient for OpenGL rendering."

OpenGL ES 2.0 support has not yet been added to the main branch. Please see the gles2 branch for an experimental version of FTGLES that supports OpenGL ES 2.0.

Examples

Paragraphs

Polygons

Unicode

Performance Test

Should run at 60fps on a 2nd gen iPad.

QUICK INSTALL

There is default Xcode project within the repository. This also depends on another Xcode project containing the Freetype2 source code, configured for iOS. You can get both projects with these git commands:

git clone https://github.com/cdave1/ftgles.git ftgles
git clone https://github.com/cdave1/freetype2-ios.git freetype2

At this point, it should be possible to compile and run the Xcode projects in your ftgles/Demos/iOS folder.

INSTALL

See INSTALL NOTES for instructions on how to add FTGLES to your Xcode project or build using automake.

USAGE

Include the library in your code:

#include "FTGL/ftgles.h"

Create a font from a truetype file or opentype font:

FTFont *font = new FTTextureFont("/path/to/myfont.ttf");
FTFont *font2 = new FTTextureFont("/path/to/myotherfont.otf");
font->FaceSize(72);

To render the text within your render loop (fonts are rendered at the origin along the positive x-axis):

glColor4f(0.0f, 0.0f, 0.0f, 1.0f); // Black text
font->Render("Lorem ipsum dolor sit amet");

The Hello World Demo example class shows a minimal implementation of a render loop.

See the Demos folder for several comprehensive sample iPhone apps. The demo apps include a unicode demo, as well as a demonstration of how to use layouts to easily align and position your text.

Differences between FTGL and FTGLES

FTGLES supports the following font types from the original FTGL library:

  • FTBufferFont
  • FTGLOutlineFont
  • FTGLPolygonFont
  • FTGLTextureFont

Extrusion and pixmap rendering from the original FTGL library are currently not supported. Bitmap font support is currently in progress.

Performance Notes

If you need to render large amounts of text, Texture fonts are preferable, and also currently look much better than other font types. Texture fonts allow you to render a full screen of text without any appreciable drop in frame rate.

For Polygon and Outline fonts, rendering speeds depend very much on the type face being rendered. More complex glyphs will almost always contain more vertices, and thus FTGLES will need to draw more polygons or lines.

While you may get acceptable results by switching to a simple typeface, it is generally recommended that you avoid excessive use of Polygon and Outline fonts in iOS applications. Expect to see large drops in frame rate when drawing any more than 100-200 Polygon or Outline glyphs on screen.

Performance of the SimpleLayout class was previously very slow, but was recently improved in a recent build.

There is a Performance test application that will show the framerate of a screen full of text rendered using the SimpleLayout class, along with several font faces.

Licenses

MIT License:

  • FTGLES License here
  • Original FTGL License here
  • Freetype 2 License here

More Repositories

1

freetype2-ios

An Xcode project file that can be used to build the Freetype 2 project for iOS
C
130
star
2

freetype2-android

Freetype 2 for Android
C
52
star
3

shdr

Run shaders on the CPU to debug them easily (in javascript!!)
JavaScript
11
star
4

five-game

an iphone game
Objective-C
9
star
5

multitouchscreen

A class for handling mulitouch info from the iOS, useful in situations where user input needs to be synchronized with rendering. Also useful if you need to adapt a mouse-based app for the iOS multitouch environment.
Objective-C
8
star
6

nachos

a toy operating system
C++
6
star
7

opengles2-template

Starter template for shader pipeline in OpenGLES 2
Objective-C
6
star
8

experiments

Code experiments in a variety of different languages...
C
5
star
9

metronome-java

Sample android metronome app for my brother
Java
5
star
10

hdk

Game engine (and tools) to build 2.5d games for iOS and Android
C
5
star
11

ftgles-lite

lite version of ftgles
C++
5
star
12

fixedpointsprite

A small experimental iPhone app to try out OpenGL ES sprite animation using fixed point coordinates.
Objective-C
4
star
13

marching

A hacky implementation of the "marching squares" algorithm, in an OpenGL ES 1.1 iPhone app.
Objective-C
4
star
14

celljs

iOS app running a very simple javascript REPL, via spidermonkey.
C
3
star
15

stoked

Implementation of an entity component system
C++
3
star
16

difont

A font rendering library.
C
3
star
17

iglview

UIView for openGL ES apps on iOS. Supports iPad and iPhone 4's screen.
2
star
18

neon-vfp-diag

timing tests for various matrix functions on iOS devices with NEON/VFP chips.
C
2
star
19

cdave1.github.io

website files
HTML
1
star
20

multitouchview

A class for handling mulitouch info from the iOS, useful in situations where user input needs to be synchronized with rendering. Also useful if you need to adapt a mouse-based app for the iOS multitouch environment.
Objective-C++
1
star
21

peachy

An old php project - a command line utlity for the web
1
star
22

euler-hs

project euler in haskell
Haskell
1
star
23

skeleton

shader thing
C
1
star
24

soundtools

scripts for manipulating sound files
Shell
1
star
25

dotfiles

Emacs stuff
Emacs Lisp
1
star
26

euler

project euler stuff
C
1
star
27

functionpipeline

An experimental system for managing game object animation using selectors.
Objective-C
1
star
28

tetris

old directX implementation of tetris
C++
1
star
29

openpl

physics interface idea
C
1
star
30

picpac

A spritesheet packing tool that Just Worksβ„’
1
star
31

kolora

kolora palette editor
JavaScript
1
star
32

hontouniiioto

Android NDK application test using a native activity, OpenSL ES and OpenGL ES.
D
1
star
33

blogbot

an experimental system for auto-categorising rss content
Python
1
star
34

hdk-tango-v1

Tango UI editor for hdk v1
Objective-C++
1
star
35

Smashed

Source code for "Smashed", a game for iOS, released under GPL v3.0
C++
1
star
36

Liftweb-GAE

Liftweb template for Google App Engine
Scala
1
star
37

grfx

A dump of graphics and math functions to pick and choose from for iOS openGL demos and quick apps.
1
star
38

pyai

A collection of simple AI Algorithms
Python
1
star
39

freetype2-brew

Freetype 2 homebrew
1
star