Skip to content

πŸ’‘ A simple and efficient Python-based tool for compressing TrueType (TTF) and OpenType (OTF) fonts.

License

Notifications You must be signed in to change notification settings

ixDarkLorD/ImFontCompressor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎨 ImFont Compressor

GitHub release License

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.

Application Screenshot


✨ Features

πŸ”§ Core Functionality

  • Multiple encoding formats:
    • Unsigned 8-bit (-u8)
    • Unsigned 32-bit (-u32)
    • Base85 (-base85)
  • Toggle raw compression
  • Output as static or non-static C data

πŸš€ Workflow

  • Drag-and-drop file loading
  • One-click export to .h header files
  • Clipboard support for quick copying
  • Themeable interface (light/dark modes)

πŸ› οΈ Technical

  • Cross-platform Python (3.13+) backend
  • Tkinter-based GUI
  • Pre-built binaries available

πŸ“¦ Installation

Download ready-to-use executables from our Releases page.

πŸ–₯️ Usage Guide

  1. Launch the application

  2. Load font file (You can Drag & Drop files)

  3. Configure:

    • Encoding method
    • Compression toggle
    • Output type (static/non-static)
    • Export to .h/.cpp
  4. Generate:

    • Copy to clipboard
    • Save to disk

βš™οΈ Development

Python Windows VSCode

πŸ“‹ Prerequisites

πŸš€ Quick Start

1️⃣ Clone & Open

git clone https://github.com/ixDarkLorD/ImFontCompressor.git
cd ImFontCompressor
code ImFontCompressor

2️⃣ Initialize Environment

Using VSCode Tasks:

  • Ctrl+Shift+P β†’ Type Run Task β†’ βš™οΈ Setup

Using Terminal:

python setup.py --install

3️⃣ Start Developing

Once setup is complete:

  • F5 to launch debugger
  • Ctrl+Shift+B to build

πŸ—³οΈ Tasks

πŸ“‹ Click to view development tasks
Task Description How to Run
Setup Initial environment configuration Terminal: python setup.py --install
VSCode: Run Task β†’ Setup
Build Create standalone executable Terminal: python utils/build_exe.py
VSCode: Ctrl+Shift+B or Run Task β†’ Build
Release Upload latest build to GitHub Releases Terminal: python utils/upload_release.py
VSCode: Run Task β†’ Release
Build & Release Runs the full pipeline: builds the application and uploads it Terminal: python utils/upload_release.py
VSCode: Run Task β†’ Release
Compile Compressor Compile 'binary_to_compressed_c.cpp' into a standalone compressor executable Terminal: g++ data/binary_to_compressed_c.cpp
VSCode: 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.cpp
VSCode: 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
  1. Use Force Setup task or setup.py --force to completely rebuild virtual environment
  2. Install these VSCode extensions for better experience:
  3. Set GITHUB_TOKEN environment variable for release tasks
  4. Check .vscode/tasks.json for advanced task configurations

🀝 Contributing

  • We welcome contributions! Please see our Contribution Guidelines for details.

πŸ“œ License

  • This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Inspired by the original Dear ImGui font compressor
  • Python/Tkinter community for GUI components

About

πŸ’‘ A simple and efficient Python-based tool for compressing TrueType (TTF) and OpenType (OTF) fonts.

Resources

License

Stars

Watchers

Forks