A very simple and concrete parser for *.spf (SimplePixelFont) files for Rust. spf.rs provides
simple encoding and decoding for *.spf binary representation through a Vec<u8>. And also
includes optional features to conveiniently create a texture from a font rendering, which
can then be used in your favorite game engine / graphics framework.
Example
Creates a new SimplePixelFont struct and adds the characters o, w, and 😊.
use *;
We can then encode the struct and use std::fs to write to a file:
let mut file = new
.write
.create
.open
.unwrap;
file.write_all.unwrap;
Or we can load an exsisting .spf file using std::fs aswell:
let mut file = new
.read
.open
.unwrap;
let mut buffer: = vec!;
file.read.unwrap;
let font = from_vec_u8;
Support Format Versions
| Format Version | Stability |
|---|---|
FV0000 (Vanilla) |
✔ |