76 return font !=
_fonts.end();
84 std::pair<FontMap::iterator, bool> result =
_fonts.insert(std::make_pair(name, managedFont.
get()));
89 FontMap::iterator fontIterator = result.first;
95 return get(
_format, name, height);
104 FontMap::iterator font =
_fonts.find(indexName);
105 if (font ==
_fonts.end()) {
106 std::pair<FontMap::iterator, bool> result;
110 result =
_fonts.insert(std::make_pair(indexName, f));
129 std::map<Common::UString, Common::UString>::iterator realName =
_aliases.find(name);
131 return realName->second;
154 font.
_it->second->referenceCount++;
161 if (--font.
_it->second->referenceCount == 0)
190 e.
add(
"Failed to create font \"%s\" (%d)", name.
c_str(), format);
static ManagedFont * createFont(FontFormat format, const Common::UString &name, int height)
SeekableReadStream * getSystemFontMono()
Return a stream of the monospaced system font TTF.
ABC/SBM font, used by Jade Empire.
A managed font, storing how often it's referenced.
void add(const char *s,...) GCC_PRINTF(2
void erase(typename std::map< Key, T *, Compare >::iterator position)
NFTR font, used by Sonic.
A class holding an UTF-8 string.
PointerType release()
Returns the plain pointer value and releases ScopedPtr.
FontHandle getIfExist(const Common::UString &name, int height=0)
Retrieve this named font, returning an empty handle if it's not managed.
std::map< Common::UString, Common::UString > _aliases
A texture font, as used by NWN and KotOR/KotOR2.
Exception that provides a stack of explanations.
bool hasFont(const Common::UString &name, int height=0)
Does this named managed font exist?
A simple scoped smart pointer template.
An ABC/SBM font, as used by Jade Empire.
Basic exceptions to throw.
const char * c_str() const
Return the (utf8 encoded) string data.
static UString format(const char *s,...) GCC_PRINTF(1
Print formatted data into an UString object, similar to sprintf().
FontFormat
The format of a font.
#define DECLARE_SINGLETON(T)
Note that you need to use this macro from the global namespace.
void addAlias(const Common::UString &alias, const Common::UString &realName)
Add an alias for a specific font name.
const char * kSystemFontMono
Identifier used for the monospaced system font.
void release(FontHandle &handle)
Nintendo's NFTR font, found in Sonic.
Common::UString getIndexName(Common::UString name, int height)
A scoped plain pointer, allowing pointer-y access and normal deletion.
void clear()
Remove and delete all managed fonts.
void assign(FontHandle &font, const FontHandle &from)
Convenience class that locks a mutex on creation and unlocks it on destruction.
FontHandle get(FontFormat format, const Common::UString &name, int height=0)
Retrieve this named font in this format, loading it if it's not yet managed.
Textured font, used by NWN and KotOR/KotOR2.
The global Aurora font manager.
Common::UString getAliasName(const Common::UString &name)
PointerType get() const
Returns the plain pointer value.
void setFormat(FontFormat format)
Load fonts in this format by default.
FontHandle add(Font *font, const Common::UString &name)
Add this font to the FontManager.
A texture font, as used by NWN and KotOR/KotOR2.
An ABC/SBM font, as used by Jade Empire.