From 94b3a63e0cc89d8475d292b4acffdd53f27db7b5 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 21 May 2007 08:01:45 +0000 Subject: [PATCH] From Olaf Flebbe, "FlightGear/OSG on Windows did not load the Texture Fonts. 1) TXF Fonts are binary. 2) Do not rely on the result of istream::readsome if buffer _is_ empty and no data have been read before." --- src/osgPlugins/txf/ReaderWriterTXF.cpp | 2 +- src/osgPlugins/txf/TXFFont.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osgPlugins/txf/ReaderWriterTXF.cpp b/src/osgPlugins/txf/ReaderWriterTXF.cpp index 9fa9f9a27..db4155d33 100644 --- a/src/osgPlugins/txf/ReaderWriterTXF.cpp +++ b/src/osgPlugins/txf/ReaderWriterTXF.cpp @@ -39,7 +39,7 @@ class ReaderWriterTXF : public osgDB::ReaderWriter if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; std::ifstream stream; - stream.open(fileName.c_str(), std::ios::in); + stream.open(fileName.c_str(), std::ios::in | std::ios::binary); if (!stream.is_open()) return ReadResult::FILE_NOT_FOUND; TXFFont* impl = new TXFFont(fileName); diff --git a/src/osgPlugins/txf/TXFFont.cpp b/src/osgPlugins/txf/TXFFont.cpp index ec8509f2c..aea1a4e6b 100644 --- a/src/osgPlugins/txf/TXFFont.cpp +++ b/src/osgPlugins/txf/TXFFont.cpp @@ -136,7 +136,7 @@ bool TXFFont::loadFont(std::istream& stream) { unsigned char magic[4]; - stream.readsome(reinterpret_cast(&magic), 4); + stream.read(reinterpret_cast(&magic), 4); if (magic[0] != 0xFF || magic[1] != 't' || magic[2] != 'x' || magic[3] != 'f' ) {