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.

221 lines
6.8 KiB

  1. /*
  2. * Adobe Universal Font Library
  3. *
  4. * Copyright (c) 1996 Adobe Systems Inc.
  5. * All Rights Reserved
  6. *
  7. * UFLT42.h - PostScript Type 42 Font helper routines.
  8. *
  9. *
  10. * $Header:
  11. */
  12. #ifndef _H_UFLT42
  13. #define _H_UFLT42
  14. /*===============================================================================*
  15. * Include files used by this interface *
  16. *===============================================================================*/
  17. #include "UFO.h"
  18. /*===============================================================================*
  19. * Theory of Operation *
  20. *===============================================================================*/
  21. /*
  22. * This file defines a class for Type 42.
  23. */
  24. #define BUMP2BYTE(a) (a % 2) ? (a + 1) : (a)
  25. #define BUMP4BYTE(a) (a % 4) ? (a + (4 - (a % 4))) : (a)
  26. #define THIRTYTWOK (1024L * 32L - 820L - 4L)
  27. #define SIXTYFOURK ((long)(2 * THIRTYTWOK))
  28. #define NUM_16KSTR 640 // Assumes a TT font is no more than 10MBytes = (640*32K)
  29. #define MINIMALNUMBERTABLES 9
  30. #define SFNT_STRINGSIZE 0x3FFE
  31. #define kT42Factor ((float)1.2)
  32. #define NUM_CIDSUFFIX 4
  33. extern char *gcidSuffix[NUM_CIDSUFFIX];
  34. /*
  35. * Define 32K-1, maximal number a CIDMap can handle - see 2ps.bug 3431.
  36. * End at 00 so next CMap can say <7F00> <7FFF> 0.
  37. *
  38. * The Number 0x7F00 is hard coded in CMaps WinCharSetFFFF_H2 and
  39. * WinCharSetFFFF_V2, so don't change it without changing the CMaps
  40. * in CMap_FF.ps first.
  41. */
  42. #define NUM_32K_1 0x7F00
  43. typedef struct tagMaxPTableStruct {
  44. unsigned long version;
  45. unsigned short numGlyphs;
  46. unsigned short maxPoints;
  47. unsigned short maxContours;
  48. unsigned short maxCompositePoints;
  49. unsigned short maxCompositeContours;
  50. unsigned short maxZones;
  51. unsigned short maxTwilightPoints;
  52. unsigned short maxStorage;
  53. unsigned short maxFunctionDefs;
  54. unsigned short maxInstructionDefs;
  55. unsigned short maxStackElements;
  56. unsigned short maxSizeOfInstructions;
  57. unsigned short maxComponentElements;
  58. unsigned short maxComponentDepth;
  59. } MaxPTableStruct;
  60. typedef struct tagOS2TableStruct {
  61. unsigned short version;
  62. short xAvgCharWidth;
  63. unsigned short usWeightClass;
  64. unsigned short usWidthClass;
  65. short fsType;
  66. short ySubscriptXSize;
  67. short ySubscriptYSize;
  68. short ySubscriptXOffset;
  69. short ySubscriptYOffset;
  70. short ySuperscriptXSize;
  71. short ySuperscriptYSize;
  72. short ySuperscriptXOffset;
  73. short ySuperscriptYOffset;
  74. short yStrikeoutSize;
  75. short yStrikeoutPosition;
  76. short sFamilyClass;
  77. char panaose[10];
  78. /*
  79. * Note about unicodeRange.
  80. * This is spec'ed to be an array of 4 long words. I have declared it to
  81. * be an array of 16 bytes simply to avoid endian dependencies. But the
  82. * spec lists active ranges according to bit number. These bit numbers are
  83. * as though it was an array of big endian longs so...
  84. *
  85. * bit 0 -> lowest bit of first long word (lowest bit of 4th byte)
  86. * bit 31 -> highest bit of first long word (highest bit of first byte)
  87. * bit 32 -> lowest bit of second long word (lowest bit of 8th byte)
  88. * etc...
  89. */
  90. unsigned char unicodeRange[16];
  91. char achVendID[4];
  92. unsigned short fsSelection;
  93. unsigned short usFirstCharIndex;
  94. unsigned short usLastCharIndex;
  95. unsigned short sTypeoAscender;
  96. unsigned short sTypeoDescender;
  97. unsigned short sTypoLineGap;
  98. unsigned short usWinAscent;
  99. unsigned short usWinDescent;
  100. /*
  101. * Microsoft documentation claims that there is a uICodePageRange at the
  102. * end of the record, but I have never seen 'OS/2' table that contains one.
  103. */
  104. /* unsigned char uICodePageRange[8]; */
  105. } UFLOS2Table;
  106. typedef struct tagPOSTHEADER {
  107. unsigned long format; /* 0x00010000 for 1.0, 0x00020000 for 2.0, and so on... */
  108. unsigned long italicAngle;
  109. short int underlinePosition;
  110. short int underlineThickness;
  111. unsigned long isFixedPitch;
  112. unsigned long minMemType42;
  113. unsigned long maxMemType42;
  114. unsigned long minMemType1;
  115. unsigned long maxMemType1;
  116. } POSTHEADER;
  117. #define POST_FORMAT_10 0x00010000
  118. #define POST_FORMAT_20 0x00020000
  119. #define POST_FORMAT_25 0x00020500
  120. #define POST_FORMAT_30 0x00030000
  121. typedef struct tagType42HeaderStruct {
  122. long tableVersionNumber;
  123. long fontRevision;
  124. long checkSumAdjustment;
  125. long magicNumber;
  126. short flags;
  127. short unitsPerEm;
  128. char timeCreated[8];
  129. char timeModified[8];
  130. short xMin;
  131. short yMin;
  132. short xMax;
  133. short yMax;
  134. short macStyle;
  135. short lowestRecPPEM;
  136. short fontDirectionHint;
  137. short indexToLocFormat;
  138. short glyfDataFormat;
  139. } Type42HeaderStruct;
  140. typedef struct tagGITableStruct {
  141. short glyphIndices[255]; /* This will change to a pointer for FE fonts */
  142. short n; /* maximal OID for this charset: 0 to n-1 */
  143. } GITableStruct;
  144. /* for Composite Characters */
  145. #define MINUS_ONE -1
  146. #define ARG_1_AND_2_ARE_WORDS 0x0001
  147. #define ARGS_ARE_XY_VALUES 0x0002
  148. #define ROUND_XY_TO_GRID 0x0004
  149. #define WE_HAVE_A_SCALE 0x0008
  150. #define MORE_COMPONENTS 0x0020
  151. #define WE_HAVE_AN_X_AND_Y_SCALE 0x0040
  152. #define WE_HAVE_A_TWO_BY_TWO 0x0080
  153. #define WE_HAVE_INSTRUCTIONS 0x0100
  154. #define USE_MY_METRICS 0x0200
  155. typedef struct tagT42FontStruct {
  156. unsigned long minSfntSize;
  157. unsigned long averageGlyphSize;
  158. UFLTTFontInfo info;
  159. unsigned char *pHeader;
  160. unsigned char *pMinSfnt;
  161. unsigned long *pStringLength;
  162. void *pLocaTable;
  163. Type42HeaderStruct headTable; // This is not initialized to nil/zero
  164. short cOtherTables;
  165. unsigned short numRotatedGlyphIDs;
  166. long *pRotatedGlyphIDs; // GID's need to be rotated for CJK-Vertical fonts
  167. } T42FontStruct;
  168. /*
  169. * Public function prototype
  170. */
  171. UFOStruct *
  172. T42FontInit(
  173. const UFLMemObj *pMem,
  174. const UFLStruct *pUFL,
  175. const UFLRequest *pRequest
  176. );
  177. UFLErrCode
  178. T42CreateBaseFont(
  179. UFOStruct *pUFObj,
  180. const UFLGlyphsInfo *pGlyphs,
  181. unsigned long *pVMUsage,
  182. UFLBool bFullFont,
  183. char *pHostFontName
  184. );
  185. #endif // _H_UFLT42