aboutsummaryrefslogtreecommitdiff
path: root/src/text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/text.c b/src/text.c
index 9617c11a..ec0ffa74 100644
--- a/src/text.c
+++ b/src/text.c
@@ -886,6 +886,8 @@ int *GetCodepoints(const char *text, int *count)
codepoints[codepointsCount] = GetNextCodepoint(text + i, &bytesProcessed);
i += bytesProcessed;
}
+
+ *count = codepointsCount;
return codepoints;
}
@@ -1594,18 +1596,15 @@ static Font LoadBMFont(const char *fileName)
TraceLog(LOG_DEBUG, "[%s] Font texture loading path: %s", fileName, texPath);
Image imFont = LoadImage(texPath);
- Image imFontAlpha = ImageCopy(imFont);
if (imFont.format == UNCOMPRESSED_GRAYSCALE)
{
- for (int i = 0; i < imFontAlpha.width*imFontAlpha.height; i++) ((unsigned char *)imFontAlpha.data)[i] = 0xff;
-
- ImageAlphaMask(&imFontAlpha, imFont);
- font.texture = LoadTextureFromImage(imFontAlpha);
+ // Convert image to GRAYSCALE + ALPHA, using the mask as the alpha channel
+ ImageAlphaMask(&imFont, imFont);
+ for (int p = 0; p < (imFont.width*imFont.height*2); p += 2) ((unsigned char *)(imFont.data))[p] = 0xff;
}
- else font.texture = LoadTextureFromImage(imFont);
- UnloadImage(imFont);
+ font.texture = LoadTextureFromImage(imFont);
RL_FREE(texPath);
@@ -1633,10 +1632,10 @@ static Font LoadBMFont(const char *fileName)
font.chars[i].advanceX = charAdvanceX;
// Fill character image data from imFont data
- font.chars[i].image = ImageFromImage(imFontAlpha, font.recs[i]);
+ font.chars[i].image = ImageFromImage(imFont, font.recs[i]);
}
- UnloadImage(imFontAlpha);
+ UnloadImage(imFont);
fclose(fntFile);