Skip to main content

Freetype python bindings

Project description

FreeType high-level python API

Freetype python provides bindings for the FreeType library. Only the high-level API is bound.

Documentation available at: http://freetype-py.readthedocs.org/en/latest/

Installation

To be able to use freetype python, 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 homebrew 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.

doc/_static/wordle.png

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.

doc/_static/S.png doc/_static/G.png

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

doc/_static/outline.png

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).

doc/_static/hello-world.png

The screenshot below comes from the agg-trick.py example showing an implementation of ideas from the Texts Rasterization Exposures by Maxim Shemarev.

doc/_static/agg-trick.png

Contributors

  • Titusz Pan (bug report)

  • Ekkehard.Blanz (bug report)

  • Jānis Lībeks (bug report)

  • Frantisek Malina (typo)

  • Tillmann Karras (bug report & fix)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

freetype-py-0.5.1.tar.gz (306.0 kB view details)

Uploaded Source

File details

Details for the file freetype-py-0.5.1.tar.gz.

File metadata

  • Download URL: freetype-py-0.5.1.tar.gz
  • Upload date:
  • Size: 306.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for freetype-py-0.5.1.tar.gz
Algorithm Hash digest
SHA256 9fded2d8dc5204bcb8fd96c101282acf285e50d902ef4ece7ad42e56c623abc2
MD5 ff017e3977a6aa5e99f1af19dfc5c67a
BLAKE2b-256 efd3dacb27a4159e49e5015b9b0d82428b2361118ea705c4dfd96fbed5d2b409

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page