#ifndef FontCache_h
#define FontCache_h
#include <limits.h>
#include <wtf/Vector.h>
#include <wtf/unicode/Unicode.h>
#if PLATFORM(WIN)
#include <objidl.h>
#include <mlang.h>
#endif
namespace WebCore
{
class AtomicString;
class Font;
class FontPlatformData;
class FontData;
class FontDescription;
class FontSelector;
class SimpleFontData;
class FontCache : public Noncopyable {
public:
friend FontCache* fontCache();
const FontData* getFontData(const Font&, int& familyIndex, FontSelector*);
void releaseFontData(const SimpleFontData*);
const SimpleFontData* getFontDataForCharacters(const Font&, const UChar* characters, int length);
void platformInit();
#if OS(WINCE) && !PLATFORM(QT)
#if defined(IMLANG_FONT_LINK) && (IMLANG_FONT_LINK == 2)
IMLangFontLink2* getFontLinkInterface();
#else
IMLangFontLink* getFontLinkInterface();
#endif
static void comInitialize();
static void comUninitialize();
#elif PLATFORM(WIN)
IMLangFontLink2* getFontLinkInterface();
#endif
void getTraitsInFamily(const AtomicString&, Vector<unsigned>&);
SimpleFontData* getCachedFontData(const FontDescription& fontDescription, const AtomicString& family, bool checkingAlternateName = false);
SimpleFontData* getLastResortFallbackFont(const FontDescription&);
void addClient(FontSelector*);
void removeClient(FontSelector*);
unsigned generation();
void invalidate();
size_t fontDataCount();
size_t inactiveFontDataCount();
void purgeInactiveFontData(int count = INT_MAX);
private:
FontCache();
~FontCache();
FontPlatformData* getCachedFontPlatformData(const FontDescription&, const AtomicString& family, bool checkingAlternateName = false);
SimpleFontData* getSimilarFontPlatformData(const Font&);
FontPlatformData* getCustomFallbackFont(const UInt32 c, const Font&);
FontPlatformData* createFontPlatformData(const FontDescription&, const AtomicString& family);
SimpleFontData* getCachedFontData(const FontPlatformData*);
friend class SimpleFontData; friend class FontFallbackList;
};
FontCache* fontCache();
}
#endif