summaryrefslogtreecommitdiffhomepage
path: root/src/text.c
diff options
context:
space:
mode:
authorRay <[email protected]>2018-01-28 16:52:18 +0100
committerRay <[email protected]>2018-01-28 16:52:18 +0100
commit1ce8c80de9f2270735ac371b655b2ca7de90d55a (patch)
tree31bbb387fc3cce047f833e5e699415c0d62d702d /src/text.c
parentf955b2255d447d4e6edd7b5f0a01032f443bc7d7 (diff)
downloadraylib-1ce8c80de9f2270735ac371b655b2ca7de90d55a.tar.gz
raylib-1ce8c80de9f2270735ac371b655b2ca7de90d55a.zip
Corrected several issues...
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/text.c b/src/text.c
index eaf450b0..e2629b09 100644
--- a/src/text.c
+++ b/src/text.c
@@ -66,8 +66,8 @@
//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------
-#define MAX_FORMATTEXT_LENGTH 64
-#define MAX_SUBTEXT_LENGTH 64
+#define MAX_FORMATTEXT_LENGTH 256
+#define MAX_SUBTEXT_LENGTH 256
//----------------------------------------------------------------------------------
// Types and Structures Definition
@@ -318,21 +318,20 @@ SpriteFont LoadSpriteFont(const char *fileName)
SpriteFont LoadSpriteFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars)
{
SpriteFont spriteFont = { 0 };
+ int totalChars = 95; // Default charset [32..126]
#if defined(SUPPORT_FILEFORMAT_TTF)
if (IsFileExtension(fileName, ".ttf"))
{
- if ((fontChars == NULL) || (charsCount == 0))
+ if (charsCount != 0) totalChars = charsCount;
+
+ if (fontChars == NULL)
{
- int totalChars = 95; // Default charset [32..126]
-
- int *defaultFontChars = (int *)malloc(totalChars*sizeof(int));
-
- for (int i = 0; i < totalChars; i++) defaultFontChars[i] = i + 32; // Default first character: SPACE[32]
-
- spriteFont = LoadTTF(fileName, fontSize, totalChars, defaultFontChars);
+ fontChars = (int *)malloc(totalChars*sizeof(int));
+ for (int i = 0; i < totalChars; i++) fontChars[i] = i + 32; // Default first character: SPACE[32]
}
- else spriteFont = LoadTTF(fileName, fontSize, charsCount, fontChars);
+
+ spriteFont = LoadTTF(fileName, fontSize, totalChars, fontChars);
}
#endif