
fontmake
CLIGoogle Fonts 官方的字体编译工具:把 Glyphs、UFO、designspace 源文件编译成 OTF、TTF 或可变字体,加 -i 参数可按源文件里的导出设置插值出各个字重,字体设计师可以让 agent 自动出包。需 Python 3.10+,并准备好字体源文件。
fontmake
fontmake compiles fonts from various sources (.glyphs, .ufo, designspace) into binaries (.otf, .ttf). You can use it to create static instances and variable fonts.
Installation
Fontmake requires Python 3.10 or later.
Releases are available on PyPI and can be installed with pip.
pip3 install fontmake
Use the -U, --upgrade option to update fontmake and its dependencies
to the newest available release:
pip3 install -U fontmake
Basic Usage
After installation, you will be able to use the fontmake executable.
For example, to compile a variable font from a Glyphs source file, use:
fontmake MyFont.glyphs -o variable
The most important command line arguments to the fontmake executable are the required input, specified either as positional argument or using one of -g/-u/-m flags, and the optional -o flag, which chooses the output file format.
Source file format options
There are two ways to specify the source file or files:
One can either use the following, mutually exclusive, flags:
-g filename.glyphs: Converts a Glyphs source file to binary.-u filename.ufo ...: Converts one or more UFO(Z) files to binary.-m filename.designspace: Converts a Designspace file to binary. (The-mis formutatormath, an old Python library for handling designspaces.)
Alternatively, one can specify the input(s) as positional arguments without the flag, letting fontmake infer the source format from the file extension: e.g. fontmake MyFont.designspace, etc.
Note: if the positional arguments are preceded by an option that takes one or more arguments, you need to use the special -- separator to mark all following
arguments as positional (non-options), otherwise the parser gets confused. E.g., the -i option takes zero or one arguments (see futher below for details); without --, argparse thinks you didn't provide any inputs:
fontmake -i -- MyFont.designspace
Exactly one type of input can/must be specified, using either approaches.
Output file format options
You may provide one or more output file formats after the -o option. For example, -o otf ttf creates OTF and TTF binary font files for each master in your input file.
The following output file formats are available:
otf: Per-master OTF (CFF-outline) binaries. Placed in themaster_otf/directory.ttf: Per-master TTF (TrueType-outline) binaries. Placed in themaster_ttf/directory.otf-cff2: Per-master OTF binaries with CFF2 outlines. Placed in themaster_otf/directory.variable: A TrueType variable font. Placed in thevariable_ttf/directory.variable-cff2: A variable font with CFF2 outlines. Placed in thevariable_otf/directory.
The following output file formats are also available, but are generally used internally by fontmake as an intermediate step to one of the above outputs:
otf-interpolatable: OTF binaries suitable for merging into a variable font. Placed in themaster_otf_interpolatable/directory. (These differ fromotfin that the outlines are unoptimized.)ttf-interpolatable: TTF binaries suitable for merging into a variable font. Placed in themaster_ttf_interpolatable/directory. (The outlines are converted to quadratic curves in an interpolation-compatible way.)ufo: Glyphs sources can be converted to UFO, or to UFO zip (.ufoz) format with the flag--save-ufo-as-zip. Placed in themaster_ufo/directory.
If no format option is specified, the default is -o otf ttf.
Other important command line options
-
-i(Interpolate instances): Having per-master binaries is not always what you expect; if you have defined instances ("exports") in your Glyphs file, they will not be generated by default. To generate them, pass the-iflag, which interpolates static instances, and places them in theinstance_ttf/orinstance_otf/directory as appropriate. -
--output-dir <some_directory>: Places all output in the given directory, instead of the per-format directories mentioned above. -
--output-path <filename>: This is only valid if the output is a single binary file, and writes the output to the given filename. -
-f(Flatten components): Ensures that any glyphs which contain components which themselves contain components are decomposed to a single level. This is recommended as certain rendering environments do not correctly handle nested components - see this link for more details.
Advanced Usage
See USAGE.md.
Troubleshooting
See TROUBLESHOOTING.md.
Developers
Developers can get the latest version of fontmake by cloning the git repository:
git clone https://github.com/googlefonts/fontmake
cd fontmake
pip install .
Developers who want to quickly test changes to the source code without re-installing can use the "--editable" option when installing from a local source checkout:
pip install -e .
It is recommended to install fontmake inside a virtual environment to prevent conflicts between its dependencies and other modules installed globally.
You could also use the pipx tool to automate the installation/upgrade of python apps like fontmake in isolated environments.
Releasing a New Version
- Commit and push your final changes for the new version.
- Create an annotated Git tag of the version number, with a prepended "v", like so:
git tag -a v3.1.1 - Write the release notes into the tag message. They will show up as release notes on the release page in GitHub.
- Push the tag like so:
git push origin v3.1.1, whereoriginis the name of the usual remote you want to push the version to.
相关资源

FontForge
CLI开源字体编辑器:命令行下用 fontforge -script 运行 Python 脚本,不开窗口就能批量修改字形、在 OTF/TTF/UFO 等格式间转换并生成字体,适合字体设计与字库加工。Homebrew 安装的是命令行版,需要图形界面可另装桌面版。
fontforge/fontforge8.1k
VTracer
CLI把 JPG、PNG 等位图转成 SVG 矢量图的命令行工具,支持彩色描摹、黑白线稿和光照不均的扫描件,适合把 logo、插画和扫描的旧图纸矢量化。命令行版目前是 1.0 预览版,用 cargo 安装,需要 Rust 环境;也提供桌面版。
visioncortex/vtracer7.5k
resvg
CLI高保真 SVG 渲染库与命令行工具,可把 SVG 图标、插画按指定尺寸导出为 PNG,适合批量切图;不依赖系统库,各平台渲染结果逐像素一致。不支持 SVG 动画,安装需要 Rust 环境(cargo),也可从 Releases 下载 macOS 预编译版。
linebender/resvg4.2k
DESIGN.md
CLIGoogle Labs 推出的 DESIGN.md 格式与命令行:设计师把配色、字体、间距等视觉规范写成文件交给 agent,lint 检查引用错误与 WCAG 对比度,diff 对比版本,export 导出 Tailwind 等设计令牌。需要 Node.js,格式仍为 alpha。
google-labs-code/design.md28.8k
Rembg
CLI一条命令去除图片背景:支持单张、整个文件夹批处理和监听目录,可只输出蒙版、切换 U2Net、SAM 等模型,也能启动 HTTP 服务或配合 FFmpeg 处理视频帧。默认模型在本地推理。
danielgatis/rembg25.4k
ImageMagick
CLI老牌图像处理命令行套件,支持 JPEG、PNG、GIF、TIFF、PDF 等众多格式的转换、缩放、裁剪、合成与批量处理,适合 agent 在脚本里处理图片。
ImageMagick/ImageMagick17.8k