| Crates.io | bgi-stroked-fonts |
| lib.rs | bgi-stroked-fonts |
| version | 0.1.0 |
| created_at | 2025-10-01 10:40:58.599606+00 |
| updated_at | 2025-10-01 10:40:58.599606+00 |
| description | Borland Graphics Interface (BGI) stroked font data in pure Rust. Includes various font styles like bold, gothic, sans-serif, and script fonts for legacy graphics applications |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1862348 |
| size | 3,148,942 |
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.
The library includes the following font styles:
bold) - Bold stroked fonteuro) - European character setgoth) - Gothic style fontlcom) - Small complex fontlitt) - Small/little fontsans) - Clean sans-serif fontscri) - Script/cursive fontsimp) - Simple stroked fonttrip) - Triplex font styletscr) - Triplex script fontHere are some examples of the available fonts:



Add this to your Cargo.toml:
[dependencies]
bgi-stroked-fonts = "0.1.0"
By default, all fonts are included. You can reduce binary size by enabling only the fonts you need:
[dependencies]
bgi-stroked-fonts = { version = "0.1.0", default-features = false, features = ["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 fontuse bgi_stroked_fonts::goth;
fn main() {
// Access font data
let font_data = &goth::GOTH; // Font stroke data
let font_widths = &goth::GOTH_WIDTH; // Character widths
let font_sizes = &goth::GOTH_SIZE; // Character sizes
// Each character is represented as stroke data
// font_data[char_index] contains the stroke commands for that character
// Example: Get data for character 'A' (ASCII 65)
let char_a_strokes = font_data[65];
println!("Character 'A' has {} stroke bytes", char_a_strokes.len());
}
Each font provides three arrays:
FONT): Array of stroke data for each character (0-255)FONT_WIDTH): Character width informationFONT_SIZE): Size information for each characterThe 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).
Check out the examples/ directory for usage examples:
cargo run --example showcase
This will generate PGM image files demonstrating all available fonts.
# Build the library
cargo build
# Build with specific features only
cargo build --no-default-features --features "goth,sans"
# Run tests
cargo test
# Generate documentation
cargo doc --open
This project is licensed under the ZLIB License - see the LICENSE file for details.
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.
Contributions are welcome! Please feel free to submit a Pull Request.