load NUT fonts even if they do not specify full 256 chars (e.g. the COMI demo only defines 233 chars

svn-id: r6685
This commit is contained in:
Max Horn 2003-03-04 02:45:50 +00:00
parent 89f6ebb77c
commit db404cb1c4

View File

@ -105,25 +105,20 @@ bool NutRenderer::loadFont(const char *filename, const char *dir) {
int32 l;
uint32 offset = READ_BE_UINT32(_dataSrc + 4) + 8;
memset(_offsets, 0, 256 * sizeof(int32));
for (l = 0; l < 256; l++) {
if (READ_BE_UINT32(_dataSrc + offset) == 'FRME') {
offset += 8;
if (READ_BE_UINT32(_dataSrc + offset) == 'FOBJ') {
_offsets[l] = offset + 8;
offset += READ_BE_UINT32(_dataSrc + offset + 4) + 8;
} else {
debug(2, "NutRenderer::loadFont(%s, %s) there is no FOBJ chunk in FRME chunk %d (offset %x)", filename, dir, l, offset);
break;
}
else {
debug(2, "NutRenderer::loadFont() there is no FRME chunk");
free(_dataSrc);
_dataSrc = NULL;
return false;
}
}
else {
debug(2, "NutRenderer::loadFont() there is no FOBJ chunk in FRME chunk");
free(_dataSrc);
_dataSrc = NULL;
return false;
} else {
debug(2, "NutRenderer::loadFont(%s, %s) there is no FRME chunk %d (offset %x)", filename, dir, l, offset);
break;
}
}