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.

62 lines
2.2 KiB

  1. #ifndef _INC_FONTEXT_FONTFILE
  2. #define _INC_FONTEXT_FONTFILE
  3. class CFontFileIo;
  4. //
  5. // This class provides an abstraction that hides the differences required to read
  6. // compressed and non-compressed font files. The font folder was originally written
  7. // to use the LZ APIs provided in LZ32.DLL for all reading of font files. These
  8. // APIs work with compressed and non-compressed files. The problems is that the
  9. // APIs are very old and are based on the OpenFile API and DOS file handles. This
  10. // means they're not UNICODE aware and have a maximum path length of 128 characters.
  11. // So, even though compressed font files are rare today, all font files are
  12. // subject to these limitations in the font folder. The LZ APIs are considered
  13. // legacy code and are not going to be being modified.
  14. //
  15. // Since we can't modify the LZ APIs I decided to create this CFontFile class
  16. // which defers the IO functionality to a properly-typed subclass. Non-compressed
  17. // files are handled with Win32 functions (i.e. CreateFile, ReadFile etc).
  18. // Compressed files are handled with LZ functions (i.e. LZOpenFile, LZRead etc).
  19. // This means that the UNICODE and path length restrictions only affect compressed
  20. // files and that non-compressed files (the vast majority today) are unaffected.
  21. //
  22. // brianau [3/1/99]
  23. //
  24. class CFontFile
  25. {
  26. public:
  27. CFontFile(void)
  28. : m_pImpl(NULL) { }
  29. ~CFontFile(void);
  30. DWORD Open(LPCTSTR pszPath, DWORD dwAccess, DWORD dwShareMode, bool bCreate = false);
  31. void Close(void);
  32. DWORD Read(LPVOID pbDest, DWORD cbDest, LPDWORD pcbRead = NULL);
  33. DWORD Seek(UINT uDistance, DWORD dwMethod);
  34. DWORD Reset(void)
  35. { return Seek(0, FILE_BEGIN); }
  36. DWORD GetExpandedName(LPCTSTR pszFile, LPTSTR pszDest, UINT cchDest);
  37. DWORD CopyTo(LPCTSTR pszTo);
  38. private:
  39. CFontFileIo *m_pImpl; // Properly-typed implementation.
  40. bool IsCompressed(void);
  41. //
  42. // Prevent copy.
  43. //
  44. CFontFile(const CFontFile& rhs);
  45. CFontFile& operator = (const CFontFile& rhs);
  46. };
  47. #endif // _INC_FONTEXT_FONTFILE