diff options
author | Bastien Bouclet | 2019-05-01 05:50:08 +0200 |
---|---|---|
committer | Bastien Bouclet | 2019-05-01 05:50:08 +0200 |
commit | 6a231e4b6025b8dc0fb6ad7ff26388261ac7642f (patch) | |
tree | b6952eb044e1c2dec9c198e3db062099912066e0 /graphics/fonts | |
parent | 0e7a8a548d6bcba26ee0c67354692c0aadbc0156 (diff) | |
download | scummvm-rg350-6a231e4b6025b8dc0fb6ad7ff26388261ac7642f.tar.gz scummvm-rg350-6a231e4b6025b8dc0fb6ad7ff26388261ac7642f.tar.bz2 scummvm-rg350-6a231e4b6025b8dc0fb6ad7ff26388261ac7642f.zip |
GRAPHICS: Look for fonts.dat in extrapath
When running from the source tree, it is convenient to have extrapath
set to dists/engine-data, where fonts.dat is located.
Diffstat (limited to 'graphics/fonts')
-rw-r--r-- | graphics/fonts/ttf.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/graphics/fonts/ttf.cpp b/graphics/fonts/ttf.cpp index 0b7ae50e41..89f26c7727 100644 --- a/graphics/fonts/ttf.cpp +++ b/graphics/fonts/ttf.cpp @@ -32,6 +32,7 @@ #include "graphics/surface.h" #include "common/file.h" +#include "common/config-manager.h" #include "common/singleton.h" #include "common/stream.h" #include "common/memstream.h" @@ -669,14 +670,24 @@ Font *loadTTFFont(Common::SeekableReadStream &stream, int size, TTFSizeMode size } Font *loadTTFFontFromArchive(const Common::String &filename, int size, TTFSizeMode sizeMode, uint dpi, TTFRenderMode renderMode, const uint32 *mapping) { - Common::Archive *archive; - if (!Common::File::exists("fonts.dat") || (archive = Common::makeZipArchive("fonts.dat")) == nullptr) { - return 0; + Common::SeekableReadStream *archiveStream = nullptr; + if (ConfMan.hasKey("extrapath")) { + Common::FSDirectory extrapath(ConfMan.get("extrapath")); + archiveStream = extrapath.createReadStreamForMember("fonts.dat"); + } + + if (!archiveStream) { + archiveStream = SearchMan.createReadStreamForMember("fonts.dat"); + } + + Common::Archive *archive = Common::makeZipArchive(archiveStream); + if (!archive) { + return nullptr; } Common::File f; if (!f.open(filename, *archive)) { - return 0; + return nullptr; } Font *font = loadTTFFont(f, size, sizeMode, dpi, renderMode, mapping); |