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.

189 lines
7.3 KiB

  1. /*++
  2. Copyright (c) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. sf_pcl.h
  5. Abstract:
  6. Structures etc used to define PCL Softfont file format.
  7. [Environment:]
  8. Win32 subsystem, printer drivers
  9. Revision History:
  10. 03/05/97 -ganeshp-
  11. Created it.
  12. --*/
  13. /*
  14. * A structure corresponding to the layout of Font Descriptor for a PCL
  15. * soft font file. The Font Descriptor is at the beginning of the file,
  16. * and contains overall font info.
  17. *
  18. * Note that there are several different versions of this structure;
  19. * the first is the original (pre LJ4) format, while the second is
  20. * the LJ4 introduced variety that allows specifying the resolution
  21. * at which the font was digitised. This is used for downloading TT
  22. * fonts etc. which are generated at the graphics resolution.
  23. *
  24. * NOTE: The data layout is designed for the 68000 family - which is
  25. * big endian. So, an amount of shuffling is required for little
  26. * endian machines like the x86.
  27. */
  28. typedef signed char SBYTE;
  29. #define SFH_NM_SZ 16 /* Bytes allowed in name field */
  30. typedef struct
  31. {
  32. WORD wSize; /* Number of bytes in here */
  33. BYTE bFormat; /* Format: original, TT, intellifont, etc */
  34. BYTE bFontType; /* 7, 8 or PC-8 style font */
  35. WORD wRes1; /* Reserved */
  36. WORD wBaseline; /* Baseline to cell top, PCL dots */
  37. WORD wCellWide; /* Cell width in dots */
  38. WORD wCellHeight; /* Cell height in dots */
  39. BYTE bOrientation; /* Orientation: 0 portrait, 1 Landscape */
  40. BYTE bSpacing; /* 0 fixed pitch, 1 proportional */
  41. WORD wSymSet; /* Symbol set, using HP encoding */
  42. WORD wPitch; /* Pitch in quarter dot units == HMI */
  43. WORD wHeight; /* Design height in quarter dot units */
  44. WORD wXHeight; /* Design height, quarter dots, of x */
  45. SBYTE sbWidthType; /* Relative width of glyphs */
  46. BYTE bStyle; /* 0 for regular, 1 for italic */
  47. SBYTE sbStrokeW; /* Stroke weight; -7 (thin) to +7 (thick) */
  48. BYTE bTypeface; /* Typeface ID - predefined types */
  49. BYTE bRes2;
  50. BYTE bSerifStyle; /* Serif style; predefined values */
  51. WORD wRes3;
  52. SBYTE sbUDist; /* Underline distance from baseline */
  53. BYTE bUHeight; /* Underline height */
  54. WORD wTextHeight; /* Quarter dot interline spacing */
  55. WORD wTextWidth; /* Quarter dot glyph increment */
  56. WORD wRes4;
  57. WORD wRes5;
  58. BYTE bPitchExt; /* Additional pitch resolution */
  59. BYTE bHeightExt; /* Ditto, for height */
  60. WORD wRes6;
  61. WORD wRes7;
  62. WORD wRes8;
  63. char chName[ SFH_NM_SZ ]; /* May not be null terminated! */
  64. } SF_HEADER;
  65. typedef struct
  66. {
  67. WORD wSize; /* Number of bytes in here */
  68. BYTE bFormat; /* Format: original, TT, intellifont, etc */
  69. BYTE bFontType; /* 7, 8 or PC-8 style font */
  70. WORD wRes1; /* Reserved */
  71. WORD wBaseline; /* Baseline to cell top, PCL dots */
  72. WORD wCellWide; /* Cell width in dots */
  73. WORD wCellHeight; /* Cell height in dots */
  74. BYTE bOrientation; /* Orientation: 0 portrait, 1 Landscape */
  75. BYTE bSpacing; /* 0 fixed pitch, 1 proportional */
  76. WORD wSymSet; /* Symbol set, using HP encoding */
  77. WORD wPitch; /* Pitch in quarter dot units == HMI */
  78. WORD wHeight; /* Design height in quarter dot units */
  79. WORD wXHeight; /* Design height, quarter dots, of x */
  80. SBYTE sbWidthType; /* Relative width of glyphs */
  81. BYTE bStyle; /* 0 for regular, 1 for italic */
  82. SBYTE sbStrokeW; /* Stroke weight; -7 (thin) to +7 (thick) */
  83. BYTE bTypeface; /* Typeface ID - predefined types */
  84. BYTE bRes2;
  85. BYTE bSerifStyle; /* Serif style; predefined values */
  86. WORD wRes3;
  87. SBYTE sbUDist; /* Underline distance from baseline */
  88. BYTE bUHeight; /* Underline height */
  89. WORD wTextHeight; /* Quarter dot interline spacing */
  90. WORD wTextWidth; /* Quarter dot glyph increment */
  91. WORD wRes4;
  92. WORD wRes5;
  93. BYTE bPitchExt; /* Additional pitch resolution */
  94. BYTE bHeightExt; /* Ditto, for height */
  95. WORD wRes6;
  96. WORD wRes7;
  97. WORD wRes8;
  98. char chName[ SFH_NM_SZ ]; /* May not be null terminated! */
  99. WORD wXResn; /* X resolution of font design */
  100. WORD wYResn; /* Y design resolution */
  101. } SF_HEADER20;
  102. /*
  103. * Typical values used above to identify different types of fonts.
  104. */
  105. #define PCL_FM_ORIGINAL 0 /* Bitmap font, digitised at 300 DPI */
  106. #define PCL_FM_RESOLUTION 20 /* Bitmap font, includes digitised resn */
  107. #define PCL_FM_TT 15 /* TT scalable, bound or unbound */
  108. #define PCL_FM_2B_TT 16 /* TT 2 Byte (format 16) */
  109. /* bFontType values */
  110. #define PCL_FT_7BIT 0 /* 7 bit: glyphs from 32 - 127 inc */
  111. #define PCL_FT_8LIM 1 /* 8 bit, glyphs 32 - 127 & 160 - 255 */
  112. #define PCL_FT_PC8 2 /* PC-8, glyphs 0 - 255, transparent too! */
  113. /* sbStrokeW values */
  114. #define PCL_LIGHT -3
  115. #define PCL_BOLD 3
  116. /*
  117. * In addition, each glyph in the font contains a Character Descriptor.
  118. * So now define a structure for that too!
  119. */
  120. typedef struct
  121. {
  122. BYTE bFormat; /* Format identifier: 4 for PCL 4 */
  123. BYTE bContinuation; /* Set if continuation of prior entry */
  124. BYTE bDescSize; /* Size of this structure */
  125. BYTE bClass; /* Format of data: 1 for PCL 4 */
  126. BYTE bOrientation; /* Zero == portrait; 1 == landscape */
  127. BYTE bRes0;
  128. short sLOff; /* Dots from ref. to left side of char */
  129. short sTOff; /* Dots from ref. to top of char */
  130. WORD wChWidth; /* Char width in dots */
  131. WORD wChHeight; /* Char height in dots */
  132. WORD wDeltaX; /* Quarter dot position increment after print */
  133. } CH_HEADER;
  134. /*
  135. * Character records can be continued due to the limit of 32767 bytes in
  136. * a PCL command sequence. Continuation records have the following
  137. * format. Really it is only the first two elements of the above
  138. * structure.
  139. */
  140. typedef struct
  141. {
  142. BYTE bFormat; /* Format identifier; 4 for PCL 4 */
  143. BYTE bContinuation; /* TRUE if this is a continuation record */
  144. } CH_CONT_HDR;
  145. /*
  146. * Values for some of the fields in the above structs.
  147. */
  148. /* bFormat */
  149. #define CH_FM_RASTER 4 /* Bitmap type */
  150. #define CH_FM_SCALE 10 /* Intellifont scalable */
  151. /* bClass */
  152. #define CH_CL_BITMAP 1 /* A bitmap font */
  153. #define CH_CL_COMPBIT 2 /* Compressed bitmap */
  154. #define CH_CL_CONTOUR 3 /* Intellifont scalable contour */
  155. #define CH_CL_COMPCONT 4 /* Ditto, but compound contour */