Run Interactive Python in FontForge

FontForge does not feature a docked, interactive graphical Python REPL directly embedded inside its main user interface, but you can still run Python interactively with FontForge's engine. Depending on your workflow, you can either execute Python commands via the built-in GUI script dialog, run an interactive shell through FontForge’s command-line interface, or import FontForge as a standard module inside any external Python console.

The GUI "Execute Script" Window

While FontForge lacks an integrated terminal window like Blender or QGIS, it provides a basic script runner within the graphical interface:

  1. Open FontForge and go to File > Execute Script... (or press Ctrl + Alt + E).
  2. Set the script type dropdown to Python.
  3. Type or paste your Python code into the text area.
  4. Click OK to execute.

This dialog executes one-off blocks of code against the currently active font window, but it does not maintain persistent line-by-line interactive feedback like a true REPL.

Running an Interactive Terminal Session

To get a genuine interactive Python prompt that has access to FontForge’s internal libraries, launch FontForge directly from your system terminal with the language flag:

fontforge -lang=py

This command opens an interactive Python interpreter directly inside your terminal session, pre-configured with the fontforge environment. You can immediately inspect objects, manipulate glyphs, and test commands in real time.

Using an External Python Console

If FontForge is built and installed with Python bindings on your system, the most powerful method is importing the library into an external interactive environment like IPython, standard Python, or a Jupyter Notebook:

import fontforge

# Open a font interactively
font = fontforge.open("path/to/font.sfd")
print(font.fontname)

Running FontForge through an external REPL gives you tab-completion, history tracking, and full debugging capabilities, making it the preferred approach for interactive font automation.