#pragma once #include #include class Font; struct FontSelector { String family; String weight; bool operator==(const FontSelector& other) const { return family == other.family && weight == other.weight; } }; namespace AK { template<> struct Traits : public GenericTraits { static unsigned hash(const FontSelector& key) { return pair_int_hash(key.family.hash(), key.weight.hash()); } }; } class FontCache { public: static FontCache& the(); RefPtr get(const FontSelector&) const; void set(const FontSelector&, NonnullRefPtr); private: FontCache() {} mutable HashMap> m_fonts; };