Giter VIP home page Giter VIP logo

pyftgl's Introduction

README for PyFTGL


Introduction
============

FTGL is a free, open source library to enable developers to use
arbitrary fonts in their OpenGL applications. Unlike other OpenGL font
libraries FTGL uses standard font file formats and the Freetype font
library to open the fonts.

PyFTGL in turn wraps the functionality of FTGL into a Python module so
that it can be used in conjunction with PyOpenGL.


How to build
============

Prerequisites
-------------

Make sure you have the necessary libraries installed before attempting
to build PyFTGL.

   * FTGL
     http://homepages.paradise.net.nz/henryj/code/#FTGL

   * FreeType
     http://www.freetype.org/

   * boost::python
     http://www.boost.org/


Build
-----

$ python setup.py build


Install
-------

$ python setup.py install


How to use
==========

Overview
--------

To use PyFTGL, start by import it:

>>> import FTGL

PyFTGL supports six different rendering modes:

   * Bitmap
   * Anti-aliased pixmap
   * Anti-aliased texture maps
   * Outlines
   * Polygon meshes
   * Extruded polygon meshes

The first two modes draw directly to the screen raster, the texture
map mode draw textured quads, while the last three draw actual
geometry.

The indivdual modes are encapsulated in their respective class:

   * BitmapFont
   * PixmapFont
   * TextureFont
   * OutlineFont
   * PolygonFont
   * ExtrdFont

However, the protocol for all modes are the same:

>>> font = FTGL.PolygonFont("example.ttf")
>>> font.FaceSize(24)
True
>>> font.line_height
37.51171875
>>> font.Render("foo")

Obviously, you need to set up the OpenGL environment to make it
useful. Please see the example.py script for a demonstration of
PyFTGL.


Classes
-------

class BitmapFont()
class PixmapFont()
class TextureFont()
class OutlineFont()
class PolygonFont()
class ExtrdFont()

  Methods defined here:

  Advance(string)
      Get the advance width for a string.

  Attach(font_file_path)
      Attach auxilliary file to font e.g font metrics.
      Note: not all font formats implement this function.

  BBox(string)
      Get the bounding box for a string. Returns tuple.

  Depth(depth)
      Set the extrusion distance for the font. Only implemented 
      by ExtrdFont.

  FaceSize(size[, res])
      Set the char size for the current face.

  Render(string)
      Render a string of characters.

  UseDisplayList(useList)
      Enable or disable the use of Display Lists inside FTGL.

  __init__(font_file_path)

  Properties defined here:

  ascender
      The global ascender height for the face.

  descender
      The global descender height for the face.

  line_height
      The line spacing for the font.

pyftgl's People

Contributors

dahnielson avatar shmookey avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

hadron

pyftgl's Issues

GLU library not found

I am trouble installing PyFTGL on my conda environment on my MacOS 10.10.5.

I have boost-vpython 1.55.0, freetype 2.9.1, and FTGL 2.1.3 installed on my environment.

When running the python setup.py build command from the pyftgl source code directory, I get the following error message: ld: library not found for -lGLU.

I find this weird because I cause already use OpenGL (from OpenGL.GLU import *) without problem.

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.