From 60605f01b686ef9d509c57d77c7aa34ebce0c2e6 Mon Sep 17 00:00:00 2001 From: badlydrawnrod Date: Mon, 14 Dec 2020 15:11:17 +0000 Subject: [PATCH] Handle CRLF line endings reading fontFileName. (#114) If you have a style file with CRLF line endings and specify a font file on a system that expects LF line endings, then the font file will fail to load with an error such as... WARNING: FILEIO: [./assets/terminal/Mecha.ttf ] Failed to open file ...because it sees the CR as part of the name. Adding '\r' to the negated scanset for sscanf() fixes the issue. --- src/raygui.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/raygui.h b/src/raygui.h index 3bb57b4..607248a 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -2784,7 +2784,7 @@ void GuiLoadStyle(const char *fileName) int fontSize = 0; char charmapFileName[256] = { 0 }; char fontFileName[256] = { 0 }; - sscanf(buffer, "f %d %s %[^\n]s", &fontSize, charmapFileName, fontFileName); + sscanf(buffer, "f %d %s %[^\r\n]s", &fontSize, charmapFileName, fontFileName); Font font = { 0 };