Prepare textFontLoad for x64

This commit is contained in:
Alexander Batalov 2022-06-12 00:02:54 +03:00
parent f796a724d1
commit c0b98ba90e

View File

@ -125,9 +125,18 @@ int textFontLoad(int font)
goto out;
}
if (fileRead(textFontDescriptor, sizeof(TextFontDescriptor), 1, stream) != 1) {
goto out;
}
// NOTE: Original code reads entire descriptor in one go. This does not work
// in x64 because of the two pointers.
if (fileRead(&(textFontDescriptor->glyphCount), 4, 1, stream) != 1) goto out;
if (fileRead(&(textFontDescriptor->lineHeight), 4, 1, stream) != 1) goto out;
if (fileRead(&(textFontDescriptor->letterSpacing), 4, 1, stream) != 1) goto out;
int glyphsPtr;
if (fileRead(&glyphsPtr, 4, 1, stream) != 1) goto out;
int dataPtr;
if (fileRead(&dataPtr, 4, 1, stream) != 1) goto out;
textFontDescriptor->glyphs = (TextFontGlyph*)internal_malloc(textFontDescriptor->glyphCount * sizeof(TextFontGlyph));
if (textFontDescriptor->glyphs == NULL) {