Dependencies for Compiling FontForge from Source
Compiling FontForge from source code allows you to access the latest development features and tailor the font editor to your specific system, but it requires a comprehensive set of build utilities, core graphics libraries, and interface toolkits. This guide breaks down the mandatory build utilities, core and optional runtime dependencies, and the terminal commands required to install them across popular operating systems before running CMake.
Essential Build Tools
To compile the C and C++ source files and configure the build environment, your system must have the following fundamental development packages:
- CMake (version 3.14.0 or newer): Used as the primary build system generator.
- C and C++ Compilers: GCC or Clang with full C11 and C++11 support.
- Ninja or GNU Make: The underlying build tools invoked by CMake to perform the compilation.
- pkg-config: Required by CMake to discover library paths and compiler flags automatically.
- Git: Required to clone the repository and submodules.
Core Graphic and Font Libraries
FontForge interacts with numerous raster, vector, and image formats. These libraries are mandatory for the application to parse and export fonts:
- FreeType (libfreetype6-dev): Critical for font rendering and rasterization.
- HarfBuzz (libharfbuzz-dev): Used for OpenType text shaping and complex text layout rendering.
- Fontconfig (libfontconfig1-dev): For discovering and configuring system fonts.
- Image Libraries:
libpngandzlib(standard image and compression support)libjpeg(for importing JPEG background images)libtiff(for TIFF image parsing)giflib(for GIF support)
- libxml2: Used to parse XML-based font structures like SVG and UFO fonts.
Graphical User Interface (GUI) Dependencies
If you plan to use the visual interface rather than running FontForge strictly as a command-line script engine, you need the GTK3 or X11 toolkits along with drawing libraries:
- GTK+ 3 (libgtk-3-dev): The standard modern graphical toolkit for the FontForge UI.
- Cairo (libcairo2-dev): The 2D graphics library used for drawing the editor canvases.
- Pango (libpango1.0-dev): Handles layout and rendering of international text inside the UI.
Scripting and Advanced Features
FontForge features deep integration with scripting languages and specialized font math engines:
- Python 3 Development Headers
(
python3-dev): Necessary for building the internal Python interpreter interface and Python extension modules. - libspiro (optional but recommended): Enables smooth Spiro spline editing curves.
- libuninameslist (optional but recommended): Provides Unicode character names and annotations in the font view window.
- WOFF2 (
libwoff-devor source): Required if you intend to compress and export fonts for web use in the WOFF 2.0 format. - libreadline: Provides command-line auto-completion and history support in the interactive shell.
Installation Commands by Operating System
Debian / Ubuntu
Run the following command to install all necessary compilers, libraries, and GUI packages:
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
ninja-build \
pkg-config \
git \
python3-dev \
libfreetype6-dev \
libharfbuzz-dev \
libfontconfig1-dev \
libxml2-dev \
libpng-dev \
libjpeg-dev \
libtiff-dev \
libgif-dev \
libcairo2-dev \
libpango1.0-dev \
libgtk-3-dev \
libspiro-dev \
libuninameslist-dev \
libwoff-dev \
libreadline-devFedora / RHEL
Run the following package command:
sudo dnf install -y \
gcc \
gcc-c++ \
cmake \
ninja-build \
pkgconf-pkg-config \
git \
python3-devel \
freetype-devel \
harfbuzz-devel \
fontconfig-devel \
libxml2-devel \
libpng-devel \
libjpeg-turbo-devel \
libtiff-devel \
giflib-devel \
cairo-devel \
pango-devel \
gtk3-devel \
libspiro-devel \
libuninameslist-devel \
woff2-devel \
readline-develmacOS (via Homebrew)
For macOS environments, retrieve the necessary toolchains and libraries using Homebrew:
brew install \
cmake \
ninja \
pkg-config \
python \
freetype \
harfbuzz \
fontconfig \
libxml2 \
libpng \
jpeg \
libtiff \
giflib \
cairo \
pango \
gtk+3 \
libspiro \
libuninameslist \
woff2 \
readline