ImFont Compressor is a Python-powered tool for optimizing TrueType (.ttf) and OpenType (.otf) fonts. Generate lightweight font data perfect for embedding in C/C++ applications with multiple encoding options.
- Multiple encoding formats:
Unsigned 8-bit(-u8)Unsigned 32-bit(-u32)Base85(-base85)
- Toggle raw compression
- Output as
staticornon-staticC data
- Drag-and-drop file loading
- One-click export to
.hheader files - Clipboard support for quick copying
- Themeable interface (light/dark modes)
- Cross-platform Python (3.13+) backend
- Tkinter-based GUI
- Pre-built binaries available
Download ready-to-use executables from our Releases page.
-
Launch the application
-
Load font file (You can Drag & Drop files)
-
Configure:
- Encoding method
- Compression toggle
- Output type (static/non-static)
- Export to
.h/.cpp
-
Generate:
- Copy to clipboard
- Save to disk
-
Essential
- Python 3.13+
- VSCode (with Python extension)
-
Optional
- C++ Build Tools
- Git (for version control)
git clone https://github.com/ixDarkLorD/ImFontCompressor.git
cd ImFontCompressor
code ImFontCompressorUsing VSCode Tasks:
- Ctrl+Shift+P β
Type Run TaskββοΈ Setup
Using Terminal:
python setup.py --installOnce setup is complete:
- F5 to launch debugger
- Ctrl+Shift+B to build
π Click to view development tasks
| Task | Description | How to Run |
|---|---|---|
| Setup | Initial environment configuration | Terminal: python setup.py --installVSCode: Run Task β Setup |
| Build | Create standalone executable | Terminal: python utils/build_exe.pyVSCode: Ctrl+Shift+B or Run Task β Build |
| Release | Upload latest build to GitHub Releases | Terminal: python utils/upload_release.pyVSCode: Run Task β Release |
| Build & Release | Runs the full pipeline: builds the application and uploads it | Terminal: python utils/upload_release.pyVSCode: Run Task β Release |
| Compile Compressor | Compile 'binary_to_compressed_c.cpp' into a standalone compressor executable | Terminal: g++ data/binary_to_compressed_c.cppVSCode: Run Task β Build Compressor |
| Force Setup | Performs a full environment reset and reinstall. Use this if you encounter setup issues or need a clean slate. | Terminal: g++ data/binary_to_compressed_c.cppVSCode: Run Task β Build Compressor |
π Keyboard Shortcuts
- F5: Start debugging
- Ctrl+Shift+B: Build executable
- Ctrl+Shift+T: Build and Upload executable
- Ctrl+Shift+P β "Run Task": Access all tasks
π‘ Pro Tips
- We welcome contributions! Please see our Contribution Guidelines for details.
- This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by the original Dear ImGui font compressor
- Python/Tkinter community for GUI components
