mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-14 07:48:58 +00:00
GLK: Beginnings of font handling
This commit is contained in:
parent
efacc17bd1
commit
65fa4fa7cb
@ -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
|
||||
|
@ -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
|
||||
|
@ -69,9 +69,10 @@ void GargoyleEngine::initialize() {
|
||||
DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling");
|
||||
|
||||
initGraphics(640, 480, false);
|
||||
_screen = new Screen();
|
||||
_clipboard = new Clipboard();
|
||||
_conf = new Conf();
|
||||
_screen = new Screen();
|
||||
|
||||
_clipboard = new Clipboard();
|
||||
_events = new Events();
|
||||
_picList = new PicList();
|
||||
_streams = new Streams();
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user