aboutsummaryrefslogtreecommitdiff
path: root/graphics/fonts
diff options
context:
space:
mode:
authorEugene Sandulenko2017-01-17 00:33:16 +0100
committerEugene Sandulenko2017-01-17 00:33:34 +0100
commit13422c315188075f2fdbe20543610239150cf347 (patch)
treeb9278f3a05f07373df4f77a36dea0972b44c4060 /graphics/fonts
parent66453dac06e9a3a815d2cf755fab610ed2c72071 (diff)
downloadscummvm-rg350-13422c315188075f2fdbe20543610239150cf347.tar.gz
scummvm-rg350-13422c315188075f2fdbe20543610239150cf347.tar.bz2
scummvm-rg350-13422c315188075f2fdbe20543610239150cf347.zip
GRAPHICS: More work on FOND loading
Diffstat (limited to 'graphics/fonts')
-rw-r--r--graphics/fonts/macfont.cpp55
-rw-r--r--graphics/fonts/macfont.h43
2 files changed, 71 insertions, 27 deletions
diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index a78e865645..57e7ad25c6 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 e006fee0d1..40a54f2087 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 {