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.

139 lines
3.1 KiB

  1. /*++
  2. Copyright (c) 1996 - 1999 Microsoft Corporation
  3. Module Name:
  4. fntmanag.c
  5. Abstract:
  6. Routine to handle EXTENDEDTEXTMETRICS.
  7. Environment:
  8. Windows NT Unidrv driver.
  9. Revision History:
  10. 12/30/96 -ganeshp-
  11. Created
  12. --*/
  13. #include "font.h"
  14. ULONG
  15. FMFontManagement(
  16. SURFOBJ *pso,
  17. FONTOBJ *pfo,
  18. ULONG iMode,
  19. ULONG cjIn,
  20. PVOID pvIn,
  21. ULONG cjOut,
  22. PVOID pvOut
  23. )
  24. /*++
  25. Routine Description:
  26. This routine is here to provide support for EXTTEXTMETRICS.
  27. Arguments:
  28. pso SURFOBJ of interest.
  29. pfo FONTOBJ whose EXTTEXTMETRICS is required.
  30. iMode Specifies the escape number to be perfomed. This must either
  31. be equal to QUERYESCSUPPORT, or in the range 0x100 through 0x3FE.
  32. cjIn Specifies the size, in bytes, of the buffer pointed to by pvIn.
  33. pvIn Points to an input buffer. If the iMode parameter is
  34. QUERYESCSUPPORT, pvIn points to a ULONG value in the range 0x100
  35. through 0x3FE.
  36. cjOut Specifies the size, in bytes, of the output buffer.
  37. pvOut Points to the output data buffer.
  38. Return Value:
  39. The return value is a value in the range 0x00000001, if the function is
  40. successful. If the escape is not implemented, the return value is zero.
  41. If the function fails, the return value is 0xFFFFFFFF.
  42. Note:
  43. 12-30-96: Created it -ganeshp-
  44. --*/
  45. {
  46. EXTTEXTMETRIC *pETM;
  47. // unlike the PSCRIPT equivilent this routine only handles GETEXTENDEDTEXTMETRICS
  48. if( iMode == QUERYESCSUPPORT )
  49. {
  50. return ( *((PULONG)pvIn) == GETEXTENDEDTEXTMETRICS ) ? 1 : 0;
  51. }
  52. else
  53. if( iMode == GETEXTENDEDTEXTMETRICS )
  54. {
  55. PDEV *pPDev = ((PDEV *)pso->dhpdev);
  56. INT iFace = pfo->iFace;
  57. FONTMAP *pFM; /* Details of the particular font */
  58. if( !VALID_PDEV(pPDev) && !VALID_FONTPDEV(PFDV) )
  59. {
  60. ERR(( "UniFont!DrvFntManagement: Invalid PDEV\n" ));
  61. SetLastError( ERROR_INVALID_PARAMETER );
  62. return (ULONG)-1;
  63. }
  64. if( iFace < 1 || ((int)iFace > pPDev->iFonts) )
  65. {
  66. ERR(( "UniFont!DrvFntManagement: Illegal value for iFace (%ld)", iFace ));
  67. SetLastError( ERROR_INVALID_PARAMETER );
  68. return (ULONG)-1;
  69. }
  70. if (NULL == (pFM = PfmGetDevicePFM( pPDev, iFace )))
  71. {
  72. ERR(( "UniFont!DrvFntManagement: PfmGetDevicePFM failed.\n" ));
  73. return -1;
  74. }
  75. //
  76. // Get pETM pointer.
  77. // Make sure that pFM is a device font's and pSubFM is valid.
  78. //
  79. if (FMTYPE_DEVICE == pFM->dwFontType &&
  80. NULL != pFM->pSubFM )
  81. {
  82. pETM = ((PFONTMAP_DEV)pFM->pSubFM)->pETM;
  83. }
  84. else
  85. {
  86. pETM = NULL;
  87. }
  88. if( ( pFM == NULL ) || ( pETM == NULL ) )
  89. {
  90. return 0;
  91. }
  92. *((EXTTEXTMETRIC *)pvOut) = *pETM;
  93. return 1;
  94. }
  95. return(0);
  96. }