Fixed a minor bug in Font::LoadFromStream

This commit is contained in:
Laurent Gomila 2011-07-21 20:37:46 +02:00
parent 853c2349ed
commit d337a98321

View File

@ -46,9 +46,15 @@ namespace
unsigned long Read(FT_Stream rec, unsigned long offset, unsigned char* buffer, unsigned long count)
{
sf::InputStream* stream = static_cast<sf::InputStream*>(rec->descriptor.pointer);
if (stream->Seek(offset) != offset)
return count ? 1 : 0; // error code is 0 if we're reading, or nonzero if we're seeking
if (stream->Seek(offset) == offset)
{
if (count > 0)
return static_cast<unsigned long>(stream->Read(reinterpret_cast<char*>(buffer), count));
else
return 0;
}
else
return count > 0 ? 0 : 1; // error code is 0 if we're reading, or nonzero if we're seeking
}
void Close(FT_Stream)
{