- [FIX] Fallaba al carregar fonts amb format de final de linea de Windows
This commit is contained in:
2
mini.cpp
2
mini.cpp
@@ -435,6 +435,7 @@ uint8_t loadfont_from_buffer(const char* buffer, uint8_t index, const char* name
|
|||||||
memcpy(line, ptr, len);
|
memcpy(line, ptr, len);
|
||||||
line[len] = '\0';
|
line[len] = '\0';
|
||||||
ptr += (ptr[len] == '\n') ? len + 1 : len; // Advance pointer
|
ptr += (ptr[len] == '\n') ? len + 1 : len; // Advance pointer
|
||||||
|
if (len > 0 && line[len - 1] == '\r') line[len - 1] = '\0';
|
||||||
|
|
||||||
if (strncmp(line, "bitmap=", 7) != 0) return false; // Parse first line
|
if (strncmp(line, "bitmap=", 7) != 0) return false; // Parse first line
|
||||||
|
|
||||||
@@ -453,6 +454,7 @@ uint8_t loadfont_from_buffer(const char* buffer, uint8_t index, const char* name
|
|||||||
memcpy(line, ptr, len);
|
memcpy(line, ptr, len);
|
||||||
line[len] = '\0';
|
line[len] = '\0';
|
||||||
ptr += (ptr[len] == '\n') ? len + 1 : len; // Advance pointer
|
ptr += (ptr[len] == '\n') ? len + 1 : len; // Advance pointer
|
||||||
|
if (len > 0 && line[len - 1] == '\r') line[len - 1] = '\0';
|
||||||
|
|
||||||
// Remove comments
|
// Remove comments
|
||||||
char* hash = strchr(line, '#');
|
char* hash = strchr(line, '#');
|
||||||
|
|||||||
Reference in New Issue
Block a user