57 lines
1.1 KiB
C++
57 lines
1.1 KiB
C++
/* -----------------------------------------------------------------------------
|
|
GSFramework
|
|
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
|
------------------------------------------------------------------------------*/
|
|
|
|
|
|
#ifndef __FONTCACHE__
|
|
#define __FONTCACHE__
|
|
|
|
|
|
#include "font/font_factory.h"
|
|
#include "font/font_extended.h"
|
|
#include "memory/nauto_ptr.h"
|
|
#include "memory/nweak_ptr.h"
|
|
#include "container/nlist.h"
|
|
|
|
|
|
namespace GS {
|
|
|
|
/// Extended font alias.
|
|
struct FontAlias
|
|
{
|
|
String alias;
|
|
sFontEx font;
|
|
};
|
|
|
|
/*
|
|
@short Font cache.
|
|
@author Emmanuel Julien (ejulien@nworks.fr)
|
|
*/
|
|
class FontCache : public SharedObject
|
|
{
|
|
AutoList <FontAlias *> font_aliases;
|
|
AutoPtr <IFontFactory> font_factory;
|
|
|
|
public:
|
|
|
|
FontEx *GetFont(const char *) const;
|
|
FontAlias *GetAlias(const char *) const;
|
|
FontEx *GetAliasedFont(const char *) const;
|
|
|
|
FontEx *LoadFont(const char *, const char *alias = 0);
|
|
|
|
void DeleteAlias(const char *);
|
|
void DeleteAllFont();
|
|
|
|
FontCache(IFontFactory *factory) : font_factory(factory) {}
|
|
~FontCache();
|
|
};
|
|
|
|
typedef SharedPtr <FontCache> sFontCache;
|
|
|
|
} // GS
|
|
|
|
|
|
#endif // __FONTCACHE__
|