Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Windows FNT

From ReverseEngineering.wiki
Format
Versions FNT 2.0 (0x200, 118-byte header), 3.0 (0x300, 148-byte header)
Magic MZ then NE ('NE' = 0x454E) for .FON; FNT header version 00 02 or 00 03
Extensions .fon, .fnt
Endianness little
On this wiki Facts · Code · Notes · Topics

The Windows bitmap/vector font resource (RT_FONT, version 0x200 or 0x300) and its .FON container: a Win16 NE (or PE) executable whose resource table holds FONTDIR (type 0x8007) and FONT (type 0x8008) resources; .FNT is the bare font resource. Used by old Windows games and tools.

Overview

A .FON file is a normal Format:NE (New Executable) (or, for 32-bit, PE) module with no code whose resources are the fonts: one RT_FONTDIR (0x8007) directory resource and one RT_FONT (0x8008) resource per face, each a Windows FNT. A bare .FNT file is one such resource. The layouts below are read from FreeType's src/winfonts/winfnt.c (commit a5877f48fff8), which opens both. Outline (vector) fonts have file_type bit 0 set and FreeType refuses them.

Finding the faces in a .FON

  1. MZ header: lfanew (offset of the NE header) is read from the 64-byte MZ header.
  2. NE header: magic 0x454E ('NE'); resource_tab_offset and rname_tab_offset are relative to the NE header.
  3. The resource table starts with a u16 alignment shift (FreeType rejects a shift above 16), then type blocks: u16 type id (0 ends the table; ids with the top bit set are integer types), u16 count, 4 reserved bytes, then count 12-byte entries.
  4. Type 0x8008 is RT_FONT. Each 12-byte entry: u16 offset and u16 length (both shifted left by the alignment shift), then 8 more bytes (flags, resource id, and handle and usage fields in the NE layout; Unverified: names from the NE specification, not from winfnt.c).
  5. PE .FON files are handled through the PE resource directory; the same FNT data results.

See Fact:Windows FNT/behavior/Locating FNT resources in an NE .FON and Fact:Windows FNT/struct/FNT header.

Glyph data

The header gives first_char..last_char; the character table that follows the header has one entry per character plus a sentinel: 4 bytes in 2.0 (u16 width, u16 offset) and 6 bytes in 3.0 (u16 width, u32 offset). Each glyph is pixel_height rows and ceil(width/8) bytes per row, 1 bit per pixel. Unverified: the bytes are stored column by column (all rows of the first byte-column, then the next) rather than row by row as in Format:PSF console font; FreeType's loader copies them through a per-column loop.

Code & repositories

  • https://github.com/freetype/freetype @ a5877f48fff8dd6cf8d53c505ce055499376aee2 · license: FTL OR GPL-2.0-or-later (declared by the contributor; GitHub's detector did not recognize LICENSE.TXT)
    FreeType: src/winfonts/winfnt.c reads Windows FNT resources from bare .FNT files and from NE and PE .FON modules.
    Tested on: source read, not run · checked 2026-10-18; last activity 2026-10-17

Pitfalls

  • Code page/charset (header byte charset) decides how bytes map to characters (for example OEM or Mac); FreeType special-cases the Mac id.
  • Unverified: a Windows .FON can also contain a FONTDIR resource duplicating the header fields of every face; FreeType does not read it.