{"id":21031,"library":"cffsubr","title":"cffsubr","description":"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.","status":"active","version":"0.4.0","language":"python","source_language":"en","source_url":"https://github.com/adobe-type-tools/cffsubr","tags":["font","CFF","subroutinization","OpenType","Adobe"],"install":[{"cmd":"pip install cffsubr","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Used to load and manipulate font objects.","package":"fonttools","optional":false}],"imports":[{"note":"cffsubr is a single module; no submodule.","wrong":"from cffsubr.cffsubr import subroutinize","symbol":"subroutinize","correct":"from cffsubr import subroutinize"}],"quickstart":{"code":"from cffsubr import subroutinize\nfrom fontTools.ttLib import TTFont\n\nfont = TTFont('input.otf')\nsubroutinize(font)\nfont.save('output.otf')","lang":"python","description":"Load a CFF font, subroutinize it, and save."},"warnings":[{"fix":"Use fontTools to load the font first: TTFont('path.otf').","message":"In cffsubr 0.4.0, the `subroutinize` function must be called on a TTFont object; it no longer accepts raw bytes or file paths.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Ensure the input font has CFF outlines (check with TTFont.sfVersion == 'OTTO').","message":"Only CFF-flavored OpenType fonts (.otf) are supported. TrueType-flavored fonts (.ttf) will not be processed.","severity":"gotcha","affected_versions":"all"},{"fix":"After calling, the original font object is modified. Save a copy first if needed.","message":"The `subroutinize` function modifies the font object in place; it does not return a new font or any status code.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `from cffsubr import subroutinize` and ensure cffsubr >= 0.2.0.","cause":"Importing from the wrong path or using an old version where the function was named differently.","error":"AttributeError: module 'cffsubr' has no attribute 'subroutinize'"},{"fix":"Pass a loaded TTFont instance: `subroutinize(font)`.","cause":"Called without passing a TTFont object.","error":"TypeError: subroutinize() missing 1 required positional argument: 'font'"},{"fix":"Verify the font is a CFF-based .otf file.","cause":"Input file is not a valid OpenType font (e.g., .ttf, .woff, or corrupt file).","error":"fontTools.ttLib.TTLibError: Unknown font format"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}