+FontId DefaultFonts::FindFont( TextAbstraction::FontClient& fontClient,
+ const TextAbstraction::FontDescription& description,
+ PointSize26Dot6 size ) const
+{
+ for( std::vector<CacheItem>::const_iterator it = mFonts.begin(),
+ endIt = mFonts.end();
+ it != endIt;
+ ++it )
+ {
+ const CacheItem& item = *it;
+
+ if( ( ( TextAbstraction::FontWeight::NONE == description.weight ) || ( description.weight == item.description.weight ) ) &&
+ ( ( TextAbstraction::FontWidth::NONE == description.width ) || ( description.width == item.description.width ) ) &&
+ ( ( TextAbstraction::FontSlant::NONE == description.slant ) || ( description.slant == item.description.slant ) ) &&
+ ( size == fontClient.GetPointSize( item.fontId ) ) &&
+ ( description.family.empty() || ( description.family == item.description.family ) ) )
+ {
+ return item.fontId;
+ }
+ }
+
+ return 0u;
+}
+
+void DefaultFonts::Cache( const TextAbstraction::FontDescription& description, FontId fontId )
+{
+ CacheItem item;
+ item.description = description;
+ item.fontId = fontId;
+ mFonts.push_back( item );
+}
+