========================================================================== Title: PFN Format Subject: Personal Font-File Format Specification Author: Xavier Perseguers, xavier.perseguers@mcnet.ch Version: V1.3 Platforms: Windows, Mac, Unix, ... ========================================================================== Note: This Font Format is based on the Windows 3.0 FNT Font Format. More information about FNT Font-File can be found in the knowledge base article titled "INF: The Windows 3.00 Developer's Notes" (Q65260). ========================================================================== __________ | HEADER | 81h bytes ŻŻŻŻŻŻŻŻŻŻ __________________________________________________________________________ Offset Field Size Contents ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ 0000h Identifier 2 bytes The characters identifying the font: 'PF' - All platforms -------------------------------------------------------------------------- 0002h Version 1 word Version of the file -------------------------------------------------------------------------- 0004h Copyright 60 bytes Copyright information -------------------------------------------------------------------------- 0040h FaceName 25 bytes An ASCII character string specifying the name of the font face. -------------------------------------------------------------------------- 0059h 8-Offset 1 dword Offset from beginning of file to the beginning of the 8pt bitmap data -------------------------------------------------------------------------- 005Dh 10-Offset 1 dword Offset for 10pt bitmap data -------------------------------------------------------------------------- 0061h 13-Offset 1 dword Offset for 13pt bitmap data -------------------------------------------------------------------------- 0065h 15-Offset 1 dword Offset for 15pt bitmap data -------------------------------------------------------------------------- 0069h 17-Offset 1 dword Offset for 17pt bitmap data -------------------------------------------------------------------------- 006Dh 20-Offset 1 dword Offset for 20pt bitmap data -------------------------------------------------------------------------- 0071h 22-Offset 1 dword Offset for 22pt bitmap data -------------------------------------------------------------------------- 0075h 24-Offset 1 dword Offset for 24pt bitmap data -------------------------------------------------------------------------- 0079h 26-Offset 1 dword Offset for 26pt bitmap data -------------------------------------------------------------------------- 007Dh 28-Offset 1 dword Offset for 28pt bitmap data -------------------------------------------------------------------------- [ 8pt CHUNK] [10pt CHUNK] . . . [26pt CHUNK] [28pt CHUNK] _______________ | END OF FILE | ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ ========================================================================== ______________ | SIZE CHUNK | 7h bytes ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ __________________________________________________________________________ Offset Field Size Contents (relative) ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ 0000h Height 1 word The height of all characters -------------------------------------------------------------------------- 0002h MaxWidth 1 word The maximum pixel width of any character in the font -------------------------------------------------------------------------- 0004h FirstChar 1 byte The first character code defined by this font. Character definitions are stored only for the characters actually present in a font. -------------------------------------------------------------------------- 0005h LastChar 1 byte The last character code defined by this font. Note that all the characters with codes between FirstChar and LastChar must be present in the font character definitions. -------------------------------------------------------------------------- 0006h DefaultChar 1 byte The character to substitute whenever a string contains a character out of the range. The character is given relative to FirstChar so that DefaultChar is he actual value of the character, less FirstChar. DefaultChar should indicate a special character that is not a space. -------------------------------------------------------------------------- [ASCII 20h CHUNK] In this case, FirstChar = 20h ... [ASCII 21h CHUNK] . . . [ASCII FEh CHUNK] [ASCII FFh CHUNK] ... and LastChar = FFh _____________________ | END OF SIZE CHUNK | ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ ========================================================================== _______________ | ASCII CHUNK | ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ __________________________________________________________________________ Offset Field Size Contents (relative) ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ 0000h Width 1 byte The width of the ASCII character -------------------------------------------------------------------------- 0001h Bitmap Data x bytes This field contains all the bitmap data bytes (8px/byte): 0 - Pixel is off 1 - Pixel is on -------------------------------------------------------------------------- ______________________ | END OF ASCII CHUNK | ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ ========================================================================== _______________ | BITMAP DATA | ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ This field contains the character bitmap definitions. Each character is stored as a contiguous set of bytes. The first byte contains the first 8 bits of the first scanline (that is, the top line of the character). The second byte contains the first 8 bits of the second scanline. This continues until a first "column" is completely defined. The following byte contains the next 8 bits of the first scanline, padded with zeros on the right if necessary (and so on, down through the second "column"). If the glyph is quite narrow, each scanline is covered by 1 byte, with bits set to zero as necessary for padding. If the glyph is very wide (or for big font size data definition), a third or even more set of bytes can be present. Note: The character bitmaps must be stored contiguously and arranged in ascending order. The following is a single-character example, in which are given the bytes for a 12 x 14 pixel character, as shown here schematically. ............ .....**..... ....*..*.... ...*....*... ..*......*.. ..*......*.. ..*......*.. ..********.. ..*......*.. ..*......*.. ..*......*.. ............ ............ ............ The bytes are given here in two sets, because the character is less than 17 pixels wide. 00 06 09 10 20 20 20 3F 20 20 20 00 00 00 00 00 00 80 40 40 40 C0 40 40 40 00 00 00 Note that in the second set of bytes, the second digit of each is always zero. It would correspond to the 13th through 16th pixels on the right side of the character, if they were present.