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.

151 lines
3.5 KiB

  1. #ifndef FONT_FILE_DEFINED
  2. #define FONT_FILE_DEFINED
  3. class GpFontTable;
  4. class CacheFaceRealization;
  5. class GpFontFile
  6. {
  7. public:
  8. GpFontFile() : Next(NULL), Prev(NULL), FamilyName(NULL) {}
  9. ~GpFontFile() {}
  10. public:
  11. GpFontFile* GetNext(void) const
  12. {
  13. return Next;
  14. }
  15. GpFontFile* GetPrev(void) const
  16. {
  17. return Prev;
  18. }
  19. void SetNext(GpFontFile* ff)
  20. {
  21. Next = ff;
  22. }
  23. void SetPrev(GpFontFile* ff)
  24. {
  25. Prev = ff;
  26. }
  27. void AllocateNameHolders(WCHAR** hFamilyName, int numFonts)
  28. {
  29. FamilyName = hFamilyName;
  30. // Initialize each name to NULL
  31. for (INT n = 0; n < numFonts; n++)
  32. {
  33. FamilyName[n] = NULL;
  34. }
  35. }
  36. const WCHAR* GetFamilyName(int i) const
  37. {
  38. return FamilyName[i];
  39. }
  40. void SetFamilyName(int i, WCHAR* name)
  41. {
  42. FamilyName[i] = name;
  43. }
  44. const WCHAR* GetPathName(void) const
  45. {
  46. return pwszPathname_;
  47. }
  48. const UINT GetPathNameSize(void) const
  49. {
  50. return cwc;
  51. }
  52. void SetPathName(WCHAR* name)
  53. {
  54. pwszPathname_ = name;
  55. }
  56. BOOL operator== (GpFontFile const& ff) const
  57. {
  58. if (this == &ff)
  59. return TRUE;
  60. return (wcscmp(pwszPathname_, ff.pwszPathname_) == 0);
  61. }
  62. ULONG GetNumEntries(void) const
  63. {
  64. return cFonts;
  65. }
  66. GpFontFace* GetFontFace(ULONG iFont)
  67. {
  68. return( &(((GpFontFace*)(&aulData))[iFont]) );
  69. }
  70. FONTFILEVIEW * GetFileView() const
  71. {
  72. return pfv;
  73. }
  74. // Data members
  75. public:
  76. ULONG SizeOfThis;
  77. private:
  78. // Connects GpFontFile's sharing the same hash bucket
  79. GpFontFile* Next;
  80. GpFontFile* Prev;
  81. WCHAR** FamilyName; // Array of family name in this font file
  82. public:
  83. // pwszPathname_ points to the Unicode upper case path
  84. // name of the associated font file which is stored at the
  85. // end of the data structure.
  86. WCHAR * pwszPathname_;
  87. ULONG cwc; // total for all strings
  88. // state
  89. FLONG flState; // state (ready to die?)
  90. ULONG cLoaded; // load count
  91. ULONG cRealizedFace; // total number of RealizedFaces
  92. ULONG bRemoved; // TRUE if the font file has been removed
  93. // (RemoveFontFile() )
  94. // CacheFaceRealization list
  95. CacheFaceRealization *prfaceList; // pointer to head of doubly linked list
  96. // driver information
  97. ULONG_PTR hff; // font driver handle to font file, RETURNED by DrvLoadGpFontFile
  98. // fonts in this file (and filename slimed in)
  99. ULONG cFonts; // number of fonts (same as chpfe)
  100. FONTFILEVIEW *pfv; // address of FILEVIEW structure, passed to DrvLoadFontFile
  101. ULONG_PTR aulData[1]; // data buffer for HFontEntry and filename
  102. };
  103. GpFontFile *LoadFontInternal(WCHAR *pwszName, ULONG cwc, FONTFILEVIEW *pffv, BOOL bMem);
  104. GpFontFile *LoadFontFile(WCHAR * pwszFontFileName);
  105. GpFontFile *LoadFontMemImage(WCHAR* fontImageName, BYTE* fontMemoryImage, INT fontImageSize);
  106. VOID UnloadFontFile(GpFontFile *pFontFile);
  107. BOOL MakePathName(WCHAR *dst, WCHAR *src);
  108. #endif