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.

433 lines
8.1 KiB

  1. /*++
  2. Copyright (c) 1996 - 1999 Microsoft Corporation
  3. Module Name:
  4. fontddi.c
  5. Abstract:
  6. Implementation of the DDI interface functions specific to font module.
  7. Environment:
  8. Windows NT Unidrv driver
  9. Revision History:
  10. 12/11/96 -ganeshp-
  11. Created
  12. --*/
  13. #include "font.h"
  14. BOOL
  15. FMResetPDEV(
  16. PDEV *pPDevOld,
  17. PDEV *pPDevNew
  18. )
  19. /*++
  20. Routine Description:
  21. This callback is provided to do cacheing incase of ResetPDev.
  22. Arguments:
  23. pPDevOld Pointer to Old PDEV.
  24. pPDevNew Pointer to new PDEV.
  25. Return Value:
  26. TRUE for success and FALSE for failure
  27. Note:
  28. 11-18-96: Created it -ganeshp-
  29. --*/
  30. {
  31. BOOL bRet = FALSE;
  32. PFONTPDEV pFontPDevNew = pPDevOld->pFontPDev,
  33. pFontPDevOld = pPDevOld->pFontPDev;
  34. /* Check the FontPdev Signature */
  35. if( (pFontPDevNew->dwSignature != FONTPDEV_ID) ||
  36. (pFontPDevOld->dwSignature != FONTPDEV_ID) )
  37. {
  38. ERR(("\nUniFont!FMResetPDEV; Bad Input PDEV\n"));
  39. goto ErrorExit;
  40. }
  41. bRet = TRUE;
  42. ErrorExit:
  43. /* Check for Errors */
  44. if (!bRet)
  45. {
  46. }
  47. return bRet;
  48. }
  49. VOID
  50. FMDisablePDEV(
  51. PDEV *pPDev
  52. )
  53. /*++
  54. Routine Description:
  55. DrvDisablePDEV entry in Font Module. This routine frees up all the font
  56. module related memory.
  57. Arguments:
  58. pPDev Pointer to PDEV
  59. Return Value:
  60. TRUE for success and FALSE for failure
  61. Note:
  62. 11-18-96: Created it -ganeshp-
  63. --*/
  64. {
  65. /* Free the Memory allocated by the font module */
  66. VFontFreeMem(pPDev);
  67. }
  68. VOID
  69. FMDisableSurface(
  70. PDEV *pPDev
  71. )
  72. /*++
  73. Routine Description:
  74. Arguments:
  75. pPDev Pointer to PDEV
  76. Return Value:
  77. TRUE for success and FALSE for failure
  78. Note:
  79. 11-18-96: Created it -ganeshp-
  80. --*/
  81. {
  82. /*
  83. * If appropriate, free the position sorting memory. PFMPDV is macro
  84. * defined in fmmacro.h. This assumes that 'pPDev' is defined.
  85. */
  86. if( PFDV->pPSHeader )
  87. {
  88. /* Memory has been allocated, so free it now. */
  89. VFreePS( pPDev );
  90. /* Only once, in case */
  91. PFDV->pPSHeader = 0;
  92. }
  93. }
  94. BOOL
  95. FMEnableSurface(
  96. PDEV *pPDev
  97. )
  98. /*++
  99. Routine Description:
  100. Font Module DrvEnableSurface entry. We don't do any snything.
  101. Arguments:
  102. pPDev Pointer to PDEV
  103. Return Value:
  104. TRUE for success and FALSE for failure
  105. Note:
  106. 12-18-96: Created it -ganeshp-
  107. --*/
  108. {
  109. return TRUE;
  110. }
  111. BOOL
  112. FMStartDoc(
  113. SURFOBJ *pso,
  114. PWSTR pDocName,
  115. DWORD jobId
  116. )
  117. /*++
  118. Routine Description:
  119. Font Module DrvStartDoc interface. No need to do any specific job.
  120. Arguments:
  121. pso Pointer to SurfOBJ
  122. pDocName Document Name
  123. jobId Job Id
  124. Return Value:
  125. TRUE for success and FALSE for failure
  126. Note:
  127. 121-18-96: Created it -ganeshp-
  128. --*/
  129. {
  130. return TRUE;
  131. }
  132. BOOL
  133. FMStartPage(
  134. SURFOBJ *pso
  135. )
  136. /*++
  137. Routine Description:
  138. DrvStartPage interface. All the font specific data structures needed on
  139. per page basis will be created.
  140. Arguments:
  141. pso Pointer to SurfOBJ
  142. Return Value:
  143. TRUE for success and FALSE for failure
  144. Note:
  145. 12-18-96: Created it -ganeshp-
  146. --*/
  147. {
  148. BOOL bRet = FALSE;
  149. PDEV *pPDev;
  150. FONTPDEV *pFontPDev; /* Font pdev */
  151. pPDev = (PDEV *)pso->dhpdev;
  152. pFontPDev = (FONTPDEV *)pPDev->pFontPDev;
  153. /*
  154. * If this is NOT a page printer, we need to initialise the position
  155. * sorting functions, so that we print the page unidirectionally.
  156. */
  157. if( ((pFontPDev->flFlags & FDV_MD_SERIAL) && pPDev->iFonts) &&
  158. !BCreatePS( pPDev) )
  159. {
  160. ERREXIT(( "Rasdd!DrvStartPage: Cannot create text sorting areas\n" ));
  161. }
  162. bRet = TRUE;
  163. ErrorExit:
  164. return bRet;
  165. }
  166. BOOL
  167. FMSendPage(
  168. SURFOBJ *pso
  169. )
  170. /*++
  171. Routine Description:
  172. This routine is called on page boundries. we play back the
  173. white text and free up the memory used by Text Queue.
  174. Arguments:
  175. pso Pointer to SurfOBJ
  176. Return Value:
  177. TRUE for success and FALSE for failure
  178. Note:
  179. 12-18-96: Created it -ganeshp-
  180. --*/
  181. {
  182. PDEV *pPDev; /* Access to all that is important */
  183. BOOL bRet = TRUE;
  184. pPDev = (PDEV *) pso->dhpdev;
  185. if( PFDV->pvWhiteTextFirst )
  186. {
  187. /*
  188. * This page contains white text. This is stored away in a
  189. * separate buffer. Now is the time to play it back. This is
  190. * required because the LJ III etc require this data be sent
  191. * after the graphics.
  192. */
  193. bRet = BPlayWhiteText( pPDev );
  194. }
  195. if( PFDV->pPSHeader )
  196. VFreePS( pPDev ); /* Done with this page */
  197. return bRet;
  198. }
  199. BOOL
  200. FMEndDoc(
  201. SURFOBJ *pso,
  202. FLONG flags
  203. )
  204. /*++
  205. Routine Description:
  206. Font Module DrvEndDoc interface. We reset font module specif flags.
  207. Download specific data structure is also freed, so that for new document
  208. we download again.
  209. Arguments:
  210. pso Pointer to SurfOBJ
  211. flags DrvEndDoc Flags
  212. Return Value:
  213. TRUE for success and FALSE for failure
  214. Note:
  215. 121-18-96: Created it -ganeshp-
  216. --*/
  217. {
  218. PDEV * pPDev = ((PDEV *)(pso->dhpdev));
  219. //
  220. // Clear Out the Text Flags based on per document.
  221. //
  222. pPDev->fMode &= ~PF_ENUM_TEXT;
  223. PFDV->flFlags &= ~FDV_GRX_ON_TXT_BAND;
  224. PFDV->flFlags &= ~FDV_GRX_UNDER_TEXT;
  225. /* Free The download specific data */
  226. VFreeDL( (PDEV *)pso->dhpdev );
  227. return TRUE;
  228. }
  229. BOOL
  230. FMStartBanding(
  231. SURFOBJ *pso,
  232. POINTL *pptl
  233. )
  234. /*++
  235. Routine Description:
  236. Font Module StartBanding interface.
  237. Arguments:
  238. pso Pointer to SurfOBJ
  239. pptl Origin of the first Band
  240. Return Value:
  241. TRUE for success and FALSE for failure
  242. Note:
  243. 121-19-96: Created it -ganeshp-
  244. --*/
  245. {
  246. PDEV *pPDev; /* Access to all that is important */
  247. pPDev = (PDEV *) pso->dhpdev;
  248. /* Mark the surface as Graphics */
  249. pPDev->fMode &= ~PF_ENUM_TEXT;
  250. pPDev->fMode &= ~PF_REPLAY_BAND;
  251. pPDev->fMode |= PF_ENUM_GRXTXT;
  252. PFDV->flFlags &= ~FDV_GRX_ON_TXT_BAND;
  253. PFDV->flFlags &= ~FDV_GRX_UNDER_TEXT;
  254. return TRUE;
  255. }
  256. BOOL
  257. FMNextBand(
  258. SURFOBJ *pso,
  259. POINTL *pptl
  260. )
  261. /*++
  262. Routine Description:
  263. Font Module StartBanding interface.
  264. Arguments:
  265. pso Pointer to SurfOBJ
  266. pptl Origin of the Next Band
  267. Return Value:
  268. TRUE for success and FALSE for failure
  269. Note:
  270. 121-19-96: Created it -ganeshp-
  271. --*/
  272. {
  273. PDEV *pPDev; /* Access to all that is important */
  274. pPDev = (PDEV *) pso->dhpdev;
  275. /* Check if we need separate text band. We need a separate text band if
  276. * during any TextOut we fond that there is graphics data on the surface
  277. * under the text clipping rectangle.
  278. */
  279. if ( (pPDev->fMode & PF_FORCE_BANDING) &&
  280. (pPDev->fMode & PF_ENUM_GRXTXT) &&
  281. (PFDV->flFlags & FDV_GRX_UNDER_TEXT))
  282. {
  283. /* Mark the surface as Text */
  284. pPDev->fMode |= PF_ENUM_TEXT;
  285. pPDev->fMode |= PF_REPLAY_BAND;
  286. pPDev->fMode &= ~PF_ENUM_GRXTXT;
  287. }
  288. else if (pPDev->fMode & PF_ENUM_TEXT) /* If This is a Text Band */
  289. {
  290. /* Mark the surface as Graphics */
  291. pPDev->fMode &= ~PF_ENUM_TEXT;
  292. pPDev->fMode &= ~PF_REPLAY_BAND;
  293. pPDev->fMode |= PF_ENUM_GRXTXT;
  294. PFDV->flFlags &= ~FDV_GRX_ON_TXT_BAND;
  295. PFDV->flFlags &= ~FDV_GRX_UNDER_TEXT;
  296. }
  297. if( PFDV->pPSHeader )
  298. {
  299. if (((PSHEAD*)(PFDV->pPSHeader))->ppPSGSort)
  300. {
  301. MemFree(((PSHEAD*)(PFDV->pPSHeader))->ppPSGSort);
  302. ((PSHEAD*)PFDV->pPSHeader)->ppPSGSort = NULL;
  303. }
  304. }
  305. return TRUE;
  306. }