1 /* 2 * PROJECT: ReactOS Font Shell Extension 3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) 4 * PURPOSE: font list cache handling 5 * COPYRIGHT: Copyright 2019-2021 Mark Jansen <mark.jansen@reactos.org> 6 */ 7 8 #pragma once 9 10 11 class CFontInfo 12 { 13 private: 14 CStringW m_Name; 15 CStringW m_File; 16 bool m_FileRead; 17 18 bool m_AttrsRead; 19 LARGE_INTEGER m_FileSize; 20 FILETIME m_FileWriteTime; 21 DWORD m_dwFileAttributes; 22 23 void ReadAttrs(); 24 25 public: 26 CFontInfo(LPCWSTR name = L""); 27 28 const CStringW& Name() const; // Font display name stored in the registry 29 const bool Valid() const; 30 31 const CStringW& File(); // Full path or file, depending on how it's stored in the registry 32 const LARGE_INTEGER& FileSize(); 33 const FILETIME& FileWriteTime(); 34 DWORD FileAttributes(); 35 }; 36 37 38 class CFontCache 39 { 40 private: 41 CAtlArray<CFontInfo> m_Fonts; 42 CStringW m_FontFolderPath; 43 44 protected: 45 CFontCache(); 46 47 void Insert(CAtlList<CFontInfo>& fonts, const CStringW& KeyName); 48 void Read(); 49 50 public: 51 void SetFontDir(const LPCWSTR Path); 52 const CStringW& FontPath() const { return m_FontFolderPath; } 53 54 size_t Size(); 55 CStringW Name(size_t Index); // Font display name stored in the registry 56 57 CFontInfo* Find(const FontPidlEntry* fontEntry); 58 CStringW Filename(CFontInfo* info, bool alwaysFullPath = false); 59 60 friend class CFontExtModule; 61 }; 62 63 64 extern CFontCache* g_FontCache; 65 66 67