Registry / serialization / cffsubr

cffsubr

JSON →
library0.4.0pypypi✓ verified 86d ago

A standalone CFF (Compact Font Format) subroutinizer based on the AFDKO tx tool. It converts CFF fonts to their subroutinized form, reducing file size. Version 0.4.0 requires Python >=3.10. Releases are irregular; maintained by Adobe Type Tools.

pip install cffsubr
INSTALL
IMPORT
SIG · CFFSUBR
C
cffsubr
serializationpythonv0.4.0
Install
2.6s avg
Import
116ms
Disk
44MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.6s · import 0.116s · 46MB
44MB installed
● package 44MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

subroutinize
from cffsubr import subroutinize
from cffsubr.cffsubr import subroutinize
cffsubr is a single module; no submodule.

Load a CFF font, subroutinize it, and save.

from cffsubr import subroutinize from fontTools.ttLib import TTFont font = TTFont('input.otf') subroutinize(font) font.save('output.otf')
cffsubr --version
Debug
Known issues
breakingIn cffsubr 0.4.0, the `subroutinize` function must be called on a TTFont object; it no longer accepts raw bytes or file paths.
fix
Use fontTools to load the font first: TTFont('path.otf').
affects: >=0.3.0
gotchaOnly CFF-flavored OpenType fonts (.otf) are supported. TrueType-flavored fonts (.ttf) will not be processed.
fix
Ensure the input font has CFF outlines (check with TTFont.sfVersion == 'OTTO').
affects: all
gotchaThe `subroutinize` function modifies the font object in place; it does not return a new font or any status code.
fix
After calling, the original font object is modified. Save a copy first if needed.
affects: all
Errors
Common errors & fixes
AttributeError: module 'cffsubr' has no attribute 'subroutinize'
Importing from the wrong path or using an old version where the function was named differently.
fix
Use `from cffsubr import subroutinize` and ensure cffsubr >= 0.2.0.
TypeError: subroutinize() missing 1 required positional argument: 'font'
Called without passing a TTFont object.
fix
Pass a loaded TTFont instance: `subroutinize(font)`.
fontTools.ttLib.TTLibError: Unknown font format
Input file is not a valid OpenType font (e.g., .ttf, .woff, or corrupt file).
fix
Verify the font is a CFF-based .otf file.
Upgrade
Version history
0.4.0latest on PyPI · released Dec 5, 2025
Audit
Dependencies
fonttoolsrequiredUsed to load and manipulate font objects.
Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
cffsubr — pip install cffsubr · libregistry