My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Links

Description

Python bindings for the FreeType library. Only the high-level API is bound.

Installation

To be able to use freetype.py, you need the freetype library version 2 installed on your system.

Mac users

Freetype should be already installed on your system. If not, either install it using macports or compile it and place the library binary file in '/usr/local/lib'

Linux users

Freetype should be already installed on your system. If not, either install relevant package from your package manager or compile from sources and place the library binary file in '/usr/local/lib'.

Window users

You can try to install a window binaries available from the Freetype site or you can compile it from sources. In such a case, make sure the resulting library binaries is named 'Freetype.dll' (and not something like Freetype245.dll) and make sure to place a copy in Windows/System32 directory.

Usage example

    >>> import freetype
    >>> face = freetype.Face('Vera.ttf')
    >>> face.set_char_size( 48*64 )
    >>> face.load_char('S')
    >>> bitmap = face.glyph.bitmap
    >>> print bitmap.buffer

Screenshots

Screenshot below comes from the wordle.py example. No clever tricks here, just brute force...

Screenshots below comes from the glyph-vector.py and glyph-vectopr-2.py examples showing how to access a glyph outline information and use it to draw the glyph. Rendering (with Bézier curves) is done using matplotlib.

Screenshot below comes from the glyph-color.py showing how to draw and combine a glyph outline with the regular glyph.

The screenshot below comes from the hello-world.py example showing how to draw text in a bitmap (that has been zoomed in to show antialiasing).

The screenshot below comes from the agg-trick.py example showing an implementation of ideas from http://www.antigrain.com/research/font_rasterization/.

Powered by Google Project Hosting