Skip to content

Commit

Permalink
GRAPHICS: Get rid of kSODFont (ScummFont)
Browse files Browse the repository at this point in the history
OSD is now using the kGUIFont instead. The main advantage is that
the kGUIFont can be used for translated text while only ASCII
characters were present in ScummFont.
  • Loading branch information
criezy committed Jun 6, 2011
1 parent 72080d8 commit 592cca5
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 341 deletions.
4 changes: 2 additions & 2 deletions audio/softsynth/mt32.cpp
Expand Up @@ -135,7 +135,7 @@ static int eatSystemEvents() {
}

static void drawProgress(float progress) {
const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kOSDFont));
const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kGUIFont));
Graphics::Surface *screen = g_system->lockScreen();

assert(screen);
Expand Down Expand Up @@ -174,7 +174,7 @@ static void drawProgress(float progress) {
}

static void drawMessage(int offset, const Common::String &text) {
const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kOSDFont));
const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kGUIFont));
Graphics::Surface *screen = g_system->lockScreen();

assert(screen);
Expand Down
2 changes: 1 addition & 1 deletion backends/graphics/opengl/opengl-graphics.cpp
Expand Up @@ -1385,7 +1385,7 @@ const char *OpenGLGraphicsManager::getCurrentModeName() {
#ifdef USE_OSD
void OpenGLGraphicsManager::updateOSD() {
// The font we are going to use:
const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kOSDFont);
const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);

if (_osdSurface.w != _osdTexture->getWidth() || _osdSurface.h != _osdTexture->getHeight())
_osdSurface.create(_osdTexture->getWidth(), _osdTexture->getHeight(), _overlayFormat);
Expand Down
2 changes: 1 addition & 1 deletion backends/graphics/sdl/sdl-graphics.cpp
Expand Up @@ -2060,7 +2060,7 @@ void SdlGraphicsManager::displayMessageOnOSD(const char *msg) {
_osdSurface->format->Bshift, _osdSurface->format->Ashift);

// The font we are going to use:
const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kOSDFont);
const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);

// Clear everything with the "transparent" color, i.e. the colorkey
SDL_FillRect(_osdSurface, 0, kOSDColorKey);
Expand Down
12 changes: 0 additions & 12 deletions graphics/font.h
Expand Up @@ -114,18 +114,6 @@ class Font {
int wordWrapText(const Common::String &str, int maxWidth, Common::Array<Common::String> &lines) const;
};

/**
* A SCUMM style font.
*/
class ScummFont : public Font {
public:
virtual int getFontHeight() const { return 8; }
virtual int getMaxCharWidth() const { return 8; }

virtual int getCharWidth(byte chr) const;
virtual void drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const;
};

typedef uint16 bitmap_t; /* bitmap image unit size*/

struct BBX {
Expand Down
13 changes: 3 additions & 10 deletions graphics/fontman.cpp
Expand Up @@ -26,26 +26,22 @@ DECLARE_SINGLETON(Graphics::FontManager);

namespace Graphics {

const ScummFont *g_scummfont = 0;
FORWARD_DECLARE_FONT(g_sysfont);
FORWARD_DECLARE_FONT(g_sysfont_big);
FORWARD_DECLARE_FONT(g_consolefont);

FontManager::FontManager() {
// This assert should *never* trigger, because
// FontManager is a singleton, thus there is only
// one instance of it per time. (g_scummfont gets
// one instance of it per time. (g_sysfont gets
// reset to 0 in the desctructor of this class).
assert(g_scummfont == 0);
g_scummfont = new ScummFont;
assert(g_sysfont == 0);
INIT_FONT(g_sysfont);
INIT_FONT(g_sysfont_big);
INIT_FONT(g_consolefont);
}

FontManager::~FontManager() {
delete g_scummfont;
g_scummfont = 0;
delete g_sysfont;
g_sysfont = 0;
delete g_sysfont_big;
Expand All @@ -58,7 +54,6 @@ const struct {
const char *name;
FontManager::FontUsage id;
} builtinFontNames[] = {
{ "builtinOSD", FontManager::kOSDFont },
{ "builtinConsole", FontManager::kConsoleFont },
{ "fixed5x8.bdf", FontManager::kConsoleFont },
{ "fixed5x8-iso-8859-1.bdf", FontManager::kConsoleFont },
Expand All @@ -69,7 +64,7 @@ const struct {
{ "helvB12.bdf", FontManager::kBigGUIFont },
{ "helvB12-iso-8859-1.bdf", FontManager::kBigGUIFont },
{ "helvB12-ascii.bdf", FontManager::kBigGUIFont },
{ 0, FontManager::kOSDFont }
{ 0, FontManager::kConsoleFont }
};

const Font *FontManager::getFontByName(const Common::String &name) const {
Expand All @@ -84,8 +79,6 @@ const Font *FontManager::getFontByName(const Common::String &name) const {

const Font *FontManager::getFontByUsage(FontUsage usage) const {
switch (usage) {
case kOSDFont:
return g_scummfont;
case kConsoleFont:
return g_consolefont;
case kGUIFont:
Expand Down
1 change: 0 additions & 1 deletion graphics/fontman.h
Expand Up @@ -36,7 +36,6 @@ class Font;
class FontManager : public Common::Singleton<FontManager> {
public:
enum FontUsage {
kOSDFont = 0,
kConsoleFont = 1,
kGUIFont = 2,
kBigGUIFont = 3
Expand Down

0 comments on commit 592cca5

Please sign in to comment.