FontManager Class Reference

#include <FontManager.h>

List of all members.

Public Member Functions

 FontManager (bool ttf_antialiasing)
 ~FontManager ()
Pentagram::FontgetGameFont (unsigned int fontnum, bool allowOverride=false)
Pentagram::FontgetTTFont (unsigned int ttfnum)
bool addTTFOverride (unsigned int fontnum, std::string filename, int pointsize, uint32 rgb, int bordersize, bool SJIS=false)
bool addJPOverride (unsigned int fontnum, unsigned int jpfont, uint32 rgb)
bool loadTTFont (unsigned int ttfnum, std::string filename, int pointsize, uint32 rgb, int bordersize)
void resetGameFonts ()

Static Public Member Functions

static FontManagerget_instance ()

Private Member Functions

TTF_FontgetTTF_Font (std::string filename, int pointsize)
void setOverride (unsigned int fontnum, Pentagram::Font *override)

Private Attributes

std::map< TTFId, TTF_Font * > ttf_fonts
bool ttf_antialiasing
std::vector< Pentagram::Font * > overrides
std::vector< Pentagram::Font * > ttfonts

Static Private Attributes

static FontManagerfontmanager = 0

Classes

struct  TTFId


Detailed Description

Definition at line 35 of file FontManager.h.


Constructor & Destructor Documentation

FontManager::FontManager ( bool  ttf_antialiasing  ) 

Definition at line 43 of file FontManager.cpp.

References con, fontmanager, SettingManager::get_instance(), MM_INFO, Console::Print(), and SettingManager::setDefault().

FontManager::~FontManager (  ) 

Definition at line 56 of file FontManager.cpp.

References con, fontmanager, MM_INFO, Console::Print(), resetGameFonts(), ttf_fonts, and ttfonts.


Member Function Documentation

bool FontManager::addJPOverride ( unsigned int  fontnum,
unsigned int  jpfont,
uint32  rgb 
)

override a game font with a Japanese font.

Parameters:
fontnum the font to override
jpfont the fontnum of the Japanese font to use
rgb the color to use

Definition at line 175 of file FontManager.cpp.

References PaletteManager::duplicate(), font, PaletteManager::get_instance(), GameData::get_instance(), FontShapeArchive::getFont(), GameData::getFonts(), PaletteManager::getPalette(), pal, PaletteManager::Pal_Game, PaletteManager::Pal_JPFontStart, pout, setOverride(), and PaletteManager::updatedFont().

Referenced by GameData::setupJPOverrides().

bool FontManager::addTTFOverride ( unsigned int  fontnum,
std::string  filename,
int  pointsize,
uint32  rgb,
int  bordersize,
bool  SJIS = false 
)

override a game font with a TTF.

Parameters:
fontnum the font to override
filename the filename of the TTF
pointsize the pointsize to use
rgb the color to use for the font
bordersize the size of the black border to add
SJIS true for a Japanese game font

Definition at line 152 of file FontManager.cpp.

References font, SettingManager::get(), SettingManager::get_instance(), getTTF_Font(), pout, setOverride(), and ttf_antialiasing.

Referenced by GameData::setupTTFOverrides().

static FontManager* FontManager::get_instance (  )  [inline, static]

Definition at line 41 of file FontManager.h.

References fontmanager.

Referenced by SliderGump::drawText(), TextWidget::getFont(), EditWidget::getFont(), PaperdollGump::PaintStat(), ShapeViewerGump::PaintThis(), GameWidget::PaintThis(), SKFPlayer::run(), CreditsGump::Run(), GameData::setupJPOverrides(), and GameData::setupTTFOverrides().

Pentagram::Font * FontManager::getGameFont ( unsigned int  fontnum,
bool  allowOverride = false 
)

get a Font by fontnum (for game fonts)

Parameters:
fontnum the number of the font
allowOverride if true, allow an override font to be used

Definition at line 85 of file FontManager.cpp.

References GameData::get_instance(), FontShapeArchive::getFont(), GameData::getFonts(), and overrides.

Referenced by SliderGump::drawText(), TextWidget::getFont(), EditWidget::getFont(), PaperdollGump::PaintStat(), ShapeViewerGump::PaintThis(), SKFPlayer::run(), and CreditsGump::Run().

TTF_Font * FontManager::getTTF_Font ( std::string  filename,
int  pointsize 
) [private]

Get a (possibly cached) TTF_Font structure for filename/pointsize, loading it if necessary.

Definition at line 102 of file FontManager.cpp.

References font, FileSystem::get_instance(), perr, pout, FileSystem::ReadFile(), and ttf_fonts.

Referenced by addTTFOverride(), and loadTTFont().

Pentagram::Font * FontManager::getTTFont ( unsigned int  ttfnum  ) 

get a TTF font (for non-game fonts)

Definition at line 94 of file FontManager.cpp.

References ttfonts.

Referenced by TextWidget::getFont(), EditWidget::getFont(), and GameWidget::PaintThis().

bool FontManager::loadTTFont ( unsigned int  ttfnum,
std::string  filename,
int  pointsize,
uint32  rgb,
int  bordersize 
)

load a TTF (for non-game fonts)

Definition at line 209 of file FontManager.cpp.

References font, SettingManager::get(), SettingManager::get_instance(), getTTF_Font(), ttf_antialiasing, and ttfonts.

Referenced by GUIApp::GraphicSysInit().

void FontManager::resetGameFonts (  ) 

Definition at line 78 of file FontManager.cpp.

References overrides.

Referenced by GUIApp::shutdownGame(), and ~FontManager().

void FontManager::setOverride ( unsigned int  fontnum,
Pentagram::Font override 
) [private]

Override fontnum with override.

Definition at line 140 of file FontManager.cpp.

References overrides.

Referenced by addJPOverride(), and addTTFOverride().


Member Data Documentation

FontManager * FontManager::fontmanager = 0 [static, private]

Definition at line 100 of file FontManager.h.

Referenced by FontManager(), get_instance(), and ~FontManager().

std::vector<Pentagram::Font*> FontManager::overrides [private]

Definition at line 96 of file FontManager.h.

Referenced by getGameFont(), resetGameFonts(), and setOverride().

bool FontManager::ttf_antialiasing [private]

Definition at line 87 of file FontManager.h.

Referenced by addTTFOverride(), and loadTTFont().

std::map<TTFId, TTF_Font*> FontManager::ttf_fonts [private]

Definition at line 86 of file FontManager.h.

Referenced by getTTF_Font(), and ~FontManager().

std::vector<Pentagram::Font*> FontManager::ttfonts [private]

Definition at line 98 of file FontManager.h.

Referenced by getTTFont(), loadTTFont(), and ~FontManager().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:29:14 2007 for pentagram by  doxygen 1.4.7