aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-font/src/lib.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-01 21:32:55 +0300
committerValentin Popov <valentin@popov.link>2026-12-01 21:32:55 +0300
commitb48fb2caccc7a72b85f07e6ab652081af57c7855 (patch)
tree851858e8881e9c0ba1892b1173212092b53ff86c /crates/fparkan-font/src/lib.rs
parent6954eb74b535341bed234091e67f62ed13266c25 (diff)
downloadfparkan-b48fb2caccc7a72b85f07e6ab652081af57c7855.tar.xz
fparkan-b48fb2caccc7a72b85f07e6ab652081af57c7855.zip
feat(ui): render mission hints with the original game font
Resolve the witnessed 800x600 GAME_FONT through the installed resource configuration. Draw CP1251 bytes from the Tfnt atlas using the original variable-width metrics. Checked the original measurement routine and the first Constructor hint in the game window.
Diffstat (limited to 'crates/fparkan-font/src/lib.rs')
-rw-r--r--crates/fparkan-font/src/lib.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/crates/fparkan-font/src/lib.rs b/crates/fparkan-font/src/lib.rs
index 770ebb0d..3fdcb554 100644
--- a/crates/fparkan-font/src/lib.rs
+++ b/crates/fparkan-font/src/lib.rs
@@ -4,31 +4,34 @@
use fparkan_texm::{TexmDocument, TexmError};
use std::sync::Arc;
+mod bitmap;
+pub use bitmap::BitmapFont;
+
const PREFIX_LEN: usize = 0x14;
const GLYPH_TABLE_END: usize = 0x1014;
const GLYPH_COUNT: usize = 256;
-/// Confirmed Tfnt metrics and the preserved opaque word at offset `0x0c`.
+/// Tfnt metrics for text measurement and placement in the atlas.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct TfntHeader {
/// Lower bound used by the native fixed-width drawing path.
pub fixed_width_floor: i32,
/// Vertical extent used by native clipping and drawing.
pub vertical_extent: i32,
- /// Raw bits copied from offset `0x0c`; its semantic name is unknown.
+ /// Raw bits of the vertical UV span shared by all glyphs.
pub word_0c_bits: u32,
/// Per-input-byte spacing used by native text measurement.
pub character_spacing: i32,
}
-/// One 16-byte glyph record; the first three words remain opaque.
+/// One 16-byte glyph record.
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub struct TfntGlyph {
- /// First opaque DWORD.
+ /// Raw bits of the left U coordinate.
pub word0: u32,
- /// Second opaque DWORD.
+ /// Raw bits of the right U coordinate.
pub word1: u32,
- /// Third opaque DWORD.
+ /// Raw bits of the top V coordinate.
pub word2: u32,
/// Signed advance at record offset `0x0c`.
pub advance: i32,