diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-05-20 20:04:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-05-21 01:19:25 +0300 |
commit | 46f7f1bfd524f95dcff7d422d591c9c43f542834 (patch) | |
tree | ea2ffb19488c90758ada713fe1bf1ee457110b60 /src/gui/fonts/font.cpp | |
parent | 9dc3d09dd336f46ce988a41eeaed4c7f229d25cc (diff) | |
download | plus-46f7f1bfd524f95dcff7d422d591c9c43f542834.tar.gz plus-46f7f1bfd524f95dcff7d422d591c9c43f542834.tar.bz2 plus-46f7f1bfd524f95dcff7d422d591c9c43f542834.tar.xz plus-46f7f1bfd524f95dcff7d422d591c9c43f542834.zip |
In SDL2 builds at first try load fonts from virtfs.
Diffstat (limited to 'src/gui/fonts/font.cpp')
-rw-r--r-- | src/gui/fonts/font.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/gui/fonts/font.cpp b/src/gui/fonts/font.cpp index 70adce617..173a188c2 100644 --- a/src/gui/fonts/font.cpp +++ b/src/gui/fonts/font.cpp @@ -70,6 +70,9 @@ #include "fs/paths.h" #include "fs/virtfs/tools.h" +#ifdef USE_SDL2 +#include "fs/virtfs/rwops.h" +#endif // USE_SDL2 #include "gui/fonts/textchunk.h" @@ -187,13 +190,20 @@ Font::~Font() TTF_Font *Font::openFont(const char *const name, const int size) { -// disabled for now because some systems can't use it. why? -// #ifdef USE_SDL2 -// SDL_RWops *const rw = VirtFs::rwopsOpenRead(name); -// if (!rw) -// return nullptr; -// return TTF_OpenFontIndexRW(rw, 1, size, 0); -// #else +#ifdef USE_SDL2 + SDL_RWops *const rw = VirtFs::rwopsOpenRead(name); + if (rw) + { + logger->log("Loading virtfs font file: %s", + name); + return TTF_OpenFontIndexRW(rw, 1, size, 0); + } + else + { + reportAlways("Error: Loading virtfs font file: %s", + name); + } +#endif const std::string path = VirtFs::getPath(name); if (Files::existsLocal(path) == false) { @@ -208,7 +218,6 @@ TTF_Font *Font::openFont(const char *const name, path.c_str()); return TTF_OpenFontIndex(path.c_str(), size, 0); -// #endif } void Font::loadFont(std::string filename, |