2002-11-16 08:07:38 +00:00
|
|
|
#ifndef FONTMANAGER_H
|
|
|
|
|
#define FONTMANAGER_H
|
2002-03-30 20:00:13 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: FontManager
|
|
|
|
|
|
|
|
|
|
Desc: Manages Loading and Unloading of fonts.
|
|
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
2002-03-30 20:00:13 +00:00
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
2003-01-07 03:04:32 +00:00
|
|
|
#include "RageUtil.h"
|
2003-01-06 02:50:25 +00:00
|
|
|
#include "Game.h"
|
2002-03-30 20:00:13 +00:00
|
|
|
|
2002-09-07 08:20:10 +00:00
|
|
|
#include <map>
|
2003-01-07 03:04:32 +00:00
|
|
|
class Font;
|
2002-03-30 20:00:13 +00:00
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
// FontManager Class Declarations
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
class FontManager
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FontManager();
|
|
|
|
|
~FontManager();
|
|
|
|
|
|
2003-01-05 03:32:41 +00:00
|
|
|
Font* LoadFont( const CString &sFontOrTextureFilePath, CString sChars = "" );
|
2003-01-04 05:20:40 +00:00
|
|
|
void UnloadFont( Font *fp );
|
2003-01-11 03:57:56 +00:00
|
|
|
|
|
|
|
|
/* Warning: This reloads fonts completely, so all BitmapTexts need to be
|
|
|
|
|
* reset, too. If this isn't done, best case they end up with old font
|
|
|
|
|
* metrics; worst case, they get left with stale pointers to RageTextures
|
|
|
|
|
* that'll get freed eventually and crash. This is only used for realtime
|
|
|
|
|
* adjustment of fonts in ScreenTestFonts at the moment. */
|
2003-01-10 02:02:51 +00:00
|
|
|
void ReloadFonts();
|
2002-03-30 20:00:13 +00:00
|
|
|
|
2003-01-28 00:45:01 +00:00
|
|
|
static longchar MakeGameGlyph(wchar_t c, Game g);
|
|
|
|
|
static bool ExtractGameGlyph(longchar ch, wchar_t &c, Game &g);
|
2003-01-06 02:50:25 +00:00
|
|
|
|
2002-03-30 20:00:13 +00:00
|
|
|
protected:
|
|
|
|
|
// map from file name to a texture holder
|
2003-01-04 05:20:40 +00:00
|
|
|
map<CString, Font*> m_mapPathToFont;
|
2002-03-30 20:00:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern FontManager* FONT; // global and accessable from anywhere in our program
|
|
|
|
|
|
2002-11-16 08:07:38 +00:00
|
|
|
|
|
|
|
|
#endif
|