1. Products
  2.   Font
  3.   Python
  4.   FontForge

Free Python Library for Fonts Creation & Conversion

Open Source Python API allows to create, modify and convert fonts in OpenType, TrueType, UFO, CID-keyed, and many other file formats.

FontForge is a versatile and feature-rich font editing tool that has gained popularity among software developers, typeface designers, and font enthusiasts. With its comprehensive set of tools and intuitive interface, the library provides a powerful platform for creating, editing and manipulating fonts inside Python applications. Developed by George Williams and an active community of contributors, it offers a user-friendly interface alongside a comprehensive set of tools that allow users to shape and refine every aspect of their typefaces.

FontForge, originally known as PfaEdit, has been in development for over two decades. With a rich history, this open-source font editor has gained popularity for its cross-platform compatibility, supporting major operating systems like Windows, macOS, and Linux. The library boasts an extensive array of features that cater to the diverse needs of font designers, making it a go-to tool for professionals in the field. Some Key features supported by the library are Glyph design and editing, import and export to other supported file formats, font hinting support, advanced font transformation, Unicode and multilingual support, font Optimization, and many more.

FontForge offers a user-friendly interface that makes it accessible to both beginners and experienced designers and has undoubtedly become a go-to tool for users seeking to create and refine fonts with precision, creativity, and efficiency. Whether you're a type enthusiast, a professional designer, or a font developer, the library empowers you to unleash your creativity and bring your typographic visions to life. With its open-source nature, cross-platform compatibility, and active community, it is a great choice for creating and managing font file formats.

Previous Next

Getting Started with FontForge

The recommended way to install FontForge is using CMake. Please use the following command a smooth installation.

Install FontForge via CMake

 git clone https://github.com/fontforge/fontforge && cd fontforge && mkdir build && cd build
cmake -GNinja ..

You can also install it manually; download the latest release files directly from GitHub repository.

Create a New Font using Python

TThe open source FontForge library allows software developers to create and manage new fonts inside their Python applications with just a couple of lines of code. Software developers can also customize the font further by adding more glyphs, adjusting their properties, and exploring the various features provided by the library. It supports both Bézier and PostScript outlines, offering extensive control over curve manipulation, point editing, and path adjustment. The following example shows how software developers can create a new font using Python commands.

How to Create a New Fonts using Python Apps?

import fontforge
import psMat
// Create a new FontForge font object
font = fontforge.font()
// Set font properties
font.fontname = "MyFont"
font.fullname = "My Font"
font.familyname = "My Font Family"
// Create a new glyph
glyph = font.createChar(65, "A")  # 65 is the ASCII code for 'A'
// Set glyph properties
glyph.width = 600  # Set the width of the glyph
// Draw the glyph using FontForge's drawing functions
glyph.addReference("A")  # Add a reference to the 'A' glyph
//Save the font file
// Export the font in a different format

Fonts Import & Conversion via Python API

The FontForge makes it easy for software developers to load and convert Fonts inside Python applications. It facilitates the import and conversion of fonts across various formats. It supports popular formats such as TrueType (TTF), OpenType (OTF), and PostScript (PS), allowing developers to seamlessly import existing fonts for modification or export their creations for use in different environments. Users can seamlessly bring in existing font files, allowing them to modify and enhance existing typefaces. Additionally, the library supports converting fonts between different formats, enabling compatibility across diverse design and publishing platforms.

Export Fonts to Different Formats via Ptyhon