glyphripper v1.0.1
Glyphripper
A command-line tool for subsetting and converting fonts to web-friendly formats (WOFF2, WOFF, TTF) while preserving variable font features.
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
Prerequisites
- 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:
Installation
Install globally using npm:
npm install -g glyphripper
Or using yarn:
yarn global add glyphripper
Or pnpm:
pnpm add -g glyphripper
The installation process will automatically: 1. Create a local Python virtual environment in the package directory 2. Install required Python dependencies (fonttools and brotli) in that environment 3. 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.
Usage
glyphripper <font-file> [-o output-directory]
Example:
glyphripper MyFont-Variable.ttf -o output/fonts
The tool will prompt you to: 1. Select output formats (WOFF2, WOFF, TTF) 2. Choose character sets to include:
- Lowercase letters
- Uppercase letters
- Numbers
- Punctuation
- Currency symbols
- Whitespace
- Math symbols
- Add any custom characters
Output
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
Examples
Basic usage with default settings
glyphripper MyFont.ttf
Specify an output directory
glyphripper MyFont.ttf -o website/fonts
Process a variable font
glyphripper MyFont-Variable.ttf -o dist/assets
How it works
Glyphripper uses: 1. A Python virtual environment to run FontTools (a powerful Python library for font manipulation) 2. Node.js for the CLI interface and user experience 3. Automatic configuration and dependency management for a smooth experience
The tool: 1. Creates a subset of your font with only the characters you need 2. Preserves important OpenType features like ligatures and variable font axes 3. Converts the font to web-optimized formats 4. Generates a preview HTML so you can see the results immediately
Troubleshooting
Common Issues
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
Development
- 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 link
Pre-publishing Checklist
Before publishing to npm, ensure:
The
package.json
has:- Correct version number
- Appropriate author and repository information
- All required files listed in the
files
array
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
License
MIT
Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request