BGI Stroked Fonts
A pure Rust library providing Borland Graphics Interface (BGI) stroked font data. This library includes various font styles like bold, gothic, sans-serif, and script fonts for legacy graphics applications and retro computing projects.
Features
- Pure Rust: No external dependencies (except optional regex for conversion utilities)
- Multiple Font Styles: Bold, Euro, Gothic, Sans-serif, Script, and more
- Feature Flags: Enable only the fonts you need to reduce binary size
- No Unsafe Code: Memory-safe implementation
- Legacy Compatible: Based on SDL_bgi font data
Available Fonts
The library includes the following font styles:
- Bold (
bold) - Bold stroked font - Euro (
euro) - European character set - Gothic (
goth) - Gothic style font - Small Complex (
lcom) - Small complex font - Small (
litt) - Small/little font - Sans-serif (
sans) - Clean sans-serif font - Script (
scri) - Script/cursive font - Simple (
simp) - Simple stroked font - Triplex (
trip) - Triplex font style - Triplex Script (
tscr) - Triplex script font
Font Samples
Here are some examples of the available fonts:
Gothic Font

Small Font

Simple Font

Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Feature Flags
By default, all fonts are included. You can reduce binary size by enabling only the fonts you need:
[]
= { = "0.1.0", = false, = ["goth", "sans"] }
Available features:
bold- Bold fonteuro- Euro fontgoth- Gothic fontlcom- Small complex fontlitt- Small fontsans- Sans-serif fontscri- Script fontsimp- Simple fonttrip- Triplex fonttscr- Triplex script font
Usage
use goth;
Font Data Format
Each font provides three arrays:
- Font data (
FONT): Array of stroke data for each character (0-255) - Widths (
FONT_WIDTH): Character width information - Sizes (
FONT_SIZE): Size information for each character
The stroke data uses a simple line-drawing format where each stroke is represented by 4 bytes: [x0, y0, x1, y1] representing a line from point (x0, y0) to point (x1, y1).
Examples
Check out the examples/ directory for usage examples:
This will generate PGM image files demonstrating all available fonts.
Building
# Build the library
# Build with specific features only
# Run tests
# Generate documentation
License
This project is licensed under the ZLIB License - see the LICENSE file for details.
Attribution
Based on font data from SDL_bgi by Guido Gonzato, PhD.
Original BGI fonts were part of the Borland Graphics Interface, used in classic DOS graphics programming.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.