summaryrefslogtreecommitdiffhomepage
path: root/src/text.c
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2017-01-15 01:10:23 +0100
committerraysan5 <[email protected]>2017-01-15 01:10:23 +0100
commit61f6b0f707f408b89306ff1a6a2d825662ba8311 (patch)
tree91cb2122b654478c95835b248d369a9465b8a1c6 /src/text.c
parent4a158d972d9d110fcb581bc9f6583d05a2dc2544 (diff)
downloadraylib-61f6b0f707f408b89306ff1a6a2d825662ba8311.tar.gz
raylib-61f6b0f707f408b89306ff1a6a2d825662ba8311.zip
Removed GetNextPOT(), review TraceLog()
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/text.c b/src/text.c
index 74d5940b..4510b3af 100644
--- a/src/text.c
+++ b/src/text.c
@@ -36,7 +36,7 @@
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
#include <stdio.h> // Required for: FILE, fopen(), fclose(), fscanf(), feof(), rewind(), fgets()
-#include "utils.h" // Required for: GetExtension(), GetNextPOT()
+#include "utils.h" // Required for: GetExtension()
// Following libs are used on LoadTTF()
#define STBTT_STATIC // Define stb_truetype functions static to this module
@@ -930,7 +930,10 @@ static SpriteFont LoadTTF(const char *fileName, int fontSize, int numChars, int
// NOTE: Font texture size is predicted (being as much conservative as possible)
// Predictive method consist of supposing same number of chars by line-column (sqrtf)
// and a maximum character width of 3/4 of fontSize... it worked ok with all my tests...
- int textureSize = GetNextPOT(ceil((float)fontSize*3/4)*ceil(sqrtf((float)numChars)));
+
+ // Calculate next power-of-two value
+ float guessSize = ceilf((float)fontSize*3/4)*ceilf(sqrtf((float)numChars));
+ int textureSize = (int)powf(2, ceilf(logf((float)guessSize)/logf(2))); // Calculate next POT
TraceLog(INFO, "TTF spritefont loading: Predicted texture size: %ix%i", textureSize, textureSize);