Skip to content

Commit

Permalink
Prepare textFontLoad for x64
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbatalov committed Jun 11, 2022
1 parent f796a72 commit c0b98ba
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/text_font.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c0b98ba

Please sign in to comment.