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.

215 lines
7.0 KiB

  1. //
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //
  4. #ifndef __uspp__
  5. #define __uspp__
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. //// USP10P.H
  10. //
  11. // Private additions to USP header for use within USP and by the
  12. // NT5 complex script language pack only.
  13. #if DBG
  14. #define USPALLOC(a,b) (DG.psFile=__FILE__, DG.iLine=__LINE__, UspAllocCache(a, b))
  15. #define USPALLOCTEMP(a, b) (DG.psFile=__FILE__, DG.iLine=__LINE__, UspAllocTemp(a, b))
  16. #define USPFREE(a) (DG.psFile=__FILE__, DG.iLine=__LINE__, UspFreeMem(a))
  17. #else
  18. #define USPALLOC(a,b) UspAllocCache(a, b)
  19. #define USPALLOCTEMP(a, b) UspAllocTemp(a, b)
  20. #define USPFREE(a) UspFreeMem (a)
  21. #endif
  22. ///// LPK entry point serialisation
  23. //
  24. // Since it is not possible to guarantee that Uniscribe and the
  25. // LPK receive process deatachment after all their clients, we
  26. // need to track Uniscribe shutdown.
  27. //
  28. // At each LPK entrypoint, the LPK calls EnterLpk, and after each exit
  29. // it calls ExitLpk.
  30. //
  31. // If Uniscribe is detached, or being detatched, EnterLpk fails. In this
  32. // case, the LPK entrypoint must do something safe and return directly.
  33. //
  34. // Uniscribe maintains an LPK nesting level. If a process detach occurs
  35. // during LPK execution, a detachPending flag is set and will be processed
  36. // at the ExitLpk that pops all the nesting.
  37. void LpkPresent(); // Used by LPK to disable cleanup at PROCESS_DETACH time
  38. ///// UspAllocCache
  39. //
  40. // Allocate long term memory for use caching font tables
  41. HRESULT WINAPI UspAllocCache(
  42. int iSize, // In required size in bytes
  43. void **ppv); // Out Allocated address
  44. ///// UspAllocTemp
  45. //
  46. // Allocate short term memory with lifetime no more than an API call
  47. HRESULT WINAPI UspAllocTemp(
  48. int iSize, // In required size in bytes
  49. void **ppv); // Out Allocated address
  50. ///// UspFreeMem
  51. //
  52. //
  53. HRESULT WINAPI UspFreeMem(
  54. void *pv); // In memory to be freed
  55. ///// SCRIPT_STRING_ANALYSIS
  56. //
  57. // This structure provides all parameters required for script analysis.
  58. //
  59. //
  60. #define MAX_PLANE_0_FONT 13 // max number of non-surrogate fallback fonts
  61. #define MAX_SURROGATE_FONT 16 // max number of the surrogate fallback fonts
  62. // Max fallback fonts including user font (Cannot exceed 31 because usage is recorded in a bitset)
  63. // and Microsoft Sans Serif and surrogate fallback fonts.
  64. #define MAX_FONT MAX_PLANE_0_FONT + MAX_SURROGATE_FONT // 29 fonts
  65. #define DUMMY_MAX_FONT 7 // dummy one for dummy entries
  66. typedef struct tag_STRING_ANALYSIS {
  67. // Input variables - Initialised by the caller
  68. HDC hdc; // Only required for shaping (GCP_Ligate && lpOrder or lpGlyphs arrays specified)
  69. DWORD dwFlags; // See ScriptStringAnalyse
  70. CHARSETINFO csi; // As returned by TranslateCharsetInfo
  71. // Input buffers
  72. WCHAR *pwInChars; // Unicode input string
  73. int cInChars; // String length
  74. int iHotkeyPos; // Derived from '&' positions if SSA_HOTKEY set
  75. int iMaxExtent; // Required maximum pixel width (used if clipping or fitting)
  76. const int *piDx; // Logical advance width array
  77. SCRIPT_CONTROL sControl;
  78. SCRIPT_STATE sState;
  79. SCRIPT_TABDEF *pTabdef; // Tabstop definition
  80. int cMaxItems; // Number of entries in pItems
  81. SCRIPT_ITEM *pItems;
  82. // Low cost analysis output buffers
  83. // No shaping required when fLigate=FALSE
  84. // Must be at least as long as the input string
  85. BYTE *pbLevel; // Array of item level
  86. int *piVisToLog; // Visual to Logical mapping
  87. WORD *pwLeftGlyph; // Leftmost glyph of each logical item
  88. WORD *pwcGlyphs; // Count of glyphs in each logical item
  89. SCRIPT_LOGATTR *pLogAttr; // Cursor points, word and line breaking (indexed in logical order)
  90. // High cost analysis output buffers
  91. // Require hDC to be set
  92. // Must be at least nGlyphs long.
  93. int cMaxGlyphs; // Max glyphs to create
  94. WORD *pwGlyphs; // Output glyph array
  95. WORD *pwLogClust; // logical to visual mapping
  96. SCRIPT_VISATTR *pVisAttr; // Justification insertion points (visual order) and other flags
  97. int *piAdvance; // Advance widths
  98. int *piJustify; // Justified advance widths
  99. GOFFSET *pGoffset; // x,y combining character offsets
  100. // Font fallback
  101. DWORD dwFallbacksUsed;// Bitmap of fallback fonts used
  102. BYTE *pbFont; // Font index per item, 0 means original user font
  103. // Obsolete - have to leave them here so the subsequent layout
  104. // remains unchanged for old LPK to use (wchao, 12/14/2000).
  105. // we used the first two slots in hf_dummy array for some needed flags
  106. // take a look to isAssociated and isPrinting
  107. SCRIPT_CACHE sc_dummy[DUMMY_MAX_FONT];
  108. HFONT isAssociated; // used as flag to indicate if the user selected font is associated
  109. HFONT hf_dummy[DUMMY_MAX_FONT-1];
  110. int iCurFont; // 0 For users font
  111. LOGFONTA lfA; // Logfont from the original DC - only set if font fallback happens
  112. // Output variables
  113. // Item analysis
  114. int cItems; // Number of items analysed == Index of terminal (sentinel) item in pItem
  115. // Generated glyphs and character measurements
  116. // Note that
  117. // 1) nOutGlyphs may be more or less than nInChars.
  118. // 2) nOutChars may be less than nInChars if fClip was requested.
  119. int cOutGlyphs; // Number of glyphs generated
  120. int cOutChars; // Number of characters generated
  121. ABC abc;
  122. SIZE size; // Size of whole line (pixel width and height)
  123. // For client use
  124. void *pvClient;
  125. // fallback font store
  126. // we store in the items sc[MAX_PLANE_0_FONT-1] and hf[MAX_PLANE_0_FONT-1] the data for Microsoft Sans Serif
  127. // font which has hight same as the selected user font height.
  128. // note that hf[1] will have the font data for Microsoft Sans Serif font too but
  129. // with adjusted height.
  130. // the items in sc and hf arrays which have index greater than or equal MAX_PLANE_0_FONT will be used
  131. // for surrogate fallback fonts.
  132. SCRIPT_CACHE sc[MAX_FONT]; // Script cache for each fallback, [0] is users font
  133. HFONT hf[MAX_FONT]; // Handles to fallback fonts, [0] is users font
  134. } STRING_ANALYSIS;
  135. #ifdef __cplusplus
  136. }
  137. #endif
  138. #endif