User:Lucas Brooks/Researches/Windows 1.x Font Format

Introduction
The standard FONTS.FON file provided with Windows includes fonts for both 2:1 and 1:1 aspect ratio displays and only the fonts whose aspect ratio matches the display are actually used. There are three sizes of fonts provided in the ANSI character set: 6, 8, and 11 pixels high for 2:1 displays and 12, 16, and 22 pixels high for 1:1 displays. There is only one 1:1 and one 2:1 OEM-dependent font. There are both Terminal and Document faces in each size.

Windows is capable of synthesizing attributes, such as bold, italic, and underlined, so such fonts are not in FONTS.FON. The fonts that do not correspond to the user's display aspect ratio are nevertheless generic raster fonts that can be used for output devices such as bitmap printers.

Font File Formats
Formats for font files are defined for both raster and vector fonts. These formats may be used by smart text generators in some GDI support modules. The vector formats, in particular, are more frequently used by GDI itself than by support modules.

Both types of files begin with information which is common to both, and then continue with information which differs for each type of file. Font files are stored with a .fnt extension of the form name.fnt. The information at the beginning of both types of files is as follows:

Raster Font File Format
In addition to the information in the header to the file, a raster font file contains a string of bytes which is the actual bitmap, just as it will be loaded into contiguous memory. That string begins in the file at the offset specified in the fiBits field above.

Vector Font File Format
The header information for a vector font file is as described in Section 2, "Font File Formats." This section describes some additional information for vector font files.

The CharOffset field is used to specify the location and usage of the character strokes in the bitmap area. For fixed-pitch fonts, each two-byte entry is an offset from the start of the bitmap to the beginning of the strokes for the character. For variable-pitch fonts, each four-byte entry consists of two bytes giving the offset (as for fixed-pitch) and two bytes giving the width of the character.

For both fixed- and variable- pitch fonts, the bitmap area is the same. Each character is composed of a series of vectors consisting of a pair of signed relative coordinate pairs starting from the character cell origin. Each pair may be preceded by a special value indicating that the next coor­dinate is to be a pen-up move. The special pen-up value depends on how the coordinates are stored. For one-byte quantities, it is -128 (080H) and for two-byte quantities, it is -32768 (08000H).

The character cell origin must be at the upper left corner of the cell so that the character hangs down and to the right of where it is placed.

The storage format for the coordinates depends on the size of the font. If either dfPixHeight or dfMaxWidth is greater than 128, the coordinates are stored as 2-byte quantities; otherwise, they are stored as 1-byte quantities.

ANSI Character Set
Table 1

ANSI Character Set For Windows

00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 █  █  █  █  █  █  █  █  █  █  █  █  █  █  █  █ 10  █  █  █  █  █  █  █  █  █  █  █  █  █  █  █  █ 20     !  "  #  $  %  &  '    *  + ,  -  .  / 30  0  1  2  3  4  5  6  7  8  9  :  ;  <  =  >  ? 40  @  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O 50  P  Q  R  S  T  U  V  W  X  Y  Z  [  \  ]  ^  _ 60  `  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o 70  p  q  r  s  t  u  v  w  x  y  z  {  |  }  ~  █ 80  █  █  █  █  █  █  █  █  █  █  █  █  █  █  █  █ 90  █  █  █  █  █  █  █  █  █  █  █  █  █  █  █  █ A0     ¡  ¢  £  ¤  ¥  ¦  §  ¨  ©  ª  «  ¬  ­  ®  ¯ B0  °  ±  ²  ³  ´  µ  ¶  ·  ¸  ¹  º  »  ¼  ½  ¾  ¿ C0  À  Á  Â  Ã  Ä  Å  Æ  Ç  È  É  Ê  Ë  Ì  Í  Î  Ï D0  Ð  Ñ  Ò  Ó  Ô  Õ  Ö  █  Ø  Ù  Ú  Û  Ü  Ý  Þ  ß E0  à  á  â  ã  ä  å  æ  ç  è  é  ê  ë  ì  í  î  ï F0  ð  ñ  ò  ó  ô  õ  ö  █  ø  ù  ú  û  ü  ý  þ  ÿ