Fix interface font loading

This commit is contained in:
Alexander Batalov 2022-10-25 15:57:31 +03:00
parent c47113ca29
commit 40510539ee
1 changed files with 3 additions and 3 deletions

View File

@ -159,12 +159,12 @@ static int interfaceFontLoad(int font_index)
interfaceFontByteSwapInt32(&(glyph->offset)); interfaceFontByteSwapInt32(&(glyph->offset));
} }
fileSize -= sizeof(InterfaceFontDescriptor); int glyphDataSize = fileSize - 2060;
fontDescriptor->data = (unsigned char*)internal_malloc_safe(fileSize, __FILE__, __LINE__); // FONTMGR.C, 259 fontDescriptor->data = (unsigned char*)internal_malloc_safe(glyphDataSize, __FILE__, __LINE__); // FONTMGR.C, 259
if (fontDescriptor->data == NULL) goto err; if (fontDescriptor->data == NULL) goto err;
if (fileRead(fontDescriptor->data, fileSize, 1, stream) != 1) { if (fileRead(fontDescriptor->data, glyphDataSize, 1, stream) != 1) {
internal_free_safe(fontDescriptor->data, __FILE__, __LINE__); // FONTMGR.C, 268 internal_free_safe(fontDescriptor->data, __FILE__, __LINE__); // FONTMGR.C, 268
goto err; goto err;
} }