1/* 2 * Copyright 2007, Haiku. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan A��mus <superstippi@gmx.de> 7 */ 8 9#ifndef FONT_CACHE_H 10#define FONT_CACHE_H 11 12#include "FontCacheEntry.h" 13#include "HashMap.h" 14#include "HashString.h" 15#include "MultiLocker.h" 16#include "ServerFont.h" 17 18 19class FontCache : public MultiLocker { 20 public: 21 FontCache(); 22 virtual ~FontCache(); 23 24 // global instance 25 static FontCache* Default(); 26 27 FontCacheEntry* FontCacheEntryFor(const ServerFont& font, 28 bool forceVector); 29 void Recycle(FontCacheEntry* entry); 30 31 private: 32 void _ConstrainEntryCount(); 33 34 static FontCache sDefaultInstance; 35 36 typedef HashMap<HashString, BReference<FontCacheEntry> > FontMap; 37 38 FontMap fFontCacheEntries; 39}; 40 41#endif // FONT_CACHE_H 42