From b48fb2caccc7a72b85f07e6ab652081af57c7855 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Tue, 1 Dec 2026 22:32:55 +0400 Subject: 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. --- crates/fparkan-font/src/lib.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'crates/fparkan-font/src/lib.rs') 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, -- cgit v1.2.3