GithubHelp home page GithubHelp logo

imclab / ftgles Goto Github PK

View Code? Open in Web Editor NEW

This project forked from damian0815/ftgles

0.0 1.0 0.0 18.89 MB

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

Home Page: www.davidpetrie.com

License: MIT License

ftgles's Introduction

FTGLES 0.3

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, with plans to port to Android in the very near future. iOS 4.2 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.

QUICK INSTALL

git clone [email protected]:cdave1/ftgles.git
git clone [email protected]:cdave1/freetype2-ios.git
cd freetype2-ios/
bash install.sh
cd ../ftgles
ln -s ../freetype2-ios freetype2
cd Xcode
bash install.sh

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 0.1 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

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

ftgles's People

Contributors

cdave1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.