aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2019-08-24 20:03:47 +0200
committerRay <raysan5@gmail.com>2019-08-24 20:03:47 +0200
commite67c842faa67123b65e2e2c5093c8d532f7bf130 (patch)
tree99fefe1511fd953e61d9d0d838d20bc5e4b02221 /src
parent061294e4d174f684c77d479e4fb461f4bff844ef (diff)
downloadraylib-e67c842faa67123b65e2e2c5093c8d532f7bf130.tar.gz
raylib-e67c842faa67123b65e2e2c5093c8d532f7bf130.zip
Tweak on atlas size computing
Some generated fonts were not fitting the image...
Diffstat (limited to 'src')
-rw-r--r--src/text.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/text.c b/src/text.c
index 79e46d0c..4eb1b4b0 100644
--- a/src/text.c
+++ b/src/text.c
@@ -586,7 +586,7 @@ Image GenImageFontAtlas(const CharInfo *chars, Rectangle **charRecs, int charsCo
*charRecs = NULL;
// In case no chars count provided we suppose default of 95
- charsCount = (charsCount > 0) ? charsCount : 95;
+ charsCount = (charsCount > 0)? charsCount : 95;
// NOTE: Rectangles memory is loaded here!
Rectangle *recs = (Rectangle *)RL_MALLOC(charsCount*sizeof(Rectangle));
@@ -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