Code Monkey home page Code Monkey logo

freetype-py's Introduction

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)
  • Matthew Sitton (bug report & fix)
  • Tao Gong (bug report)
  • Matthew Sitton (Remove raw interfaces from the __init__.py file)
  • Daniel McCloy (Adde glyph_name function)

freetype-py's People

Contributors

rougier avatar mdsitton avatar asvel avatar shtrom avatar drammock avatar jbg avatar tilka avatar vagran avatar

Watchers

James Cloos avatar Cosimo Lupo avatar  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.