REVIEWED: `ExportFontAsCode()`, avoid `const` #4013

This commit is contained in:
Ray 2024-05-29 17:28:55 +02:00
parent 2804e75869
commit e37d19ab1e
1 changed files with 4 additions and 4 deletions

View File

@ -1035,7 +1035,7 @@ bool ExportFontAsCode(Font font, const char *fileName)
// Save font recs data
byteCount += sprintf(txtData + byteCount, "// Font characters rectangles data\n");
byteCount += sprintf(txtData + byteCount, "static const Rectangle fontRecs_%s[%i] = {\n", fileNamePascal, font.glyphCount);
byteCount += sprintf(txtData + byteCount, "static Rectangle fontRecs_%s[%i] = {\n", fileNamePascal, font.glyphCount);
for (int i = 0; i < font.glyphCount; i++)
{
byteCount += sprintf(txtData + byteCount, " { %1.0f, %1.0f, %1.0f , %1.0f },\n", font.recs[i].x, font.recs[i].y, font.recs[i].width, font.recs[i].height);
@ -1047,7 +1047,7 @@ bool ExportFontAsCode(Font font, const char *fileName)
// it could be generated from image and recs
byteCount += sprintf(txtData + byteCount, "// Font glyphs info data\n");
byteCount += sprintf(txtData + byteCount, "// NOTE: No glyphs.image data provided\n");
byteCount += sprintf(txtData + byteCount, "static const GlyphInfo fontGlyphs_%s[%i] = {\n", fileNamePascal, font.glyphCount);
byteCount += sprintf(txtData + byteCount, "static GlyphInfo fontGlyphs_%s[%i] = {\n", fileNamePascal, font.glyphCount);
for (int i = 0; i < font.glyphCount; i++)
{
byteCount += sprintf(txtData + byteCount, " { %i, %i, %i, %i, { 0 }},\n", font.glyphs[i].value, font.glyphs[i].offsetX, font.glyphs[i].offsetY, font.glyphs[i].advanceX);
@ -1093,8 +1093,8 @@ bool ExportFontAsCode(Font font, const char *fileName)
#else
byteCount += sprintf(txtData + byteCount, " // Assign glyph recs and info data directly\n");
byteCount += sprintf(txtData + byteCount, " // WARNING: This font data must not be unloaded\n");
byteCount += sprintf(txtData + byteCount, " font.recs = (Rectangle *)fontRecs_%s;\n", fileNamePascal);
byteCount += sprintf(txtData + byteCount, " font.glyphs = (GlyphInfo *)fontGlyphs_%s;\n\n", fileNamePascal);
byteCount += sprintf(txtData + byteCount, " font.recs = fontRecs_%s;\n", fileNamePascal);
byteCount += sprintf(txtData + byteCount, " font.glyphs = fontGlyphs_%s;\n\n", fileNamePascal);
#endif
byteCount += sprintf(txtData + byteCount, " return font;\n");
byteCount += sprintf(txtData + byteCount, "}\n");