#include <FontManager.h>
Public Member Functions | |
FontManager (bool ttf_antialiasing) | |
~FontManager () | |
Pentagram::Font * | getGameFont (unsigned int fontnum, bool allowOverride=false) |
Pentagram::Font * | getTTFont (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 FontManager * | get_instance () |
Private Member Functions | |
TTF_Font * | getTTF_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 FontManager * | fontmanager = 0 |
Classes | |
struct | TTFId |
Definition at line 35 of file FontManager.h.
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.
bool FontManager::addJPOverride | ( | unsigned int | fontnum, | |
unsigned int | jpfont, | |||
uint32 | rgb | |||
) |
override a game font with a Japanese font.
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.
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)
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().
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] |
std::map<TTFId, TTF_Font*> FontManager::ttf_fonts [private] |
std::vector<Pentagram::Font*> FontManager::ttfonts [private] |
Definition at line 98 of file FontManager.h.
Referenced by getTTFont(), loadTTFont(), and ~FontManager().