diff options
author | Paul Gilbert | 2018-10-27 19:35:30 -0700 |
---|---|---|
committer | Paul Gilbert | 2018-12-08 19:05:59 -0800 |
commit | 65fa4fa7cbfeb5eae8da6e8a4a077f3c8e1866f6 (patch) | |
tree | 65d9afb089cfa3fad55ab35a411b50df4b38c8a0 | |
parent | efacc17bd1bea3f0ca316c57f90a5ca9849932b6 (diff) | |
download | scummvm-rg350-65fa4fa7cbfeb5eae8da6e8a4a077f3c8e1866f6.tar.gz scummvm-rg350-65fa4fa7cbfeb5eae8da6e8a4a077f3c8e1866f6.tar.bz2 scummvm-rg350-65fa4fa7cbfeb5eae8da6e8a4a077f3c8e1866f6.zip |
GLK: Beginnings of font handling
-rw-r--r-- | engines/gargoyle/fonts.cpp | 49 | ||||
-rw-r--r-- | engines/gargoyle/fonts.h | 24 | ||||
-rw-r--r-- | engines/gargoyle/gargoyle.cpp | 3 | ||||
-rw-r--r-- | engines/gargoyle/screen.h | 3 |
4 files changed, 77 insertions, 2 deletions
diff --git a/engines/gargoyle/fonts.cpp b/engines/gargoyle/fonts.cpp index 9c84a123db..9264db2f46 100644 --- a/engines/gargoyle/fonts.cpp +++ b/engines/gargoyle/fonts.cpp @@ -22,9 +22,54 @@ #include "gargoyle/fonts.h" #include "gargoyle/glk_types.h" +#include "gargoyle/conf.h" namespace Gargoyle { +const char *gli_conf_propr = "NotoSerif-Regular"; +const char *gli_conf_propb = "NotoSerif-Bold"; +const char *gli_conf_propi = "NotoSerif-Italic"; +const char *gli_conf_propz = "NotoSerif-BoldItalic"; + +const char *gli_conf_monor = "GoMono-Regular"; +const char *gli_conf_monob = "GoMono-Bold"; +const char *gli_conf_monoi = "GoMono-Italic"; +const char *gli_conf_monoz = "GoMono-BoldItalic"; + +#ifdef BUNDLED_FONTS +const char *gli_conf_monofont = ""; +const char *gli_conf_propfont = ""; +const double gli_conf_monosize = 12.5; ///< good size for GoMono +const double gli_conf_propsize = 13.4; ///< good size for NotoSerif +#else +const char *gli_conf_monofont = "Liberation Mono"; +const char *gli_conf_propfont = "Linux Libertine O"; +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() { + double monoAspect = g_conf->_monoAspect; + double propAspect = g_conf->_propAspect; + double monoSize = g_conf->_monoSize; + double propSize = g_conf->_propSize; + + _fontTable[0] = new Font(gli_conf_monor, monoSize, monoAspect, FONTR); + _fontTable[1] = new Font(gli_conf_monob, monoSize, monoAspect, FONTB); + _fontTable[2] = new Font(gli_conf_monoi, monoSize, monoAspect, FONTI); + _fontTable[3] = new Font(gli_conf_monoz, monoSize, monoAspect, FONTZ); + + _fontTable[4] = new Font(gli_conf_propr, propSize, propAspect, FONTR); + _fontTable[5] = new Font(gli_conf_propb, propSize, propAspect, FONTB); + _fontTable[6] = new Font(gli_conf_propi, propSize, propAspect, FONTI); + _fontTable[7] = new Font(gli_conf_propz, propSize, propAspect, FONTZ); +} + +Fonts::~Fonts() { + for (int idx = 0; idx < FONTS_TOTAL; ++idx) + delete _fontTable[idx]; +} + FACES Fonts::getId(const Common::String &name) { if (name == "monor") return MONOR; if (name == "monob") return MONOB; @@ -37,4 +82,8 @@ FACES Fonts::getId(const Common::String &name) { return MONOR; } +/*--------------------------------------------------------------------------*/ + + + } // End of namespace Gargoyle diff --git a/engines/gargoyle/fonts.h b/engines/gargoyle/fonts.h index f2f701a602..c3034743ce 100644 --- a/engines/gargoyle/fonts.h +++ b/engines/gargoyle/fonts.h @@ -28,16 +28,40 @@ namespace Gargoyle { +#define FONTS_TOTAL 8 + enum FACES { MONOR, MONOB, MONOI, MONOZ, PROPR, PROPB, PROPI, PROPZ }; enum TYPES { MONOF, PROPF }; enum STYLES { FONTR, FONTB, FONTI, FONTZ }; +class Font { +public: + /** + * Constructor + */ + Font(const char *name, double size, double aspect, STYLES style) { + // TODO + } +}; + class Fonts { +private: + Font *_fontTable[FONTS_TOTAL]; public: /** * Get the index/id of a font by name */ static FACES getId(const Common::String &name); +public: + /** + * Constructor + */ + Fonts(); + + /** + * Destructor + */ + virtual ~Fonts(); }; } // End of namespace Gargoyle diff --git a/engines/gargoyle/gargoyle.cpp b/engines/gargoyle/gargoyle.cpp index 1f74c31c79..3135fcb5fe 100644 --- a/engines/gargoyle/gargoyle.cpp +++ b/engines/gargoyle/gargoyle.cpp @@ -69,9 +69,10 @@ void GargoyleEngine::initialize() { DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); initGraphics(640, 480, false); + _conf = new Conf(); _screen = new Screen(); + _clipboard = new Clipboard(); - _conf = new Conf(); _events = new Events(); _picList = new PicList(); _streams = new Streams(); diff --git a/engines/gargoyle/screen.h b/engines/gargoyle/screen.h index ce9088d556..b1d24fa557 100644 --- a/engines/gargoyle/screen.h +++ b/engines/gargoyle/screen.h @@ -24,10 +24,11 @@ #define GARGOYLE_DRAW_H #include "graphics/screen.h" +#include "gargoyle/fonts.h" namespace Gargoyle { -class Screen : public Graphics::Screen { +class Screen : public Graphics::Screen, Fonts { public: /** * Fills the screen with a given rgb color |