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.

121 lines
3.2 KiB

  1. /**************************************************************************\
  2. *
  3. * Copyright (c) 1999 Microsoft Corporation
  4. *
  5. * Abstract:
  6. *
  7. * Font table and font loading operations
  8. *
  9. * Revision History:
  10. *
  11. * 23/06/1999 cameronb
  12. * Created it.
  13. *
  14. \**************************************************************************/
  15. #ifndef GP_FONT_TABLE_DEFINED
  16. #define GP_FONT_TABLE_DEFINED
  17. class GpFontFile;
  18. class GpFontFamily;
  19. class GpFontFamilyList;
  20. class FontFamily;
  21. /*********************************Class************************************\
  22. * class GpFontTable
  23. *
  24. * Font table for GpFontFile objects
  25. *
  26. * History:
  27. * 11/12/99 YungT modify it.
  28. * 23/06/1999 cameronb created it
  29. *
  30. \**************************************************************************/
  31. class GpFontTable
  32. {
  33. public:
  34. GpFontTable();
  35. ~GpFontTable();
  36. BOOL IsValid()
  37. {
  38. return (Table && EnumList);
  39. }
  40. BOOL UnloadFontFiles(GpFontFile* fontFile);
  41. GpStatus AddFontFile(const WCHAR* fileName, GpFontCollection *fontCollection);
  42. GpFontFile * AddFontFile(WCHAR* fileName);
  43. GpStatus AddFontMemImage(const BYTE* fontMemoryImage, INT fontImageSize,
  44. GpFontCollection *fontCollection);
  45. GpStatus RemoveFontFile(const WCHAR* filename);
  46. GpFontFamily* GetFontFamily(const WCHAR* familyName);
  47. GpFontFamily* GetAnyFamily();
  48. INT EnumerableFonts(GpGraphics* graphics = 0);
  49. GpStatus EnumerateFonts(INT numSought, GpFontFamily* gpfamilies[],
  50. INT& numFound, GpGraphics* graphics = 0);
  51. void LoadAllFonts(const WCHAR *familyName = NULL);
  52. GpFontFile* GetFontFile(const WCHAR* fileName) const;
  53. UINT GetNumFilesLoaded(void) const
  54. {
  55. return NumFilesLoaded;
  56. }
  57. BOOL IsPrivate()
  58. {
  59. return bPrivate;
  60. }
  61. void SetPrivate(BOOL bTable)
  62. {
  63. bPrivate = bTable;
  64. }
  65. BOOL IsFontLoaded()
  66. {
  67. return bFontFilesLoaded;
  68. }
  69. void SetFontFileLoaded(BOOL bLoaded)
  70. {
  71. bFontFilesLoaded = bLoaded;
  72. }
  73. private:
  74. UINT HashIt(const WCHAR* str) const;
  75. GpFontFile* GetFontFile(const WCHAR* fileName, UINT hash) const;
  76. void LoadAllFontsFromRegistry(BOOL bLoadFromRegistry);
  77. void LoadAllFontsFromCache(BOOL bLoadFromRegistry);
  78. void UpdateCacheFileFromFontTable(void);
  79. public:
  80. static ULONG MemImageUnique;
  81. // Data members
  82. private:
  83. UINT NumFilesLoaded; // Number of files loaded into Table
  84. UINT NumHashEntries; // Number of possible hash entries
  85. GpFontFile** Table; // The table
  86. GpFontFamilyList* EnumList; // Sorted enumeration list
  87. BOOL bPrivate; // indicate the files in table are private or public
  88. BOOL bFontFilesLoaded; // indicacte the font file loaded
  89. };
  90. inline ULONG GetNewMemImageUniqueness(ULONG &ulUnique)
  91. {
  92. InterlockedIncrement((LPLONG)&ulUnique);
  93. return ulUnique;
  94. }
  95. #endif