README_PYPI.md
FontForge is a powerful, open-source font editor. This package provides the Python bindings for FontForge, allowing you to create, edit, and convert fonts programmatically.
pip install fontforge
import fontforge
# Create a new font
font = fontforge.font()
font.familyname = "MyFont"
font.fontname = "MyFont-Regular"
# Create a glyph
glyph = font.createChar(ord('A'))
pen = glyph.glyphPen()
# Draw the glyph...
# Open an existing font
font = fontforge.open("path/to/font.ttf")
# Access glyphs
for glyph in font.glyphs():
print(glyph.glyphname, glyph.unicode)
# Generate output
font.generate("output.otf")
This package installs two Python modules:
fontforge - The main font manipulation modulepsMat - PostScript transformation matrix utilitiesimport fontforge
import psMat
# Create a transformation matrix (scale 2x)
matrix = psMat.scale(2.0)
# Apply to a glyph layer
glyph.transform(matrix)
The wheel includes all required native libraries (FreeType, libxml2, etc.).
Pre-built wheels are available for:
FontForge was designed for interactive use with trusted font files. The codebase has known vulnerabilities, including buffer overruns, that can cause crashes and may be exploitable. Do not process untrusted input without thorough sandboxing.
If no wheel is available for your platform, pip will attempt to build from source. This requires:
See the build documentation for details.
This package provides only the Python module. For the full FontForge GUI application, see:
FontForge is licensed under the GPLv3+.