Cross-platform (Windows/macOS/Linux) engine that plays the original Amiga data straight from the ADF images: - ADF (OFS/FFS), LHA and CrunchMania (CrM!/CrM2) readers - Track decoding: 24 tracks of 1024x512 16-colour planar art, height maps and lap gates on an isometric ground plane - Vehicle decoding: 8 cars, 32 headings x 25 tilt frames of 64x32 AGA sprites - Reconstructed handling, AI, race rules, menus and synthesised sound (disk 1 with the executable, palettes and audio is not in the set) - info/extract/bench/trace/render tools, format notes, CI builds
68 lines
3.2 KiB
Rust
68 lines
3.2 KiB
Rust
//! A small 5x7 bitmap font (original artwork for this project).
|
|
|
|
pub const GLYPH_W: usize = 5;
|
|
pub const ADVANCE: usize = 6;
|
|
|
|
pub fn glyph(c: char) -> [u8; 7] {
|
|
match c.to_ascii_uppercase() {
|
|
'0' => [0x0E, 0x11, 0x13, 0x15, 0x19, 0x11, 0x0E],
|
|
'1' => [0x04, 0x0C, 0x04, 0x04, 0x04, 0x04, 0x0E],
|
|
'2' => [0x0E, 0x11, 0x01, 0x02, 0x04, 0x08, 0x1F],
|
|
'3' => [0x1F, 0x02, 0x04, 0x02, 0x01, 0x11, 0x0E],
|
|
'4' => [0x02, 0x06, 0x0A, 0x12, 0x1F, 0x02, 0x02],
|
|
'5' => [0x1F, 0x10, 0x1E, 0x01, 0x01, 0x11, 0x0E],
|
|
'6' => [0x06, 0x08, 0x10, 0x1E, 0x11, 0x11, 0x0E],
|
|
'7' => [0x1F, 0x01, 0x02, 0x04, 0x08, 0x08, 0x08],
|
|
'8' => [0x0E, 0x11, 0x11, 0x0E, 0x11, 0x11, 0x0E],
|
|
'9' => [0x0E, 0x11, 0x11, 0x0F, 0x01, 0x02, 0x0C],
|
|
'A' => [0x0E, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11],
|
|
'B' => [0x1E, 0x11, 0x11, 0x1E, 0x11, 0x11, 0x1E],
|
|
'C' => [0x0E, 0x11, 0x10, 0x10, 0x10, 0x11, 0x0E],
|
|
'D' => [0x1C, 0x12, 0x11, 0x11, 0x11, 0x12, 0x1C],
|
|
'E' => [0x1F, 0x10, 0x10, 0x1E, 0x10, 0x10, 0x1F],
|
|
'F' => [0x1F, 0x10, 0x10, 0x1E, 0x10, 0x10, 0x10],
|
|
'G' => [0x0E, 0x11, 0x10, 0x17, 0x11, 0x11, 0x0F],
|
|
'H' => [0x11, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11],
|
|
'I' => [0x0E, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0E],
|
|
'J' => [0x07, 0x02, 0x02, 0x02, 0x02, 0x12, 0x0C],
|
|
'K' => [0x11, 0x12, 0x14, 0x18, 0x14, 0x12, 0x11],
|
|
'L' => [0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1F],
|
|
'M' => [0x11, 0x1B, 0x15, 0x15, 0x11, 0x11, 0x11],
|
|
'N' => [0x11, 0x11, 0x19, 0x15, 0x13, 0x11, 0x11],
|
|
'O' => [0x0E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E],
|
|
'P' => [0x1E, 0x11, 0x11, 0x1E, 0x10, 0x10, 0x10],
|
|
'Q' => [0x0E, 0x11, 0x11, 0x11, 0x15, 0x12, 0x0D],
|
|
'R' => [0x1E, 0x11, 0x11, 0x1E, 0x14, 0x12, 0x11],
|
|
'S' => [0x0F, 0x10, 0x10, 0x0E, 0x01, 0x01, 0x1E],
|
|
'T' => [0x1F, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04],
|
|
'U' => [0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E],
|
|
'V' => [0x11, 0x11, 0x11, 0x11, 0x11, 0x0A, 0x04],
|
|
'W' => [0x11, 0x11, 0x11, 0x15, 0x15, 0x15, 0x0A],
|
|
'X' => [0x11, 0x11, 0x0A, 0x04, 0x0A, 0x11, 0x11],
|
|
'Y' => [0x11, 0x11, 0x11, 0x0A, 0x04, 0x04, 0x04],
|
|
'Z' => [0x1F, 0x01, 0x02, 0x04, 0x08, 0x10, 0x1F],
|
|
'.' => [0, 0, 0, 0, 0, 0x0C, 0x0C],
|
|
',' => [0, 0, 0, 0, 0x0C, 0x04, 0x08],
|
|
':' => [0, 0x0C, 0x0C, 0, 0x0C, 0x0C, 0],
|
|
'-' => [0, 0, 0, 0x1F, 0, 0, 0],
|
|
'+' => [0, 0x04, 0x04, 0x1F, 0x04, 0x04, 0],
|
|
'/' => [0x01, 0x01, 0x02, 0x04, 0x08, 0x10, 0x10],
|
|
'!' => [0x04, 0x04, 0x04, 0x04, 0x04, 0, 0x04],
|
|
'?' => [0x0E, 0x11, 0x01, 0x02, 0x04, 0, 0x04],
|
|
'<' => [0x02, 0x04, 0x08, 0x10, 0x08, 0x04, 0x02],
|
|
'>' => [0x08, 0x04, 0x02, 0x01, 0x02, 0x04, 0x08],
|
|
'(' => [0x02, 0x04, 0x08, 0x08, 0x08, 0x04, 0x02],
|
|
')' => [0x08, 0x04, 0x02, 0x02, 0x02, 0x04, 0x08],
|
|
'\'' => [0x04, 0x04, 0x08, 0, 0, 0, 0],
|
|
'"' => [0x0A, 0x0A, 0, 0, 0, 0, 0],
|
|
'#' => [0x0A, 0x0A, 0x1F, 0x0A, 0x1F, 0x0A, 0x0A],
|
|
'=' => [0, 0, 0x1F, 0, 0x1F, 0, 0],
|
|
'_' => [0, 0, 0, 0, 0, 0, 0x1F],
|
|
_ => [0; 7],
|
|
}
|
|
}
|
|
|
|
pub fn text_width(s: &str, scale: usize) -> usize {
|
|
s.chars().count() * ADVANCE * scale
|
|
}
|