[Scummvm-git-logs] scummvm master -> 13422c315188075f2fdbe20543610239150cf347

sev- sev at scummvm.org
Tue Jan 17 00:33:43 CET 2017


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:
13422c3151 GRAPHICS: More work on FOND loading


Commit: 13422c315188075f2fdbe20543610239150cf347
    https://github.com/scummvm/scummvm/commit/13422c315188075f2fdbe20543610239150cf347
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-17T00:33:34+01:00

Commit Message:
GRAPHICS: More work on FOND loading

Changed paths:
    graphics/fonts/macfont.cpp
    graphics/fonts/macfont.h


diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index a78e865..57e7ad2 100644
--- a/graphics/fonts/macfont.cpp
+++ b/graphics/fonts/macfont.cpp
@@ -136,19 +136,48 @@ bool MacFont::loadFOND(Common::SeekableReadStream &stream) {
 		_ffAssocEntries[i]._fontID    = stream.readUint16BE(); // font resource ID
 	}
 
-	_ffNumOffsets = stream.readUint16BE(); // number of entries - 1
-	_ffOffsets = (uint32 *)calloc(_ffNumOffsets + 1, sizeof(uint32));
-	for (uint i = 0; i <= _ffNumOffsets; i++)
-		_ffOffsets[i] = stream.readUint32BE();
-
-	_ffNumBBoxes = stream.readUint16BE(); // number of entries - 1
-	_ffBBoxes.resize(_ffNumBBoxes + 1);
-	for (uint i = 0; i <= _ffNumBBoxes; i++) {
-		_ffBBoxes[i]._style  = stream.readUint16BE();
-		_ffBBoxes[i]._left   = stream.readUint16BE();
-		_ffBBoxes[i]._bottom = stream.readUint16BE();
-		_ffBBoxes[i]._right  = stream.readUint16BE();
-		_ffBBoxes[i]._top    = stream.readUint16BE();
+	if (_ffWTabOff || _ffStylOff || _ffKernOff) {
+		_ffNumOffsets = stream.readUint16BE(); // number of entries - 1
+		_ffOffsets = (uint32 *)calloc(_ffNumOffsets + 1, sizeof(uint32));
+		for (uint i = 0; i <= _ffNumOffsets; i++)
+			_ffOffsets[i] = stream.readUint32BE();
+
+		_ffNumBBoxes = stream.readUint16BE(); // number of entries - 1
+		_ffBBoxes.resize(_ffNumBBoxes + 1);
+		for (uint i = 0; i <= _ffNumBBoxes; i++) {
+			_ffBBoxes[i]._style  = stream.readUint16BE();
+			_ffBBoxes[i]._left   = stream.readUint16BE();
+			_ffBBoxes[i]._bottom = stream.readUint16BE();
+			_ffBBoxes[i]._right  = stream.readUint16BE();
+			_ffBBoxes[i]._top    = stream.readUint16BE();
+		}
+	}
+
+	if (_ffWTabOff) {
+		// TODO: Read widths table
+	}
+
+	if (_ffStylOff) {
+		// TODO: Read styles table
+	}
+
+	if (_ffKernOff) {
+		stream.seek(_ffKernOff);
+
+		_ffNumKerns = stream.readUint16BE(); // number of entries - 1
+		_ffKernEntries.resize(_ffNumKerns + 1);
+
+		for (uint i = 0; i <= _ffNumKerns; i++) {
+			_ffKernEntries[i]._style       = stream.readUint16BE();
+			_ffKernEntries[i]._entryLength = stream.readUint16BE();
+			_ffKernEntries[i]._kernPairs.resize(_ffKernEntries[i]._entryLength / 4);
+
+			for (uint j = 0; j < _ffKernEntries[i]._entryLength / 4; j++) {
+				_ffKernEntries[i]._kernPairs[j]._firstChar = stream.readByte();
+				_ffKernEntries[i]._kernPairs[j]._secondChar = stream.readByte();
+				_ffKernEntries[i]._kernPairs[j]._distance = stream.readUint16BE();
+			}
+		}
 	}
 
 	return true;
diff --git a/graphics/fonts/macfont.h b/graphics/fonts/macfont.h
index e006fee..40a54f2 100644
--- a/graphics/fonts/macfont.h
+++ b/graphics/fonts/macfont.h
@@ -28,20 +28,6 @@
 
 namespace Graphics {
 
-struct AsscEntry {
-	uint16 _fontSize;
-	uint16 _fontStyle;
-	uint16 _fontID;
-};
-
-struct BBoxEntry {
-	uint16 _style;
-	uint16 _left;
-	uint16 _bottom;
-	uint16 _right;
-	uint16 _top;
-};
-
 /**
  * Processing of Mac FONT/NFNT rResources
  */
@@ -90,15 +76,44 @@ private:
 	uint16 _ffIntl[2];
 	uint16 _ffVersion;
 
+	struct AsscEntry {
+		uint16 _fontSize;
+		uint16 _fontStyle;
+		uint16 _fontID;
+	};
+
 	uint16 _ffNumAssoc;
 	Common::Array<AsscEntry> _ffAssocEntries;
 
 	uint16 _ffNumOffsets;
 	uint32 *_ffOffsets;
 
+	struct BBoxEntry {
+		uint16 _style;
+		uint16 _left;
+		uint16 _bottom;
+		uint16 _right;
+		uint16 _top;
+	};
+
 	uint16 _ffNumBBoxes;
 	Common::Array<BBoxEntry> _ffBBoxes;
 
+	struct KernPair {
+		byte _firstChar;
+		byte _secondChar;
+		uint16 _distance;
+	};
+
+	struct KernEntry {
+		uint16 _style;
+		uint16 _entryLength;
+		Common::Array<KernPair> _kernPairs;
+	};
+
+	uint16 _ffNumKerns;
+	Common::Array<KernEntry> _ffKernEntries;
+
 	byte *_bitImage;
 
 	struct Glyph {





More information about the Scummvm-git-logs mailing list