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.

124 lines
3.0 KiB

  1. /**************************************************************************\
  2. *
  3. * Copyright (c) 2000 Microsoft Corporation
  4. *
  5. * Abstract:
  6. *
  7. * Font linking class definition
  8. *
  9. * Revision History:
  10. *
  11. * 3/03/2000 Tarek Mahmoud Sayed
  12. * Created it.
  13. *
  14. \**************************************************************************/
  15. #ifndef GP_FONT_LINKING_HPP
  16. #define GP_FONT_LINKING_HPP
  17. struct AssociatedFamilies
  18. {
  19. GpFontFamily *family;
  20. AssociatedFamilies *next;
  21. };
  22. struct FontLinkingFamily
  23. {
  24. GpFontFamily *family;
  25. AssociatedFamilies *associatedFamilies;
  26. FontLinkingFamily *next;
  27. };
  28. struct EUDCMAP
  29. {
  30. GpFontFamily *inputFamily;
  31. GpFontFamily *eudcFamily;
  32. EUDCMAP *next;
  33. };
  34. struct EUDC
  35. {
  36. GpFontFamily *defaultFamily;
  37. EUDCMAP *eudcMapList;
  38. };
  39. struct PrivateLoadedFonts
  40. {
  41. GpPrivateFontCollection *fontCollection;
  42. WCHAR FileName[MAX_PATH];
  43. PrivateLoadedFonts *next;
  44. };
  45. struct FontSubstitutionEntry
  46. {
  47. WCHAR familyName[MAX_PATH];
  48. INT familyNameLength;
  49. GpFontFamily *family;
  50. };
  51. // definition of the Font linking class. it has an global object defined in the Global name space
  52. // and created in the Font fallback class exist on the \Text\Uniscribe\shaping folder.
  53. class GpFontLink
  54. {
  55. public:
  56. GpFontLink();
  57. ~GpFontLink();
  58. AssociatedFamilies* GetLinkedFonts(const GpFontFamily *family);
  59. GpFontFamily *GetDefaultEUDCFamily();
  60. GpFontFamily *GetMappedEUDCFamily(const GpFontFamily *family);
  61. GpFontFamily *GetFamilySubstitution(const WCHAR* familyName) const;
  62. const AssociatedFamilies *GetDefaultFamily();
  63. private:
  64. void GetFontLinkingDataFromRegistryW();
  65. void GetEudcDataFromTheRegistryW();
  66. void GetEudcDataFromTheRegistryA();
  67. GpFontFamily* CheckAndLoadTheFile(WCHAR *fileName);
  68. void CacheFontSubstitutionDataW();
  69. void CacheFontSubstitutionDataA();
  70. private:
  71. FontLinkingFamily *linkedFonts;
  72. EUDC *eudcCache;
  73. PrivateLoadedFonts *privateFonts;
  74. FontSubstitutionEntry *FontSubstitutionTable;
  75. INT substitutionCount;
  76. AssociatedFamilies *DefaultFamily;
  77. AssociatedFamilies DefaultFamilyBuffer; // buffer for self-created linking font
  78. };
  79. // wrapper function to get the substitution Family from the FontLinkTable
  80. // but first it make sure that the FontLinkTable is created.
  81. inline void GetFamilySubstitution(const WCHAR* familyName, GpFontFamily **Family)
  82. {
  83. if (Globals::FontLinkTable == NULL)
  84. {
  85. // All APIs are bounded by critical section. we are sure we will not have
  86. // multithreading problem.
  87. Globals::FontLinkTable = new GpFontLink;
  88. }
  89. if (Globals::FontLinkTable != NULL)
  90. {
  91. *Family = Globals::FontLinkTable->GetFamilySubstitution(familyName);
  92. }
  93. return;
  94. }
  95. #endif // GP_FONT_LINKING_HPP