Troubleshoot FontForge Segmentation Fault on Launch

A segmentation fault when opening FontForge usually indicates that the program attempted to access an unauthorized memory location, causing the operating system to terminate it immediately. This crash is most commonly triggered by corrupted user preferences, invalid system fonts that FontForge attempts to scan at startup, display server conflicts such as Wayland issues, or mismatched shared libraries. This guide provides direct, step-by-step methods to isolate the root cause and restore FontForge to working order.

Reset the User Configuration and Cache

Corrupted preferences or cached data from previous sessions frequently cause startup crashes. Resetting these files forces FontForge to generate fresh configuration defaults.

  1. Close any running instances of FontForge.
  2. Open your terminal and remove or rename the configuration directories:
    • Linux:

      mv ~/.config/fontforge ~/.config/fontforge.bak

      On older installations, also check for and remove ~/.FontForge:

      mv ~/.FontForge ~/.FontForge.bak
  3. Relaunch FontForge from the terminal to see if the issue persists.

Force the X11 Backend (Linux and BSD)

FontForge relies on older GUI toolkits that often behave unpredictably under modern Wayland display compositors, leading to segmentation faults during window initialization.

Force the application to run via the X11 compatibility layer (XWayland) by setting the GDK backend variable:

GDK_BACKEND=x11 fontforge

If this resolves the crash, make the fix permanent by adding export GDK_BACKEND=x11 to your ~/.bashrc, ~/.zshrc, or by editing the application's desktop launcher entry (fontforge.desktop) to execute env GDK_BACKEND=x11 fontforge.

Isolate Corrupted System Fonts

During initialization, FontForge scans installed system fonts. If a font file is damaged or contains non-standard tables, the font parser can crash the program.

To determine if a font is causing the crash:

  1. Temporarily move your user fonts out of their directory:
    • Linux: mv ~/.local/share/fonts ~/.local/share/fonts.bak
    • macOS: Disable non-system fonts using Font Book or temporarily move items from ~/Library/Fonts.
  2. Clear the font cache:
    • On Linux, run fc-cache -r -v.
  3. Try launching FontForge. If it opens successfully, reintroduce fonts in batches to identify the specific file causing the segmentation fault.

Use GDB to Identify the Faulty Library

If the crash continues, generate a stack trace using the GNU Debugger (GDB) to locate the exact library or function causing the failure.

  1. Install GDB if it is not already present on your system.

  2. Launch FontForge inside GDB:

    gdb fontforge
  3. Type run and press Enter.

  4. When the segmentation fault occurs, type bt (backtrace) and press Enter.

Analyze the output lines starting with #0 and #1. Look for common culprits:

  • libfreetype.so: Points to an issue reading a font file or a broken FreeType installation.
  • libcairo.so or libpango.so: Points to rendering issues, often linked to theme or display drivers.
  • libpython.so: Indicates a Python version mismatch between what FontForge was compiled against and your current system Python.

Switch to an Isolated Build (Flatpak or AppImage)

Segmentation faults caused by system-level library mismatches or incomplete package updates can be bypassed entirely by using a containerized build that bundles its own dependencies.

  • Flatpak:

    flatpak install flathub org.fontforge.FontForge
    flatpak run org.fontforge.FontForge
  • AppImage: Download the official AppImage release, make it executable with chmod +x FontForge-*.AppImage, and run it directly.

Containerized packages prevent conflicts with existing local dynamic linkers and offer a fast, reliable alternative to recompiling the software from source.