A command-line tool for subsetting and converting fonts to web-friendly formats (WOFF2, WOFF, TTF) while preserving variable font features.
- Subset fonts to include only the characters you need
- Convert to web-friendly formats (WOFF2, WOFF, TTF)
- Preserve variable font features (weight, width, slant, etc.)
- Generate preview HTML with various weights and sizes
- Interactive character set selection
- Custom character support
- Automatic dependency management
- Node.js (v16 or higher)
- Python 3 with venv support
- macOS:
brew install python3 - Windows: Install from Microsoft Store or python.org
- Linux:
sudo apt install python3 python3-venv
- macOS:
Install globally using npm:
npm install -g glyphripperOr using yarn:
yarn global add glyphripperOr pnpm:
pnpm add -g glyphripperThe installation process will automatically:
- Create a local Python virtual environment in the package directory
- Install required Python dependencies (fonttools and brotli) in that environment
- Set up everything needed to run the tool without additional configuration
No manual Python package installation is needed! The tool handles all Python dependencies internally.
glyphripper <font-file> [-o output-directory]Example:
glyphripper MyFont-Variable.ttf -o output/fontsThe tool will prompt you to:
- Select output formats (WOFF2, WOFF, TTF)
- Choose character sets to include:
- Lowercase letters
- Uppercase letters
- Numbers
- Punctuation
- Currency symbols
- Whitespace
- Math symbols
- Add any custom characters
The tool will generate:
- Subsetted font files in your chosen formats
- A preview HTML file showing:
- Selected character sets
- Custom characters
- Sample text
- Size variations
- Weight variations (for variable fonts)
Files will be output to:
output/fonts/(default) or your specified output directory- Preview at
output/fonts/preview.html
glyphripper MyFont.ttfglyphripper MyFont.ttf -o website/fontsglyphripper MyFont-Variable.ttf -o dist/assetsGlyphripper uses:
- A Python virtual environment to run FontTools (a powerful Python library for font manipulation)
- Node.js for the CLI interface and user experience
- Automatic configuration and dependency management for a smooth experience
The tool:
- Creates a subset of your font with only the characters you need
- Preserves important OpenType features like ligatures and variable font axes
- Converts the font to web-optimized formats
- Generates a preview HTML so you can see the results immediately
-
Python not found
- Ensure Python 3 is installed and available in your PATH
- On Windows, install Python from the Microsoft Store or python.org
- On macOS:
brew install python3 - On Linux:
sudo apt install python3 python3-venv
-
Permission errors during installation
- Try running with sudo:
sudo npm install -g glyphripper - Or fix npm permissions: npm docs
- Try running with sudo:
-
Font loading errors in preview
- Check browser console for network errors
- Ensure the font files were generated successfully
- Verify the font paths in the preview HTML
-
Python dependency installation fails
- Manual fix:
cd <npm-global>/lib/node_modules/glyphripper && node scripts/check-dependencies.js - Check your Python installation:
python3 --version(should be 3.6+) - Ensure you have venv module:
python3 -m venv --help
- Manual fix:
-
Command not found after installation
- Make sure your npm global bin directory is in your PATH
- Try installing with
npm install -g glyphripper --unsafe-perm
- Clone the repository:
git clone https://github.com/yourusername/glyphripper.git
cd glyphripper- Install dependencies:
pnpm install- Build the project:
pnpm run build- Link for local development:
npm linkBefore publishing to npm, ensure:
-
The
package.jsonhas:- Correct version number
- Appropriate author and repository information
- All required files listed in the
filesarray
-
Test the package locally:
npm pack npm install -g glyphripper-1.0.0.tgz
-
Verify installation works on a clean system
-
Publish:
npm login npm publish
MIT
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request