A cross-platform (Windows, macOS, Linux) tool for generating bitmap font atlases. Project created out of personal necessity to generate bitmap fonts for use with the Starling Framework and FeathersUI. It exports industry-standard .fnt (XML, Binary, Text) and .png files compatible with these engines and others that support the BMFont format.
- Cross-Platform: Runs on Windows, macOS, and Linux.
- High Quality: Uses FreeType with configurable hinting (Smooth, Sharp, Crisp) and Super Sampling Anti-Aliasing (SSAA 2x and 4x).
- Custom Glyphs: Select predefined unicode ranges or custom glyph sets and manage presets for easy reuse.
- Adjust Characters: Adjust character metrics (xAdvance, xOffset, yOffset) for fine-tuning.
- Advanced Effects:
- Stroke/Outline (Gradient support)
- Drop Shadow (Blur support)
- Inner Glow
- Bevel/Emboss
- Gradient Fills
- Pattern Fill (JPG, PNG and Photoshop .PAT files)
- Real-Time Preview: Visualize your atlas and text rendering instantly.
- Replace Glyphs: Replace specific glyphs with custom images, you can even apply effects to them.
- Atlas Generation: Generate bitmap font atlases with configurable padding and multi-page support.
- Export: Generates industry-standard
.fnt(XML, Binary, Text) and.pngatlases compatible with popular game engines (AngelCode BMFont format). - Style Persistence: Save and load your favorite font styles.
- Visual Studio 2022 (or newer) with C++ Desktop Development workload.
- CMake (3.20+ recommended).
- Git (Required to fetch dependencies).
- Xcode Command Line Tools (
xcode-select --install). - CMake (
brew install cmake). - Ninja (optional, recommended:
brew install ninja). - Git (Usually included in Xcode tools, check with
git --version). - Libraries:
glfw,freetype(Install via Homebrew:brew install glfw freetype).
- GCC/G++ and build tools.
- CMake.
- Libraries:
libglfw3-dev,libfreetype6-dev,libgtk-3-dev.
- Open the project folder in Visual Studio or use the provided script.
- Run
build_windows.batin the root directory.- This script will configure CMake, build the project in Release mode, and place the executable in
build/Release.
- This script will configure CMake, build the project in Release mode, and place the executable in
- The executable will be available at
build\Release\FntGenerator.exe.
- Ensure dependencies are installed:
brew install cmake glfw freetype
- Run the build script:
chmod +x build_macos.sh ./build_macos.sh
- This creates a
.appbundle atbuild/FntGenerator.app. You can run it directly or move it to Applications.
- Install dependencies:
sudo apt-get update sudo apt-get install cmake g++ libglfw3-dev libfreetype6-dev libgtk-3-dev
- Run the build script:
chmod +x build_linux.sh ./build_linux.sh
- Run the executable:
./build/FntGenerator
- Load Font: Select a font installed on your system.
- Adjust Size: Set the font size and padding.
- Select Glyphs: Choose the glyphs you want to include in the atlas.
- Apply Effects: Enable Stroke, Shadow, etc., and tweak parameters in real-time.
- Hinting: Choose "Smooth (No Hinting)" for best results in games/textures.
- Export: Click "Export", choose a destination folder, and the tool will generate the
.fntand.pngfiles.
src/: Source code.main.cpp: Application entry point and UI logic (ImGui).Atlas/: Texture generation logic (TextureGenerator).Font/: FreeType wrapper (FontManager).Utils/: Helpers for platform dialogs, bitmap operations (BitmapUtils), and exporting (Exporter).
build_*.sh/bat: Platform-specific build scripts.CMakeLists.txt: CMake build configuration.
This project relies on these amazing open-source libraries:
- BMFont: Industry-standard font format file for bitmap fonts.
- FreeType: Robust font rendering engine.
- Dear ImGui: Bloat-free Immediate Mode GUI for C++.
- ImGui Gradient: Gradient editor for Dear ImGui.
- GLFW: Open Source, multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input.
- nlohmann/json: JSON for Modern C++.
- stb_image_write: Single-file public domain image writer.
Note: AI was utilized in the development of this project.
