mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-06 03:18:14 +00:00
REVIEWED: Font atlas image generation, added some comments #5141
This commit is contained in:
@@ -834,7 +834,9 @@ Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyp
|
|||||||
atlas.height = imageSize; // Atlas bitmap height
|
atlas.height = imageSize; // Atlas bitmap height
|
||||||
#else
|
#else
|
||||||
int paddedFontSize = fontSize + 2*padding;
|
int paddedFontSize = fontSize + 2*padding;
|
||||||
|
|
||||||
// No need for a so-conservative atlas generation
|
// No need for a so-conservative atlas generation
|
||||||
|
// NOTE: Multiplying total expected are by 1.2f scale factor
|
||||||
float totalArea = totalWidth*paddedFontSize*1.2f;
|
float totalArea = totalWidth*paddedFontSize*1.2f;
|
||||||
float imageMinSize = sqrtf(totalArea);
|
float imageMinSize = sqrtf(totalArea);
|
||||||
int imageSize = (int)powf(2, ceilf(logf(imageMinSize)/logf(2)));
|
int imageSize = (int)powf(2, ceilf(logf(imageMinSize)/logf(2)));
|
||||||
@@ -887,7 +889,7 @@ Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyp
|
|||||||
recs[j].width = 0;
|
recs[j].width = 0;
|
||||||
recs[j].height = 0;
|
recs[j].height = 0;
|
||||||
}
|
}
|
||||||
break;
|
break; // Break for() loop, stop processing glyphs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user