From 9d72d6007e10ebdfcede91e03385eb486f452a7c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 27 Oct 2018 22:32:56 -0700 Subject: GLK: Move font method stubs from Screen to Fonts --- engines/gargoyle/fonts.cpp | 21 ++++++++++++++++++++- engines/gargoyle/fonts.h | 19 ++++++++++--------- engines/gargoyle/screen.cpp | 20 -------------------- engines/gargoyle/screen.h | 15 ++++++--------- 4 files changed, 36 insertions(+), 39 deletions(-) diff --git a/engines/gargoyle/fonts.cpp b/engines/gargoyle/fonts.cpp index 41067a5185..41b2f655ff 100644 --- a/engines/gargoyle/fonts.cpp +++ b/engines/gargoyle/fonts.cpp @@ -50,7 +50,7 @@ const double gli_conf_monosize = 12.5; ///< good size for LiberationMono const double gli_conf_propsize = 15.5; ///< good size for Libertine #endif -Fonts::Fonts() { +Fonts::Fonts(Graphics::ManagedSurface *surface) : _surface(surface) { double monoAspect = g_conf->_monoAspect; double propAspect = g_conf->_propAspect; double monoSize = g_conf->_monoSize; @@ -103,5 +103,24 @@ Graphics::Font *Fonts::loadFont(FACES face, double size, double aspect, int styl return Graphics::loadTTFFont(f, size, Graphics::kTTFSizeModeCharacter); } +int Fonts::drawString(int x, int y, int fidx, const byte *rgb, const char *s, int n, int spw) { + // TODO + return 0; +} + +int Fonts::drawStringUni(int x, int y, int fidx, const byte *rgb, const uint32 *s, int n, int spw) { + // TODO + return 0; +} + +int Fonts::stringWidth(int fidx, const char *s, int n, int spw) { + // TODO + return 0; +} + +int Fonts::stringWidthUni(int fidx, const uint32 *s, int n, int spw) { + // TODO + return 0; +} } // End of namespace Gargoyle diff --git a/engines/gargoyle/fonts.h b/engines/gargoyle/fonts.h index be00a8db8a..35db815ec4 100644 --- a/engines/gargoyle/fonts.h +++ b/engines/gargoyle/fonts.h @@ -35,16 +35,9 @@ enum FACES { MONOR, MONOB, MONOI, MONOZ, PROPR, PROPB, PROPI, PROPZ }; enum TYPES { MONOF, PROPF }; enum STYLES { FONTR, FONTB, FONTI, FONTZ }; -/* -class Font { - -public: - Font(const char *name, double size, double aspect, STYLES style); -}; -*/ - class Fonts { private: + Graphics::ManagedSurface *_surface; Graphics::Font *_fontTable[FONTS_TOTAL]; private: Graphics::Font *loadFont(FACES face, double size, double aspect, int style); @@ -57,12 +50,20 @@ public: /** * Constructor */ - Fonts(); + Fonts(Graphics::ManagedSurface *surface); /** * Destructor */ virtual ~Fonts(); + + int drawString(int x, int y, int fidx, const byte *rgb, const char *s, int n, int spw); + + int drawStringUni(int x, int y, int fidx, const byte *rgb, const uint32 *s, int n, int spw); + + int stringWidth(int fidx, const char *s, int n, int spw); + + int stringWidthUni(int fidx, const uint32 *s, int n, int spw); }; } // End of namespace Gargoyle diff --git a/engines/gargoyle/screen.cpp b/engines/gargoyle/screen.cpp index dad3e6d4d3..f541b760cf 100644 --- a/engines/gargoyle/screen.cpp +++ b/engines/gargoyle/screen.cpp @@ -34,26 +34,6 @@ void Screen::fillRect(uint x, uint y, uint w, uint h, const byte *rgb) { Graphics::Screen::fillRect(Common::Rect(x, y, x + w, y + h), color); } -int Screen::drawString(int x, int y, int fidx, const byte *rgb, const char *s, int n, int spw) { - // TODO - return 0; -} - -int Screen::drawStringUni(int x, int y, int fidx, const byte *rgb, const uint32 *s, int n, int spw) { - // TODO - return 0; -} - -int Screen::stringWidth(int fidx, const char *s, int n, int spw) { - // TODO - return 0; -} - -int Screen::stringWidthUni(int fidx, const uint32 *s, int n, int spw) { - // TODO - return 0; -} - void Screen::drawCaret(const Common::Point &pos) { // TODO } diff --git a/engines/gargoyle/screen.h b/engines/gargoyle/screen.h index b1d24fa557..8cdf988777 100644 --- a/engines/gargoyle/screen.h +++ b/engines/gargoyle/screen.h @@ -28,8 +28,13 @@ namespace Gargoyle { -class Screen : public Graphics::Screen, Fonts { +class Screen : public Graphics::Screen, public Fonts { public: + /** + * Constructor + */ + Screen() : Graphics::Screen(), Fonts(this) {} + /** * Fills the screen with a given rgb color */ @@ -40,14 +45,6 @@ public: */ void fillRect(uint x, uint y, uint w, uint h, const byte *rgb); - int drawString(int x, int y, int fidx, const byte *rgb, const char *s, int n, int spw); - - int drawStringUni(int x, int y, int fidx, const byte *rgb, const uint32 *s, int n, int spw); - - int stringWidth(int fidx, const char *s, int n, int spw); - - int stringWidthUni(int fidx, const uint32 *s, int n, int spw); - void drawCaret(const Common::Point &pos); }; -- cgit v1.2.3