Skip to content

Commit

Permalink
c
Browse files Browse the repository at this point in the history
  • Loading branch information
KrahJohlito committed Nov 16, 2024
1 parent 48c56f9 commit 200370b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/fntsys.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,14 @@ static int fntLoadDefaultInternal(char *path, int fontSize, int slot)
}

if (fntLoadSlot(&newFont, path, fontSize) != FNT_ERROR) {
// Lock access and replace the font in the specified slot
// copy over the new font definition
// we have to lock this phase, as the old font may still be used
// Note: No check for concurrency is done here, which is kinda funky!
WaitSema(gFontSemaId);
memcpy(&oldFont, &fonts[slot], sizeof(font_t));
memcpy(&fonts[slot], &newFont, sizeof(font_t));

// Delete the old font
// delete the old font
fntDeleteSlot(&oldFont);
SignalSema(gFontSemaId);

Expand Down

0 comments on commit 200370b

Please sign in to comment.