Skip to content

Commit

Permalink
GRAPHICS: Add back support for TTF fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Mar 21, 2014
1 parent a02445d commit a5910a7
Show file tree
Hide file tree
Showing 7 changed files with 770 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/graphics/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ noinst_HEADERS = \
cursorman.h \
cameraman.h \
renderable.h \
ttf.h \
font.h \
guiman.h \
$(EMPTY)
Expand All @@ -36,6 +37,7 @@ libgraphics_la_SOURCES = \
cursorman.cpp \
cameraman.cpp \
renderable.cpp \
ttf.cpp \
font.cpp \
guiman.cpp \
$(EMPTY)
Expand Down
2 changes: 2 additions & 0 deletions src/graphics/aurora/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ noinst_HEADERS = \
model_kotor.h \
model_witcher.h \
texturefont.h \
ttffont.h \
fontman.h \
text.h \
$(EMPTY)
Expand All @@ -27,6 +28,7 @@ libaurora_la_SOURCES = \
model_kotor.cpp \
model_witcher.cpp \
texturefont.cpp \
ttffont.cpp \
fontman.cpp \
text.cpp \
$(EMPTY)
6 changes: 6 additions & 0 deletions src/graphics/aurora/fontman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include "graphics/aurora/fontman.h"
#include "graphics/aurora/texturefont.h"
#include "graphics/aurora/ttffont.h"

DECLARE_SINGLETON(Graphics::Aurora::FontManager)

Expand Down Expand Up @@ -179,11 +180,16 @@ void FontManager::release(FontHandle &handle) {
ManagedFont *FontManager::createFont(FontFormat format,
const Common::UString &name, int height) {

if (name == kSystemFontMono)
return new ManagedFont(new TTFFont(Common::getSystemFontMono(), height));

if (format == kFontFormatUnknown)
throw Common::Exception("Font format unknown (%s)", name.c_str());

if (format == kFontFormatTexture)
return new ManagedFont(new TextureFont(name));
if (format == kFontFormatTTF)
return new ManagedFont(new TTFFont(name, height));

throw Common::Exception("Invalid font format %d (%s)", format, name.c_str());
return 0;
Expand Down

0 comments on commit a5910a7

Please sign in to comment.