[Scummvm-git-logs] scummvm master -> 6a231e4b6025b8dc0fb6ad7ff26388261ac7642f

bgK bastien.bouclet at gmail.com
Wed May 1 06:12:38 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
6a231e4b60 GRAPHICS: Look for fonts.dat in extrapath


Commit: 6a231e4b6025b8dc0fb6ad7ff26388261ac7642f
    https://github.com/scummvm/scummvm/commit/6a231e4b6025b8dc0fb6ad7ff26388261ac7642f
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2019-05-01T05:50:08+02:00

Commit Message:
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.

Changed paths:
    graphics/fonts/ttf.cpp


diff --git a/graphics/fonts/ttf.cpp b/graphics/fonts/ttf.cpp
index 0b7ae50..89f26c7 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);





More information about the Scummvm-git-logs mailing list