[Scummvm-cvs-logs] SF.net SVN: scummvm:[55227] scummvm/trunk/graphics/fonts/winfont.cpp
mthreepwood at users.sourceforge.net
mthreepwood at users.sourceforge.net
Thu Jan 13 17:06:35 CET 2011
Revision: 55227
http://scummvm.svn.sourceforge.net/scummvm/?rev=55227&view=rev
Author: mthreepwood
Date: 2011-01-13 16:06:35 +0000 (Thu, 13 Jan 2011)
Log Message:
-----------
GRAPHICS: Begin to parse Win1 fonts based on our sole Hugo1 sample (still WIP)
Modified Paths:
--------------
scummvm/trunk/graphics/fonts/winfont.cpp
Modified: scummvm/trunk/graphics/fonts/winfont.cpp
===================================================================
--- scummvm/trunk/graphics/fonts/winfont.cpp 2011-01-13 15:34:18 UTC (rev 55226)
+++ scummvm/trunk/graphics/fonts/winfont.cpp 2011-01-13 16:06:35 UTC (rev 55227)
@@ -91,7 +91,7 @@
uint16 numFonts = fontDirectory->readUint16LE();
- // Probably not possible, so this is really sanity check
+ // Probably not possible, so this is really a sanity check
if (numFonts == 0) {
warning("No fonts in '%s'", fileName.c_str());
return false;
@@ -166,15 +166,9 @@
bool WinFont::loadFromFNT(Common::SeekableReadStream &stream) {
uint16 version = stream.readUint16LE();
- // We'll accept Win2 and Win3 fonts
- if (version != 0x200 && version != 0x300) {
- if (version == 0x100) {
- // TODO: Hugo1 has a font with this
- // Even FreeType won't accept this font!
- warning("Windows 1.0 font? Specs please");
- } else
- warning("Bad FNT version %04x", version);
-
+ // We'll accept Win1, Win2, and Win3 fonts
+ if (version != 0x100 && version != 0x200 && version != 0x300) {
+ warning("Bad FNT version %04x", version);
return false;
}
@@ -205,10 +199,13 @@
/* uint32 device = */ stream.readUint32LE();
/* uint32 face = */ stream.readUint32LE();
/* uint32 bitsPointer = */ stream.readUint32LE();
- /* uint32 bitsOffset = */ stream.readUint32LE();
+ uint32 bitsOffset = stream.readUint32LE();
/* byte reserved = */ stream.readByte();
- if (version == 0x300) {
+ if (version == 0x100) {
+ // Seems Win1 has an extra byte?
+ stream.readByte();
+ } else if (version == 0x300) {
// For Windows 3.0, Microsoft added 6 new fields. All of which are
// guaranteed to be 0. Which leads to the question: Why add these at all?
@@ -232,6 +229,10 @@
_glyphs[i].charWidth = pixWidth;
_glyphs[i].offset = (version == 0x300) ? stream.readUint32LE() : stream.readUint16LE();
+
+ // Seems the offsets in the Win1 font format are based on bitsOffset
+ if (version == 0x100)
+ _glyphs[i].offset += bitsOffset;
}
// TODO: Currently only raster fonts are supported!
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list