mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-11 13:58:15 +00:00
Tweak on atlas size computing
Some generated fonts were not fitting the image...
This commit is contained in:
@@ -597,7 +597,7 @@ Image GenImageFontAtlas(const CharInfo *chars, Rectangle **charRecs, int charsCo
|
||||
// so image size would result bigger than default font type
|
||||
float requiredArea = 0;
|
||||
for (int i = 0; i < charsCount; i++) requiredArea += ((chars[i].image.width + 2*padding)*(chars[i].image.height + 2*padding));
|
||||
float guessSize = sqrtf(requiredArea)*1.25f;
|
||||
float guessSize = sqrtf(requiredArea)*1.3f;
|
||||
int imageSize = (int)powf(2, ceilf(logf((float)guessSize)/logf(2))); // Calculate next POT
|
||||
|
||||
atlas.width = imageSize; // Atlas bitmap width
|
||||
|
Reference in New Issue
Block a user