From fbad53d1a8cc89d07227165042cd55e7ed9c5dd2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 22 Sep 2013 15:56:01 +0300 Subject: add support in ADNROID+SDL2 for loading data from assets. --- src/gui/sdlfont.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/gui/sdlfont.cpp') diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp index eb05bea8d..07da298b2 100644 --- a/src/gui/sdlfont.cpp +++ b/src/gui/sdlfont.cpp @@ -35,6 +35,7 @@ #include "resources/surfaceimagehelper.h" #include "utils/paths.h" +#include "utils/physfsrwops.h" #include "utils/sdlcheckutils.h" #include @@ -397,8 +398,12 @@ SDLFont::~SDLFont() TTF_Font *SDLFont::openFont(const char *const name, const int size) { - return TTF_OpenFontIndex(ResourceManager::getInstance()->getPath( - name).c_str(), size, 0); + logger->log("font to open: %s", name); + ResourceManager *const resman = ResourceManager::getInstance(); + SDL_RWops *const rw = MPHYSFSRWOPS_openRead(name); + if (!rw) + return nullptr; + return TTF_OpenFontIndexRW(rw, 1, size, 0); } void SDLFont::loadFont(std::string filename, -- cgit v1.2.3-70-g09d2