Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

214 lines
8.8 KiB

  1. /***************************** MODULE HEADER ********************************
  2. * sf_pcl.h
  3. * Structures etc used to define PCL Softfont file format.
  4. *
  5. * Copyright (C) 1992 Microsoft Corporation.
  6. *
  7. *****************************************************************************/
  8. #ifndef SOFTFONT_H_
  9. #define SOFTFONT_H_
  10. /*
  11. * A structure corresponding to the layout of Font Descriptor for a PCL
  12. * soft font file. The Font Descriptor is at the beginning of the file,
  13. * and contains overall font info.
  14. *
  15. * Note that there are several different versions of this structure;
  16. * the first is the original (pre LJ4) format, while the second is
  17. * the LJ4 introduced variety that allows specifying the resolution
  18. * at which the font was digitised. This is used for downloading TT
  19. * fonts etc. which are generated at the graphics resolution.
  20. *
  21. * NOTE: The data layout is designed for the 68000 family - which is
  22. * big endian. So, an amount of shuffling is required for little
  23. * endian machines like the x86.
  24. */
  25. typedef signed char SBYTE;
  26. #define SFH_NM_SZ 16 /* Bytes allowed in name field */
  27. typedef struct
  28. {
  29. WORD wSize; /* Number of bytes in here */
  30. BYTE bFormat; /* Format: original, TT, intellifont, etc */
  31. BYTE bFontType; /* 7, 8 or PC-8 style font */
  32. WORD wRes1; /* Reserved */
  33. WORD wBaseline; /* Baseline to cell top, PCL dots */
  34. WORD wCellWide; /* Cell width in dots */
  35. WORD wCellHeight; /* Cell height in dots */
  36. BYTE bOrientation; /* Orientation: 0 portrait, 1 Landscape */
  37. BYTE bSpacing; /* 0 fixed pitch, 1 proportional */
  38. WORD wSymSet; /* Symbol set, using HP encoding */
  39. WORD wPitch; /* Pitch in quarter dot units == HMI */
  40. WORD wHeight; /* Design height in quarter dot units */
  41. WORD wXHeight; /* Design height, quarter dots, of x */
  42. SBYTE sbWidthType; /* Relative width of glyphs */
  43. BYTE bStyle; /* 0 for regular, 1 for italic */
  44. SBYTE sbStrokeW; /* Stroke weight; -7 (thin) to +7 (thick) */
  45. BYTE bTypeface; /* Typeface ID - predefined types */
  46. BYTE bRes2;
  47. BYTE bSerifStyle; /* Serif style; predefined values */
  48. WORD wRes3;
  49. SBYTE sbUDist; /* Underline distance from baseline */
  50. BYTE bUHeight; /* Underline height */
  51. WORD wTextHeight; /* Quarter dot interline spacing */
  52. WORD wTextWidth; /* Quarter dot glyph increment */
  53. WORD wRes4;
  54. WORD wRes5;
  55. BYTE bPitchExt; /* Additional pitch resolution */
  56. BYTE bHeightExt; /* Ditto, for height */
  57. WORD wRes6;
  58. WORD wRes7;
  59. WORD wRes8;
  60. char chName[ SFH_NM_SZ ]; /* May not be null terminated! */
  61. } SF_HEADER;
  62. typedef struct
  63. {
  64. WORD wSize; /* Number of bytes in here */
  65. BYTE bFormat; /* Format: original, TT, intellifont, etc */
  66. BYTE bFontType; /* 7, 8 or PC-8 style font */
  67. WORD wRes1; /* Reserved */
  68. WORD wBaseline; /* Baseline to cell top, PCL dots */
  69. WORD wCellWide; /* Cell width in dots */
  70. WORD wCellHeight; /* Cell height in dots */
  71. BYTE bOrientation; /* Orientation: 0 portrait, 1 Landscape */
  72. BYTE bSpacing; /* 0 fixed pitch, 1 proportional */
  73. WORD wSymSet; /* Symbol set, using HP encoding */
  74. WORD wPitch; /* Pitch in quarter dot units == HMI */
  75. WORD wHeight; /* Design height in quarter dot units */
  76. WORD wXHeight; /* Design height, quarter dots, of x */
  77. SBYTE sbWidthType; /* Relative width of glyphs */
  78. BYTE bStyle; /* 0 for regular, 1 for italic */
  79. SBYTE sbStrokeW; /* Stroke weight; -7 (thin) to +7 (thick) */
  80. BYTE bTypeface; /* Typeface ID - predefined types */
  81. BYTE bRes2;
  82. BYTE bSerifStyle; /* Serif style; predefined values */
  83. WORD wRes3;
  84. SBYTE sbUDist; /* Underline distance from baseline */
  85. BYTE bUHeight; /* Underline height */
  86. WORD wTextHeight; /* Quarter dot interline spacing */
  87. WORD wTextWidth; /* Quarter dot glyph increment */
  88. WORD wRes4;
  89. WORD wRes5;
  90. BYTE bPitchExt; /* Additional pitch resolution */
  91. BYTE bHeightExt; /* Ditto, for height */
  92. WORD wRes6;
  93. WORD wRes7;
  94. WORD wRes8;
  95. char chName[ SFH_NM_SZ ]; /* May not be null terminated! */
  96. WORD wXResn; /* X resolution of font design */
  97. WORD wYResn; /* Y design resolution */
  98. } SF_HEADER20;
  99. /*
  100. * Typical values used above to identify different types of fonts.
  101. */
  102. #define PCL_FM_ORIGINAL 0 /* Bitmap font, digitised at 300 DPI */
  103. #define PCL_FM_RESOLUTION 20 /* Bitmap font, includes digitised resn */
  104. #define PCL_FM_TT 15 /* TT scalable, bound or unbound */
  105. /* bFontType values */
  106. #define PCL_FT_7BIT 0 /* 7 bit: glyphs from 32 - 127 inc */
  107. #define PCL_FT_8LIM 1 /* 8 bit, glyphs 32 - 127 & 160 - 255 */
  108. #define PCL_FT_PC8 2 /* PC-8, glyphs 0 - 255, transparent too! */
  109. /* sbStrokeW values */
  110. #define PCL_LIGHT -3
  111. #define PCL_BOLD 3
  112. /*
  113. * In addition, each glyph in the font contains a Character Descriptor.
  114. * So now define a structure for that too!
  115. */
  116. typedef struct
  117. {
  118. BYTE bFormat; /* Format identifier: 4 for PCL 4 */
  119. BYTE bContinuation; /* Set if continuation of prior entry */
  120. BYTE bDescSize; /* Size of this structure */
  121. BYTE bClass; /* Format of data: 1 for PCL 4 */
  122. BYTE bOrientation; /* Zero == portrait; 1 == landscape */
  123. BYTE bRes0;
  124. short sLOff; /* Dots from ref. to left side of char */
  125. short sTOff; /* Dots from ref. to top of char */
  126. WORD wChWidth; /* Char width in dots */
  127. WORD wChHeight; /* Char height in dots */
  128. WORD wDeltaX; /* Quarter dot position increment after print */
  129. } CH_HEADER;
  130. /*
  131. * Character records can be continued due to the limit of 32767 bytes in
  132. * a PCL command sequence. Continuation records have the following
  133. * format. Really it is only the first two elements of the above
  134. * structure.
  135. */
  136. typedef struct
  137. {
  138. BYTE bFormat; /* Format identifier; 4 for PCL 4 */
  139. BYTE bContinuation; /* TRUE if this is a continuation record */
  140. } CH_CONT_HDR;
  141. /*
  142. * Values for some of the fields in the above structs.
  143. */
  144. /* bFormat */
  145. #define CH_FM_RASTER 4 /* Bitmap type */
  146. #define CH_FM_SCALE 10 /* Intellifont scalable */
  147. /* bClass */
  148. #define CH_CL_BITMAP 1 /* A bitmap font */
  149. #define CH_CL_COMPBIT 2 /* Compressed bitmap */
  150. #define CH_CL_CONTOUR 3 /* Intellifont scalable contour */
  151. #define CH_CL_COMPCONT 4 /* Ditto, but compound contour */
  152. #define EXP_SIZE 2
  153. #define FDH_VER 0x100 /* 1.00 in BCD */
  154. /*
  155. * Flags bits.
  156. */
  157. #define FDH_SOFT 0x0001 /* Softfont, thus needs downloading */
  158. #define FDH_CART 0x0002 /* This is a cartridge font */
  159. #define FDH_CART_MAIN 0x0004 /* Main (first) entry for this cartridge */
  160. /*
  161. * Selection criteria bits: dwSelBits. These bits are used as
  162. * follows. During font installation, the installer set the following
  163. * values as appropriate. During initialisation, the driver sets
  164. * up a mask of these bits, depending upon the printer's abilities.
  165. * For example, the FDH_SCALABLE bit is set only if the printer can
  166. * handle scalable fonts. When the fonts are examined to see if
  167. * they are usable, the following test is applied:
  168. *
  169. * (font.dwSelBits & printer.dwSelBits) == font.dwSelBits
  170. *
  171. * If true, the font is usable.
  172. */
  173. #define FDH_LANDSCAPE 0x00000001 /* Font is landscape orientation */
  174. #define FDH_PORTRAIT 0x00000002 /* Font is portrait */
  175. #define FDH_OR_REVERSE 0x00000004 /* 180 degree rotation of above */
  176. #define FDH_BITMAP 0x00000008 /* Bitmap font */
  177. #define FDH_COMPRESSED 0x00000010 /* Data is compressed bitmap */
  178. #define FDH_SCALABLE 0x00000020 /* Font is scalable */
  179. #define FDH_CONTOUR 0x00000040 /* Intellifont contour */
  180. #define FDH_ERROR 0x80000000 /* Set if some error condition */
  181. #endif // #ifndef SOFTFONT_H_